Build applications that make decisions (chatbots, agents, simulations, etc...). Monitor, trace, persist, and execute on your own infrastructure.
Python aiburrchatbot-frameworkdagsgenerative-aigraphshacktoberfestllmopsllmsmlopspersistent-data-structurestate-machinestate-managementvisibility
Adds minor waterfall chart for within spans
elijahbenizzy441ab2de2293
diff --git a/telemetry/ui/src/components/routes/app/AppView.tsx b/telemetry/ui/src/components/routes/app/AppView.tsxindex e63e74d3..fabf90cb 100644--- a/telemetry/ui/src/components/routes/app/AppView.tsx+++ b/telemetry/ui/src/components/routes/app/AppView.tsx@@ -18,6 +18,15 @@ const getPriorActions = (currentActionIndex: number, steps: Step[], numPrevious:const REFRESH_INTERVAL = 500;+export const backgroundColorsForStatus = (status: Status) => {+ const colorsByStatus = {+ success: 'bg-green-500/80',+ failure: 'bg-dwred/80',+ running: 'bg-dwlightblue/80'+ };+ return colorsByStatus[status];+};+/*** Some tailwind mappings for bg colors -- we get progressively lighter the further back in* time we godiff --git a/telemetry/ui/src/components/routes/app/StepList.tsx b/telemetry/ui/src/components/routes/app/StepList.tsxindex 586a3827..ca8d809f 100644--- a/telemetry/ui/src/components/routes/app/StepList.tsx+++ b/telemetry/ui/src/components/routes/app/StepList.tsx@@ -1,10 +1,10 @@import { Span, Step } from '../../../api';import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '../../common/table';import { DateTimeDisplay, DurationDisplay, TimeDisplay } from '../../common/dates';-import { backgroundColorsForIndex } from './AppView';+import { backgroundColorsForIndex, backgroundColorsForStatus } from './AppView';import { Status, getActionStatus } from '../../../utils';import { Chip } from '../../common/chip';-import { useState } from 'react';+import { useRef, useState } from 'react';import {ArrowPathIcon,ChevronLeftIcon,@@ -238,12 +238,21 @@ const TraceSubTable = (props: {<TimeDisplay date={props.step.step_start_log.start_time} /></div></TableCell>- <TableCell colSpan={3}>+ <TableCell colSpan={1}><RuntimeDisplaystart={span.begin_entry.start_time}end={span.end_entry?.end_time}/></TableCell>+ <TableCell colSpan={1} className="h-full">+ <WaterfallPiece+ step={props.step}+ span={span}+ bgColor={backgroundColorsForStatus(getActionStatus(props.step))}+ isHighlighted={shouldBeHighlighted}+ />+ </TableCell>+ <TableCell /></>)}</CommonTableRow>@@ -253,6 +262,35 @@ const TraceSubTable = (props: {);};+const WaterfallPiece: React.FC<{+ step: Step;+ span: Span;+ bgColor: string;+ isHighlighted: boolean;+}> = (props) => {+ const containerRef = useRef<HTMLDivElement>(null);+ const totalTimeMilliseconds =+ new Date(props.step.step_end_log?.end_time || new Date()).getTime() -+ new Date(props.step.step_start_log.start_time).getTime();++ const spanStartMilliseconds = new Date(props.span.begin_entry.start_time).getTime();+ const spanEndMilliseconds = new Date(props.span.end_entry?.end_time || new Date()).getTime();+ const bgColor = props.isHighlighted ? 'bg-white' : props.bgColor;+ return (+ <div ref={containerRef} className="w-full h-4 px-3">+ <div+ className={`${bgColor} opacity-50`}+ style={{+ width: `${Math.max(((spanEndMilliseconds - spanStartMilliseconds) / totalTimeMilliseconds) * 100, 1)}%`,+ position: 'relative',+ height: '100%',+ left: `${((spanStartMilliseconds - new Date(props.step.step_start_log.start_time).getTime()) / totalTimeMilliseconds) * 100}%`+ }}+ ></div>+ </div>+ );+};+const ExpandAllButton = (props: { isExpanded: boolean; toggleExpandAll: () => void }) => {const ExpandAllIcon = props.isExpanded ? MinusIcon : PlusIcon;return (