Skip to content

armgit / burr

Public Imported from GitHub
0

Build applications that make decisions (chatbots, agents, simulations, etc...). Monitor, trace, persist, and execute on your own infrastructure.

Streaming support + timeline view/UI overhaul

elijahbenizzyb6128c97e2f6
diff --git a/telemetry/ui/src/api/index.ts b/telemetry/ui/src/api/index.ts
index 5d92fad0..721d334b 100644
--- a/telemetry/ui/src/api/index.ts
+++ b/telemetry/ui/src/api/index.ts
@@ -21,9 +21,12 @@ export type { DraftInit } from './models/DraftInit';
export { EmailAssistantState } from './models/EmailAssistantState';
export type { EndEntryModel } from './models/EndEntryModel';
export type { EndSpanModel } from './models/EndSpanModel';
+export type { EndStreamModel } from './models/EndStreamModel';
export type { Feedback } from './models/Feedback';
+export type { FirstItemStreamModel } from './models/FirstItemStreamModel';
export type { HTTPValidationError } from './models/HTTPValidationError';
export type { IndexingJob } from './models/IndexingJob';
+export type { InitializeStreamModel } from './models/InitializeStreamModel';
export type { PointerModel } from './models/PointerModel';
export type { Project } from './models/Project';
export type { PromptInput } from './models/PromptInput';
diff --git a/telemetry/ui/src/api/models/AttributeModel.ts b/telemetry/ui/src/api/models/AttributeModel.ts
index db262eb0..7f8fc6e8 100644
--- a/telemetry/ui/src/api/models/AttributeModel.ts
+++ b/telemetry/ui/src/api/models/AttributeModel.ts
@@ -12,4 +12,5 @@ export type AttributeModel = {
span_id: string | null;
value: Record<string, any> | string | number | boolean | null;
tags: Record<string, string>;
+ time_logged?: string | null;
};
diff --git a/telemetry/ui/src/api/models/EndStreamModel.ts b/telemetry/ui/src/api/models/EndStreamModel.ts
new file mode 100644
index 00000000..3a7f5cc3
--- /dev/null
+++ b/telemetry/ui/src/api/models/EndStreamModel.ts
@@ -0,0 +1,14 @@
+/* generated using openapi-typescript-codegen -- do no edit */
+/* istanbul ignore file */
+/* tslint:disable */
+/* eslint-disable */
+/**
+ * Pydantic model that represents an entry for the first item of a stream
+ */
+export type EndStreamModel = {
+ type?: string;
+ action_sequence_id: number;
+ span_id: string | null;
+ end_time: string;
+ items_streamed: number;
+};
diff --git a/telemetry/ui/src/api/models/FirstItemStreamModel.ts b/telemetry/ui/src/api/models/FirstItemStreamModel.ts
new file mode 100644
index 00000000..9cf6897f
--- /dev/null
+++ b/telemetry/ui/src/api/models/FirstItemStreamModel.ts
@@ -0,0 +1,13 @@
+/* generated using openapi-typescript-codegen -- do no edit */
+/* istanbul ignore file */
+/* tslint:disable */
+/* eslint-disable */
+/**
+ * Pydantic model that represents an entry for the first item of a stream
+ */
+export type FirstItemStreamModel = {
+ type?: string;
+ action_sequence_id: number;
+ span_id: string | null;
+ first_item_time: string;
+};
diff --git a/telemetry/ui/src/api/models/InitializeStreamModel.ts b/telemetry/ui/src/api/models/InitializeStreamModel.ts
new file mode 100644
index 00000000..d1a4d038
--- /dev/null
+++ b/telemetry/ui/src/api/models/InitializeStreamModel.ts
@@ -0,0 +1,13 @@
+/* generated using openapi-typescript-codegen -- do no edit */
+/* istanbul ignore file */
+/* tslint:disable */
+/* eslint-disable */
+/**
+ * Pydantic model that represents an entry for the beginning of a stream
+ */
+export type InitializeStreamModel = {
+ type?: string;
+ action_sequence_id: number;
+ span_id: string | null;
+ stream_init_time: string;
+};
diff --git a/telemetry/ui/src/api/models/Step.ts b/telemetry/ui/src/api/models/Step.ts
index 24edf73e..69639316 100644
--- a/telemetry/ui/src/api/models/Step.ts
+++ b/telemetry/ui/src/api/models/Step.ts
@@ -5,6 +5,9 @@
import type { AttributeModel } from './AttributeModel';
import type { BeginEntryModel } from './BeginEntryModel';
import type { EndEntryModel } from './EndEntryModel';
+import type { EndStreamModel } from './EndStreamModel';
+import type { FirstItemStreamModel } from './FirstItemStreamModel';
+import type { InitializeStreamModel } from './InitializeStreamModel';
import type { Span } from './Span';
/**
* Log of astep -- has a start and an end.
@@ -14,4 +17,5 @@ export type Step = {
step_end_log: EndEntryModel | null;
spans: Array<Span>;
attributes: Array<AttributeModel>;
+ streaming_events: Array<InitializeStreamModel | FirstItemStreamModel | EndStreamModel>;
};
diff --git a/telemetry/ui/src/components/common/chip.tsx b/telemetry/ui/src/components/common/chip.tsx
index 485702b6..71e0242f 100644
--- a/telemetry/ui/src/components/common/chip.tsx
+++ b/telemetry/ui/src/components/common/chip.tsx
@@ -10,7 +10,14 @@ const chipColorMap = {
demo: 'bg-yellow-400',
test: 'bg-gray-800',
fork: 'bg-dwdarkblue/80',
- spawn: 'bg-purple-600'
+ spawn: 'bg-purple-600',
+ span: 'bg-yellow-500/80',
+ attribute: 'bg-gray-500',
+ error: 'bg-dwred',
+ action: 'bg-dwlightblue/90',
+ stream: 'bg-dwlightblue/90',
+ first_item_stream: 'bg-pink-400',
+ end_stream: 'bg-pink-400'
};
export type ChipType = keyof typeof chipColorMap;
@@ -20,12 +27,18 @@ export type ChipType = keyof typeof chipColorMap;
* This makes it easy to centralize meaning across the repository
* although it breaks encapsulation.
*/
-export const Chip = (props: { label: string; chipType: ChipType; className?: string }) => {
+export const Chip = (props: {
+ label: string;
+ chipType: ChipType;
+ className?: string;
+ onClick?: (e: React.MouseEvent) => void;
+}) => {
const bgColor = chipColorMap[props.chipType];
+ const clickable = props.onClick !== undefined;
return (
<div
className={`relative grid select-none items-center whitespace-nowrap rounded-lg
- p-1 px-3 font-sans text-xs font-semibold text-white ${bgColor} ${
+ p-1 px-3 font-sans text-xs font-semibold text-white ${clickable ? 'cursor-pointer hover:underline' : ''} ${bgColor} ${
props.className ? props.className : ''
}`}
>
diff --git a/telemetry/ui/src/components/common/dates.tsx b/telemetry/ui/src/components/common/dates.tsx
index c6d8f4d3..944eb5d6 100644
--- a/telemetry/ui/src/components/common/dates.tsx
+++ b/telemetry/ui/src/components/common/dates.tsx
@@ -14,7 +14,11 @@ export const DateDisplay: React.FC<{ date: string }> = ({ date }) => {
/**
* Displays a datetime in a human-readable format
*/
-export const DateTimeDisplay: React.FC<{ date: string; mode: 'short' | 'long' }> = (props) => {
+export const DateTimeDisplay: React.FC<{
+ date: string;
+ mode: 'short' | 'long';
+ displayMillis?: boolean;
+}> = (props) => {
const displayDateTime = new Date(props.date).toLocaleString('en-US', {
day: 'numeric',
month: props.mode === 'short' ? 'numeric' : 'long',
@@ -22,6 +26,7 @@ export const DateTimeDisplay: React.FC<{ date: string; mode: 'short' | 'long' }>
hour: 'numeric',
minute: '2-digit',
second: 'numeric',
+ fractionalSecondDigits: props.displayMillis ? 3 : undefined,
hour12: true // Use AM/PM format. Set to false for 24-hour format.
});
@@ -38,31 +43,58 @@ export const TimeDisplay: React.FC<{ date: string }> = ({ date }) => {
return <span className="whitespace-nowrap text-sm text-gray-500">{displayTime}</span>;
};
-
-/**
- * Formats a duration in a human-readable format.
- * Works for durations in milliseconds, seconds, and microseconds,
- * which is the expected size of durations in the backend.
- */
const formatDuration = (duration: number) => {
- if (duration < 1) {
- return '<1 ms';
- }
- if (duration < 1000) {
+ const msInSecond = 1_000;
+ const msInMinute = 60_000;
+ const msInHour = 3_600_000;
+ const msInDay = 86_400_000;
+
+ if (duration < msInSecond) {
return `${duration} ms`;
- } else if (duration < 1000000) {
- return `${(duration / 1000).toFixed(2)} s`;
- } else {
- return `${(duration / 1000000).toFixed(2)} μs`;
}
+
+ const days = Math.floor(duration / msInDay);
+ duration %= msInDay;
+
+ const hours = Math.floor(duration / msInHour);
+ duration %= msInHour;
+
+ const minutes = Math.floor(duration / msInMinute);
+ duration %= msInMinute;
+
+ const seconds = duration / msInSecond;
+
+ const ms = duration % msInSecond;
+
+ if (days > 0) {
+ return `${days} d ${hours} h`;
+ }
+
+ if (hours > 0) {
+ return `${hours} h ${minutes} m`;
+ }
+
+ if (minutes > 0) {
+ return `${minutes} m ${seconds.toFixed(3)} s`;
+ }
+
+ if (seconds > 0) {
+ return `${seconds} s`;
+ }
+
+ return `${ms} s`;
};
/**
* Displays a duration for use in a table
*/
-export const DurationDisplay: React.FC<{ startDate: string; endDate: string }> = (props) => {
+export const DurationDisplay: React.FC<{
+ startDate: string | number;
+ endDate: string | number;
+ clsNames?: string;
+}> = (props) => {
const duration = new Date(props.endDate).getTime() - new Date(props.startDate).getTime();
const formattedDuration = formatDuration(duration);
- return <span className="whitespace-nowrap text-sm text-gray-500">{formattedDuration}</span>;
+ return <span className={`whitespace-nowrap text-sm ${props.clsNames}`}>{formattedDuration}</span>;
};
diff --git a/telemetry/ui/src/components/common/layout.tsx b/telemetry/ui/src/components/common/layout.tsx
index 22a4b8e7..e42f09a1 100644
--- a/telemetry/ui/src/components/common/layout.tsx
+++ b/telemetry/ui/src/components/common/layout.tsx
@@ -1,18 +1,34 @@
-import React, { ReactNode } from 'react';
+import React, { ReactNode, useEffect } from 'react';
type TwoPanelLayoutProps = {
firstItem: ReactNode;
secondItem: ReactNode;
- mode: 'half' | 'first-minimal' | 'third';
+ mode: 'half' | 'first-minimal' | 'third' | 'expanding-second';
+ animateSecondPanel?: boolean;
};
/**
- * A layout component that takes two children and renders them in a 50/50 split.
+ * A layout component that takes two children and renders them.
+ *
+ * This is an ugly monolith as we specifically want this to be the same object
+ * across react renders (which can be finnicky), as we want the state of the
+ * contents to be preserved. This allows you to toglge full screen.
+ *
+ * TODO -- manage the state of the contents better so we can split this into
+ * multiple separate component types.
+ *
*/
export const TwoColumnLayout: React.FC<TwoPanelLayoutProps> = ({
firstItem: firstColumnContent,
secondItem: secondColumnContent,
- mode
+ mode,
+ animateSecondPanel = false
}) => {
+ const [showSecondPanel, setShowSecondPanel] = React.useState(animateSecondPanel);
+ useEffect(() => {
+ if (mode === 'expanding-second') {
+ setShowSecondPanel(animateSecondPanel);
+ }
+ }, [animateSecondPanel, mode]);
if (mode === 'first-minimal') {
return (
<div className={`flex h-full w-full ${mode === 'first-minimal' ? 'flex flex-1' : ''}`}>
@@ -29,6 +45,31 @@ export const TwoColumnLayout: React.FC<TwoPanelLayoutProps> = ({
</div>
);
}
+ if (mode === 'expanding-second') {
+ return (
+ <div
+ className={`flex h-full w-full transition-all duration-500 ${mode === 'expanding-second' && showSecondPanel ? 'overflow-hidden' : ''}`}
+ >
+ <div
+ className={`h-full ${mode === 'expanding-second' ? 'transition-all duration-500' : ''} ${showSecondPanel ? 'w-1/2' : 'w-full'}`}
+ >
+ {firstColumnContent}
+ </div>
+ {mode === 'expanding-second' && (
+ <div
+ className={`h-full ${showSecondPanel ? 'w-1/2' : 'w-0'} transition-all duration-500 overflow-hidden`}
+ >
+ {secondColumnContent}
+ </div>
+ )}
+ {mode !== 'expanding-second' && (
+ <div className={`w-1/2 h-full ${mode === 'third' ? 'w-2/3' : 'w-1/2'}`}>
+ {secondColumnContent}
+ </div>
+ )}
+ </div>
+ );
+ }
return (
<div className="flex h-full w-full">
<div className="w-1/2 h-full">{firstColumnContent}</div>
@@ -36,6 +77,7 @@ export const TwoColumnLayout: React.FC<TwoPanelLayoutProps> = ({
</div>
);
};
+
export const TwoRowLayout: React.FC<TwoPanelLayoutProps> = ({
firstItem: topRowContent,
secondItem: bottomRowContent
diff --git a/telemetry/ui/src/components/common/table.tsx b/telemetry/ui/src/components/common/table.tsx
index 230b3fcb..0f543398 100644
--- a/telemetry/ui/src/components/common/table.tsx
+++ b/telemetry/ui/src/components/common/table.tsx
@@ -41,7 +41,8 @@ export function Table({
<div className="flow-root">
<div
{...props}
- className={clsx(className, '-mx-[--gutter] overflow-x-auto whitespace-nowrap')}
+ // TODO - this is currently hidden cause of weird stuff, but we really shouldn't be, we should figure out why it's overflowing
+ className={clsx(className, '-mx-[--gutter] overflow-x-hidden whitespace-nowrap')}
>
<div
className={clsx('inline-block min-w-full align-middle', !bleed && 'sm:px-[--gutter]')}
@@ -129,7 +130,7 @@ export function TableCell({ className, children, ...props }: React.ComponentProp
'relative px-4 first:pl-[var(--gutter,theme(spacing.2))] last:pr-[var(--gutter,theme(spacing.2))]',
!striped && 'border-b border-zinc-950/5 dark:border-white/5',
grid && 'border-l border-l-zinc-950/5 first:border-l-0 dark:border-l-white/5',
- dense === 0 ? 'py-4' : dense === 1 ? 'py-2.5' : 'py-0.2', //'py-2.5' : 'py-4',
+ dense === 0 ? 'py-4' : dense === 1 ? 'py-2.5' : dense === 2 ? 'py-1' : 'py-0.2', //'py-2.5' : 'py-4',
!bleed && 'sm:first:pl-2 sm:last:pr-2'
)}
>
diff --git a/telemetry/ui/src/components/common/tabs.tsx b/telemetry/ui/src/components/common/tabs.tsx
index 5dc639f0..1f79e3e3 100644
--- a/telemetry/ui/src/components/common/tabs.tsx
+++ b/telemetry/ui/src/components/common/tabs.tsx
@@ -12,6 +12,8 @@ export const Tabs = (props: {
currentTab: string;
setCurrentTab: (tab: string) => void;
}) => {
+ // const MinimizeTableIcon = props.isMinimized ? ChevronRightIcon : ChevronLeftIcon;
+
const { currentTab, setCurrentTab } = props;
return (
<div>
@@ -24,14 +26,15 @@ export const Tabs = (props: {
id="tabs"
name="tabs"
className="block w-full rounded-md border-gray-300 focus:border-indigo-500 focus:ring-indigo-500"
- defaultValue={currentTab}>
+ defaultValue={currentTab}
+ >
{props.tabs.map((tab) => (
<option key={tab.id}>{tab.displayName}</option>
))}
</select>
</div>
<div className="hidden sm:block">
- <nav className="flex space-x-4" aria-label="Tabs">
+ <nav className="flex space-x-4 flex-row pl-2" aria-label="Tabs">
{props.tabs.map((tab) => (
<span
onClick={() => setCurrentTab(tab.id)}
@@ -42,7 +45,8 @@ export const Tabs = (props: {
: 'text-gray-500 hover:text-gray-700',
'rounded-md px-3 py-2 text-sm font-medium hover:cursor-pointer'
)}
- aria-current={tab.id === currentTab ? 'page' : undefined}>
+ aria-current={tab.id === currentTab ? 'page' : undefined}
+ >
{tab.displayName}
</span>
))}
diff --git a/telemetry/ui/src/components/common/tooltip.tsx b/telemetry/ui/src/components/common/tooltip.tsx
new file mode 100644
index 00000000..a707a9db
--- /dev/null
+++ b/telemetry/ui/src/components/common/tooltip.tsx
@@ -0,0 +1,39 @@
+import { ReactNode, useState } from 'react';
+
+export const Tooltip: React.FC<{ text: string; children: ReactNode }> = ({ text, children }) => {
+ const [isVisible, setIsVisible] = useState(false);
+ const [tooltipStyle, setTooltipStyle] = useState<React.CSSProperties>({});
+
+ const handleMouseEnter = (e: React.MouseEvent) => {
+ const { clientX, clientY } = e;
+ setTooltipStyle({
+ left: `${clientX}px`,
+ top: `${clientY - 5}px`, // 5px above the cursor
+ position: 'absolute'
+ });
+ setIsVisible(true);
+ };
+
+ const handleMouseLeave = () => {
+ setIsVisible(false);
+ };
+
+ return (
+ <div className="relative inline-block">
+ <div
+ onMouseEnter={handleMouseEnter}
+ onMouseLeave={handleMouseLeave}
+ className="cursor-pointer"
+ >
+ {children}
+ </div>
+ {isVisible && (
+ <div className="absolute bg-gray-700 text-white text-sm p-2 rounded" style={tooltipStyle}>
+ {text}
+ </div>
+ )}
+ </div>
+ );
+};
+
+export default Tooltip;
diff --git a/telemetry/ui/src/components/routes/app/AppView.tsx b/telemetry/ui/src/components/routes/app/AppView.tsx
index 5943db7f..d9d3f32f 100644
--- a/telemetry/ui/src/components/routes/app/AppView.tsx
+++ b/telemetry/ui/src/components/routes/app/AppView.tsx
@@ -81,18 +81,28 @@ export const backgroundColorsForIndex = (index: number, status: Status) => {
};
// Default number of previous actions to show
-const NUM_PREVIOUS_ACTIONS = 6;
+const NUM_PREVIOUS_ACTIONS = 0;
export type HighlightState = {
attributesHighlighted: AttributeModel[];
setAttributesHighlighted: (attributes: AttributeModel[]) => void;
setTab: (tab: string) => void;
+ tab: string;
+ setCurrentSelectedIndex: (index: number | undefined) => void;
+ currentSelectedIndex?: number;
+ setCurrentHoverIndex: (index: number | undefined) => void;
+ currentHoverIndex?: number;
};
export const AppViewHighlightContext = createContext<HighlightState>({
attributesHighlighted: [],
setAttributesHighlighted: () => {},
- setTab: () => {}
+ setTab: () => {},
+ tab: 'data',
+ setCurrentSelectedIndex: () => {},
+ currentSelectedIndex: undefined,
+ setCurrentHoverIndex: () => {},
+ currentHoverIndex: undefined
});
/**
@@ -106,8 +116,12 @@ export const AppView = (props: {
partitionKey?: string;
orientation: 'stacked_vertical' | 'stacked_horizontal';
defaultAutoRefresh?: boolean;
+ enableFullScreenStepView: boolean;
+ enableMinizedStepView: boolean;
}) => {
const [searchParams, setSearchParams] = useSearchParams();
+ const [topToBottomChronological, setTopToBottomChronological] = useState(true);
+ const [inspectViewOpen, setInspectViewOpen] = useState(false);
const currentActionIndex = searchParams.get('sequence_id')
? parseInt(searchParams.get('sequence_id')!)
: undefined;
@@ -121,7 +135,6 @@ export const AppView = (props: {
}
setSearchParams(newSearchParams); // Update the searchParams with the new object
};
- console.log(searchParams, '->', currentActionIndex);
const { projectId, appId } = props;
// const [currentActionIndex, setCurrentActionIndex] = useState<number | undefined>(undefined);
const [hoverSequenceID, setHoverSequenceID] = useState<number | undefined>(undefined);
@@ -129,9 +142,25 @@ export const AppView = (props: {
const shouldQuery = projectId !== undefined && appId !== undefined;
const [minimizedTable, setMinimizedTable] = useState(false);
const [highlightedAttributes, setHighlightedAttributes] = useState<AttributeModel[]>([]);
- const displayGraphAsTabs = props.orientation === 'stacked_vertical';
+ const fullScreen = searchParams.get('full') === 'true' && props.enableFullScreenStepView;
+ const displayGraphAsTabs = props.orientation === 'stacked_vertical' || fullScreen;
const defaultTab = displayGraphAsTabs ? 'graph' : 'data';
- const [currentTab, setCurrentTab] = useState(defaultTab);
+ // const [currentTab, setCurrentTab] = useState(defaultTab);
+ const currentTab = searchParams.get('tab') || defaultTab;
+ const setCurrentTab = (tab: string) => {
+ const newSearchParams = new URLSearchParams(searchParams); // Clone the searchParams
+ newSearchParams.set('tab', tab);
+ setSearchParams(newSearchParams); // Update the searchParams with the new object
+ };
+ const setFullScreen = (full: boolean) => {
+ const newSearchParams = new URLSearchParams(searchParams); // Clone the searchParams
+ if (full) {
+ newSearchParams.set('full', 'true');
+ } else {
+ newSearchParams.delete('full');
+ }
+ setSearchParams(newSearchParams); // Update the searchParams with the new object
+ };
const { data, error } = useQuery(
['steps', appId],
() =>
@@ -152,21 +181,21 @@ export const AppView = (props: {
const minSequenceID = Math.min(...steps.map((step) => step.step_start_log.sequence_id));
const handleKeyDown = (event: KeyboardEvent) => {
switch (event.key) {
- case 'ArrowDown':
+ case topToBottomChronological ? 'ArrowUp' : 'ArrowDown':
if (currentActionIndex === undefined || currentActionIndex <= minSequenceID) {
setCurrentActionIndex(minSequenceID);
} else {
setCurrentActionIndex(currentActionIndex - 1);
}
break;
- case 'ArrowUp':
+ case topToBottomChronological ? 'ArrowDown' : 'ArrowUp':
+ // case 'ArrowUp':
if (currentActionIndex === undefined) {
setCurrentActionIndex(maxSequenceID);
} else if (currentActionIndex >= maxSequenceID) {
setCurrentActionIndex(currentActionIndex);
} else {
setCurrentActionIndex(currentActionIndex + 1);
- console.log('incrementing', currentActionIndex, 'to', currentActionIndex + 1);
}
break;
default:
@@ -229,27 +258,32 @@ export const AppView = (props: {
const hoverAction = hoverSequenceID
? stepsSorted.find((step) => step.step_start_log.sequence_id === hoverSequenceID)
: undefined;
+
return (
<AppViewHighlightContext.Provider
value={{
attributesHighlighted: highlightedAttributes,
setAttributesHighlighted: setHighlightedAttributes,
- setTab: setCurrentTab
+ setTab: setCurrentTab,
+ tab: currentTab,
+ setCurrentSelectedIndex: (n) => {
+ setCurrentActionIndex(n);
+ setInspectViewOpen(n !== undefined);
+ },
+ currentSelectedIndex: currentActionIndex,
+ setCurrentHoverIndex: setHoverSequenceID,
+ currentHoverIndex: hoverSequenceID
}}
>
<Layout
- mode={minimizedTable ? 'first-minimal' : 'half'}
+ mode={fullScreen ? 'expanding-second' : minimizedTable ? 'first-minimal' : 'half'}
firstItem={
<div className="w-full h-full flex flex-col">
<div
- className={`overflow-y-scroll hide-scrollbar w-full ${props.orientation === 'stacked_vertical' ? 'h-full' : 'h-1/2'}`}
+ className={`w-full ${fullScreen ? 'h-full' : props.orientation === 'stacked_vertical' ? 'h-full' : 'h-1/2'}`}
>
<StepList
steps={stepsSorted}
- currentHoverIndex={hoverSequenceID}
- setCurrentHoverIndex={setHoverSequenceID}
- currentSelectedIndex={currentActionIndex}
- setCurrentSelectedIndex={setCurrentActionIndex}
numPriorIndices={NUM_PREVIOUS_ACTIONS}
autoRefresh={autoRefresh}
setAutoRefresh={setAutoRefresh}
@@ -259,9 +293,16 @@ export const AppView = (props: {
parentPointer={data?.parent_pointer || undefined}
spawningParentPointer={data?.spawning_parent_pointer || undefined}
links={data.children || []}
+ fullScreen={fullScreen}
+ setFullScreen={setFullScreen}
+ allowFullScreen={props.enableFullScreenStepView}
+ allowMinimized={props.enableMinizedStepView}
+ topToBottomChronological={topToBottomChronological}
+ setTopToBottomChronological={setTopToBottomChronological}
+ toggleInspectViewOpen={() => setInspectViewOpen(!inspectViewOpen)}
/>
</div>
- {props.orientation === 'stacked_horizontal' && (
+ {!fullScreen && props.orientation === 'stacked_horizontal' && (
<div className="h-1/2 w-[full]">
<GraphView
stateMachine={data.application}
@@ -281,10 +322,12 @@ export const AppView = (props: {
hoverAction={hoverAction}
currentSequenceID={currentActionIndex}
displayGraphAsTab={displayGraphAsTabs} // in this case we want the graph as a tab
- currentTab={currentTab}
- setCurrentTab={setCurrentTab}
+ setMinimized={(min: boolean) => setInspectViewOpen(!min)}
+ isMinimized={!inspectViewOpen}
+ allowMinimized={inspectViewOpen && fullScreen}
/>
}
+ animateSecondPanel={inspectViewOpen}
/>
</AppViewHighlightContext.Provider>
);
@@ -301,6 +344,8 @@ export const AppViewContainer = () => {
appId={appId}
partitionKey={partitionKey}
orientation={'stacked_horizontal'}
+ enableFullScreenStepView={true}
+ enableMinizedStepView={true}
/>
);
};
diff --git a/telemetry/ui/src/components/routes/app/DataView.tsx b/telemetry/ui/src/components/routes/app/DataView.tsx
index 70f06daf..2ad7b345 100644
--- a/telemetry/ui/src/components/routes/app/DataView.tsx
+++ b/telemetry/ui/src/components/routes/app/DataView.tsx
@@ -19,7 +19,12 @@ import { MinusIcon } from '@heroicons/react/24/outline';
const CommonJsonView = (props: { value: object; collapsed?: number }) => {
const collapsed = props.collapsed || 2;
return (
- <JsonView value={props.value} collapsed={collapsed} enableClipboard={true}>
+ <JsonView
+ value={props.value}
+ collapsed={collapsed}
+ enableClipboard={true}
+ displayDataTypes={false}
+ >
<JsonView.Arrow
// @ts-ignore
render={({ 'data-expanded': isExpanded }) => {
@@ -399,6 +404,7 @@ export const AttributeView = (props: {
attribute: AttributeModel;
viewRawData: 'render' | 'raw';
isExpanded: boolean;
+ hideHighlight?: boolean;
}) => {
const { attribute, viewRawData, isExpanded } = props;
const attributeAsObject = { [attribute.key]: attribute.value };
@@ -410,7 +416,7 @@ export const AttributeView = (props: {
return (
<div
id={getUniqueAttributeID(attribute)}
- className={`${attributeHighlighted ? 'bg-pink-100' : ''}`}
+ className={`${attributeHighlighted && !props.hideHighlight ? 'bg-pink-100' : ''}`}
>
{viewRawData === 'render' && (
<>
@@ -474,26 +480,26 @@ const Header = (props: {
</div>
);
};
-const RenderedField = (props: {
+export const RenderedField = (props: {
value: string | number | boolean | object | null;
- keyName: string;
- level: number;
+ keyName?: string;
+ level?: number;
defaultExpanded: boolean;
}) => {
const [isExpanded, setExpanded] = useState(true);
useEffect(() => {
- setExpanded(props.defaultExpanded);
+ setExpanded(props.defaultExpanded || false);
}, [props.defaultExpanded, props.value, props.keyName]);
// TODO: have max level depth.
const { value, keyName: key, level } = props;
const bodyClassNames =
'border-gray-100 border-l-[8px] pl-1 hover:bg-gray-100 text-sm text-gray-700';
- if (key.startsWith('__')) {
+ if ((key || '').startsWith('__')) {
return null;
}
return (
- <>
- <Header name={key} isExpanded={isExpanded} setExpanded={setExpanded} />
+ <div className="">
+ {key && <Header name={key} isExpanded={isExpanded} setExpanded={setExpanded} />}
{isExpanded &&
(props.value instanceof Array &&
props.value.length > 0 &&
@@ -504,8 +510,7 @@ const RenderedField = (props: {
) : typeof value === 'string' ? (
<div key={key + '-' + String(level)}>
<pre
- className={bodyClassNames}
- style={{ whiteSpace: 'pre-wrap', wordWrap: 'break-word', maxWidth: '1000px' }}
+ className={`${bodyClassNames} whitespace-pre-wrap word-wrap-break-word max-w-[1000px]`}
>
{value}
</pre>
@@ -519,7 +524,7 @@ const RenderedField = (props: {
<RenderedField
value={v}
keyName={key + '[' + i.toString() + ']'}
- level={level + 1}
+ level={(level || 0) + 1}
defaultExpanded={props.defaultExpanded}
/>
</div>
@@ -543,7 +548,7 @@ const RenderedField = (props: {
<RenderedField
value={v}
keyName={k}
- level={level + 1}
+ level={(level || 0) + 1}
defaultExpanded={props.defaultExpanded}
/>
</div>
@@ -561,7 +566,7 @@ const RenderedField = (props: {
<pre>{value.toString()}</pre>
</div>
))}
- </>
+ </div>
);
};
diff --git a/telemetry/ui/src/components/routes/app/InsightsView.tsx b/telemetry/ui/src/components/routes/app/InsightsView.tsx
index 89d41bc8..1028664b 100644
--- a/telemetry/ui/src/components/routes/app/InsightsView.tsx
+++ b/telemetry/ui/src/components/routes/app/InsightsView.tsx
@@ -1,4 +1,4 @@
-import { AttributeModel, Step } from '../../../api';
+import { AttributeModel, Span, Step } from '../../../api';
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '../../common/table';
import React from 'react';
import { ChevronDownIcon, ChevronUpIcon } from '@heroicons/react/24/outline';
@@ -116,11 +116,19 @@ const REGISTERED_INSIGHTS: Insight[] = [
}
];
-const InsightSubTable = (props: { attributes: AttributeModel[]; insight: Insight }) => {
+const InsightSubTable = (props: {
+ attributes: AttributeModel[];
+ insight: Insight;
+ allSpans: Span[];
+}) => {
const individualValues = props.insight.captureIndividualValues?.(props.attributes);
const [isExpanded, setIsExpanded] = React.useState(false);
const ExpandIcon = isExpanded ? ChevronUpIcon : ChevronDownIcon;
const canExpand = props.insight.captureIndividualValues !== undefined;
+ const spansBySpanID = props.allSpans.reduce((acc, span) => {
+ acc.set(span.begin_entry.span_id, span);
+ return acc;
+ }, new Map<string, Span>());
return (
<>
<TableRow className="hover:bg-gray-50">
@@ -145,11 +153,18 @@ const InsightSubTable = (props: { attributes: AttributeModel[]; insight: Insight
</TableRow>
{isExpanded
? individualValues?.map((attribute, i) => {
+ const span = spansBySpanID.get(attribute.span_id || '');
const insightCasted = props.insight as InsightWithIndividualValues;
return (
<TableRow key={attribute.key + i} className="hover:bg-gray-50">
<TableCell></TableCell>
- <TableCell className=" text-gray-400">{attribute.span_id}</TableCell>
+ <TableCell className=" text-gray-">
+ <div className="flex gap">
+ <div>{span?.begin_entry.action_sequence_id}:</div>
+ <div>{span?.begin_entry.span_name || ''}</div>
+ <div className="pl-2">({attribute.span_id})</div>
+ </div>
+ </TableCell>
<TableCell>
<insightCasted.RenderIndividualValue attribute={attribute} />
</TableCell>
@@ -166,13 +181,15 @@ export const InsightsView = (props: { steps: Step[] }) => {
const allAttributes: AttributeModel[] = props.steps.flatMap((step) => step.attributes);
let noInsights = true;
+ const allSpans = props.steps.flatMap((step) => step.spans);
+
const out = (
<div className="pt-0">
<Table dense={1}>
<TableHead>
<TableRow className="hover:bg-gray-100">
<TableHeader>Name </TableHeader>
- <TableHeader>Span ID</TableHeader>
+ <TableHeader>Span</TableHeader>
<TableHeader>Value</TableHeader>
<TableHeader></TableHeader>
<TableHeader colSpan={1}></TableHeader>
@@ -187,6 +204,7 @@ export const InsightsView = (props: { steps: Step[] }) => {
key={insight.insightName}
attributes={allAttributes}
insight={insight}
+ allSpans={allSpans}
/>
);
}
diff --git a/telemetry/ui/src/components/routes/app/ReproduceView.tsx b/telemetry/ui/src/components/routes/app/ReproduceView.tsx
index 8fcbc480..b5e76deb 100644
--- a/telemetry/ui/src/components/routes/app/ReproduceView.tsx
+++ b/telemetry/ui/src/components/routes/app/ReproduceView.tsx
@@ -73,13 +73,4 @@ export const ReproduceView = (props: {
<pre className="text-white bg-gray-800 p-2 rounded-md text-sm">{cmd}</pre>
</div>
);
- // <span
- // className="cursor-pointer"
- // onClick={() => {
- // navigator.clipboard.writeText(cmd);
- // setIsFlashVisible(true);
- // // alert(`Copied ${cmd} to clipboard`);
- // }}>
- // Step {step ? step.step_start_log.sequence_id : '?'} Test Case 📋
- // </span>;
};
diff --git a/telemetry/ui/src/components/routes/app/StateMachine.tsx b/telemetry/ui/src/components/routes/app/StateMachine.tsx
index a8fe897c..d1ff526a 100644
--- a/telemetry/ui/src/components/routes/app/StateMachine.tsx
+++ b/telemetry/ui/src/components/routes/app/StateMachine.tsx
@@ -6,6 +6,9 @@ import { GraphView } from './GraphView';
import { InsightsView } from './InsightsView';
import { ReproduceView } from './ReproduceView';
import { useParams } from 'react-router-dom';
+import { useContext } from 'react';
+import { AppViewHighlightContext } from './AppView';
+import { ChevronLeftIcon, ChevronRightIcon } from '@heroicons/react/24/outline';
const NoStepSelected = () => {
return (
@@ -21,11 +24,12 @@ export const AppStateView = (props: {
highlightedActions: Step[] | undefined;
hoverAction: Step | undefined;
currentSequenceID: number | undefined;
- currentTab: string;
- setCurrentTab: (tab: string) => void;
displayGraphAsTab: boolean;
+ setMinimized: (minimized: boolean) => void;
+ isMinimized: boolean;
+ allowMinimized: boolean;
}) => {
- const { currentTab, setCurrentTab } = props;
+ const { tab, setTab } = useContext(AppViewHighlightContext);
const currentStep = props.steps.find(
(step) => step.step_start_log.sequence_id === props.currentSequenceID
);
@@ -46,19 +50,27 @@ export const AppStateView = (props: {
if (props.displayGraphAsTab) {
tabs.push({ id: 'graph', displayName: 'Graph' });
}
+ const MinimizeTableIcon = props.isMinimized ? ChevronLeftIcon : ChevronRightIcon;
return (
<>
- <Tabs tabs={tabs} currentTab={currentTab} setCurrentTab={setCurrentTab} />
+ <div className="flex flex-row items-center pl-4">
+ {props.allowMinimized && (
+ <button onClick={() => props.setMinimized(!props.isMinimized)}>
+ <MinimizeTableIcon className="h-4 w-4 hover:scale-110 cursor-pointer text-gray-600" />
+ </button>
+ )}
+ <Tabs tabs={tabs} currentTab={tab} setCurrentTab={setTab} />
+ </div>
<div className="px-4 h-full w-full hide-scrollbar overflow-y-auto">
- {currentTab === 'data' &&
+ {tab === 'data' &&
(currentStep ? (
<DataView currentStep={currentStep} priorStep={priorStep} />
) : (
<NoStepSelected />
))}
- {currentTab === 'code' &&
+ {tab === 'code' &&
(currentStep ? <ActionView currentAction={actionModel} /> : <NoStepSelected />)}
- {currentTab === 'graph' && (
+ {tab === 'graph' && (
<GraphView
stateMachine={props.stateMachine}
currentAction={currentStep}
@@ -66,8 +78,8 @@ export const AppStateView = (props: {
hoverAction={props.hoverAction}
/>
)}
- {currentTab === 'insights' && <InsightsView steps={props.steps} />}
- {currentTab === 'reproduce' &&
+ {tab === 'insights' && <InsightsView steps={props.steps} />}
+ {tab === 'reproduce' &&
(currentStep ? (
<ReproduceView
step={currentStep}
diff --git a/telemetry/ui/src/components/routes/app/StepList.tsx b/telemetry/ui/src/components/routes/app/StepList.tsx
index a89dd16f..17ee62d2 100644
--- a/telemetry/ui/src/components/routes/app/StepList.tsx
+++ b/telemetry/ui/src/components/routes/app/StepList.tsx
@@ -1,49 +1,51 @@
-import { AttributeModel, ChildApplicationModel, PointerModel, Span, Step } from '../../../api';
+import {
+ AttributeModel,
+ ChildApplicationModel,
+ EndStreamModel,
+ FirstItemStreamModel,
+ InitializeStreamModel,
+ PointerModel,
+ Span,
+ Step
+} from '../../../api';
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '../../common/table';
-import { DateTimeDisplay, DurationDisplay, TimeDisplay } from '../../common/dates';
+import { DateTimeDisplay, DurationDisplay } from '../../common/dates';
import {
AppViewHighlightContext,
backgroundColorsForIndex,
backgroundColorsForStatus
} from './AppView';
-import { Status, getActionStatus, getUniqueAttributeID } from '../../../utils';
+import { Status, getActionStatus } from '../../../utils';
import { Chip } from '../../common/chip';
-import { useContext, useRef, useState } from 'react';
+import { useContext, useEffect, useRef, useState } from 'react';
import { TbGrillFork } from 'react-icons/tb';
-import { FiEye } from 'react-icons/fi';
+import {
+ FiArrowDown,
+ FiArrowUp,
+ FiChevronDown,
+ FiChevronUp,
+ FiClock,
+ FiDatabase
+} from 'react-icons/fi';
import {
- ArrowPathIcon,
ChevronLeftIcon,
ChevronRightIcon,
MinusIcon,
+ PlayIcon,
PlusIcon
} from '@heroicons/react/24/outline';
import { PauseIcon } from '@heroicons/react/24/solid';
import { TiFlowChildren } from 'react-icons/ti';
+import { Link, useNavigate } from 'react-router-dom';
+import { AiOutlineFullscreenExit, AiOutlineFullscreen } from 'react-icons/ai';
import { RiCornerDownRightLine } from 'react-icons/ri';
-import { Link } from 'react-router-dom';
-/**
- * Quick display to suggest that the action is still running
- * This is a placeholder for any columns that have null data
- */
-const InProgress = () => {
- return <span></span>;
-};
+import { RxActivityLog } from 'react-icons/rx';
+import { RenderedField } from './DataView';
-/**
- * Display the runtime of a step.
- * TODO -- display the current one on a ticker if it's still running
- */
-const RuntimeDisplay = (props: { start: string; end: string | undefined }) => {
- if (props.end === undefined) {
- return <InProgress />;
- }
- return <DurationDisplay startDate={props.start} endDate={props.end} />;
-};
const StatusChip = (props: { status: Status }) => {
return (
<Chip
@@ -54,6 +56,11 @@ const StatusChip = (props: { status: Status }) => {
);
};
+// The threshold between steps for a "Pause"
+// E.G. that control flow moves out of Burr for a bit
+// Really we should be recording this using the client, but this is fine for now
+const PAUSE_TIME_THRESHOLD_MILLIS = 1_000;
+
/**
* Quick auto-refresh switch.
* TODO -- remove this once we get websockets working.
@@ -61,11 +68,14 @@ const StatusChip = (props: { status: Status }) => {
const AutoRefreshSwitch = (props: {
autoRefresh: boolean;
setAutoRefresh: (b: boolean) => void;
+ textColor?: string;
}) => {
- const AutoRefreshIcon = props.autoRefresh ? PauseIcon : ArrowPathIcon;
+ const AutoRefreshIcon = props.autoRefresh ? PauseIcon : PlayIcon;
+ const textColor = props.textColor || 'text-gray-600';
+
return (
<AutoRefreshIcon
- className="h-4 w-4 text-gray-600 hover:scale-110 cursor-pointer"
+ className={`h-4 w-4 ${textColor} hover:scale-110 cursor-pointer`}
onClick={(e) => {
props.setAutoRefresh(!props.autoRefresh);
e.stopPropagation();
@@ -92,7 +102,7 @@ const CommonTableRow = (props: {
return (
<TableRow
key={props.sequenceID}
- className={`${props.isHovered ? 'opacity-50' : ''} cursor-pointer
+ className={`h-full ${props.isHovered ? 'opacity-80' : ''} cursor-pointer
${
props.shouldBeHighlighted && props.currentSelectedIndex !== undefined
? backgroundColorsForIndex(
@@ -101,28 +111,26 @@ const CommonTableRow = (props: {
)
: ''
}`}
- onMouseOver={() => {
+ onMouseEnter={() => {
props.setCurrentHoverIndex(props.sequenceID);
}}
+ onMouseLeave={() => {
+ props.setCurrentHoverIndex(undefined);
+ }}
onClick={() => {
if (props.currentSelectedIndex === props.sequenceID) {
props.setCurrentSelectedIndex(undefined);
} else {
props.setCurrentSelectedIndex(props.sequenceID);
}
- }}
- >
+ }}>
{props.children}
</TableRow>
);
};
const ActionTableRow = (props: {
- step: Step;
- currentHoverIndex: number | undefined;
- setCurrentHoverIndex: (index?: number) => void;
- currentSelectedIndex: number | undefined;
- setCurrentSelectedIndex: (index?: number) => void;
+ step: StepWithEllapsedTime;
numPriorIndices: number;
isTracesExpanded: boolean;
toggleTraceExpanded: (index: number) => void;
@@ -132,67 +140,95 @@ const ActionTableRow = (props: {
links: ChildApplicationModel[];
displaySpansCol: boolean;
displayLinksCol: boolean;
+ earliestTimeSeen: Date;
+ latestTimeSeen: Date;
+ isExpanded: boolean;
+ allowExpand: boolean;
+ setExpanded: (b: boolean) => void;
+ expandNonSpanAttributes: boolean;
+ setExpandNonSpanAttributes: (b: boolean) => void;
+ streamingEvents: Array<InitializeStreamModel | FirstItemStreamModel | EndStreamModel>;
}) => {
const sequenceID = props.step.step_start_log.sequence_id;
- const isHovered = props.currentHoverIndex === sequenceID;
- const spanCount = props.step.spans.length;
+ const { currentHoverIndex, setCurrentHoverIndex, currentSelectedIndex, setCurrentSelectedIndex } =
+ useContext(AppViewHighlightContext);
+ const isHovered = currentHoverIndex === sequenceID;
+ // const spanCount = props.step.spans.length;
const childCount = props.links.length;
const shouldBeHighlighted =
- props.currentSelectedIndex !== undefined &&
- sequenceID <= props.currentSelectedIndex &&
- sequenceID >= props.currentSelectedIndex - props.numPriorIndices;
- const TraceExpandIcon = props.isTracesExpanded ? MinusIcon : PlusIcon;
+ currentSelectedIndex !== undefined &&
+ sequenceID <= currentSelectedIndex &&
+ sequenceID >= currentSelectedIndex - props.numPriorIndices;
+ // const TraceExpandIcon = props.isTracesExpanded ? MinusIcon : PlusIcon;
const LinkExpandIcon = props.isLinksExpanded ? MinusIcon : PlusIcon;
const attributes = props.step.attributes || [];
+ const allSpansRecorded = props.step.spans.map((span) => span.begin_entry.span_id);
+ const nonSpanAttributes = attributes.filter(
+ (attr) => !allSpansRecorded.includes(attr.span_id || '')
+ );
+ const isStreaming = props.step.streaming_events.length > 0;
return (
<CommonTableRow
sequenceID={sequenceID}
isHovered={isHovered}
shouldBeHighlighted={shouldBeHighlighted}
- currentSelectedIndex={props.currentSelectedIndex}
+ currentSelectedIndex={currentSelectedIndex}
step={props.step}
- setCurrentHoverIndex={props.setCurrentHoverIndex}
- setCurrentSelectedIndex={props.setCurrentSelectedIndex}
- >
+ setCurrentHoverIndex={setCurrentHoverIndex}
+ setCurrentSelectedIndex={setCurrentSelectedIndex}>
<TableCell className="text-gray-500 w-12 max-w-12 min-w-12">{sequenceID}</TableCell>
- <TableCell className="truncate w-40 min-w-40">{props.step.step_start_log.action}</TableCell>
+ <TableCell>
+ <div className="flex flex-row gap-1 items-center">
+ <div className={`${props.allowExpand ? '' : 'invisible'}`}>
+ <ToggleButton
+ isExpanded={props.isExpanded}
+ toggle={() => props.setExpanded(!props.isExpanded)}
+ disabled={false}
+ />
+ </div>
+ <div
+ className={`${props.minimized ? 'w-32' : 'w-72 max-w-72'} flex flex-row justify-start gap-1 items-center`}>
+ <Chip
+ label={isStreaming ? 'stream' : 'action'}
+ chipType={isStreaming ? 'stream' : 'action'}
+ className="w-16 flex flex-row justify-center"
+ />
+ {props.step.step_start_log.action}
+ {props.isExpanded && nonSpanAttributes.length > 0 ? (
+ <ToggleButton
+ isExpanded={nonSpanAttributes.length > 0 ? props.expandNonSpanAttributes : true}
+ toggle={
+ nonSpanAttributes.length > 0
+ ? () => props.setExpandNonSpanAttributes(!props.expandNonSpanAttributes)
+ : () => {}
+ }
+ disabled={false}
+ IconExpanded={MinusIcon}
+ IconCollapsed={FiDatabase}
+ />
+ ) : (
+ <></>
+ )}
+ </div>
+ </div>
+ </TableCell>
{!props.minimized && (
<>
- <TableCell>
- <div className="flex flex-row justify-end">
- <DateTimeDisplay date={props.step.step_start_log.start_time} mode={'short'} />
- </div>
- </TableCell>
- <TableCell>
- <RuntimeDisplay
- start={props.step.step_start_log.start_time}
- end={props.step.step_end_log?.end_time}
+ <TableCell className="h-[1px] px-0">
+ <WaterfallPiece
+ step={props.step}
+ earliestStartTime={props.earliestTimeSeen}
+ latestEndTime={props.latestTimeSeen}
+ endTime={
+ props.step.step_end_log ? new Date(props.step.step_end_log?.end_time) : undefined
+ }
+ startTime={new Date(props.step.step_start_log.start_time)}
+ bgColor={backgroundColorsForStatus(getActionStatus(props.step))}
+ isHighlighted={shouldBeHighlighted}
+ isEvent={false}
+ globalEllapsedTimeMillis={props.step.latestGlobalEllapsedTime}
/>
</TableCell>
- {props.displaySpansCol && (
- <TableCell>
- {spanCount > 0 ? (
- <div className="flex flex-row justify-between items-center">
- <div className="flex gap-1 items-center">
- <TraceExpandIcon
- className="h-4 w-4 text-gray-600 hover:scale-110 cursor-pointer"
- onClick={(e) => {
- props.toggleTraceExpanded(sequenceID);
- e.stopPropagation();
- }}
- />
- <span className="text-gray-600">{spanCount}</span>
- </div>
- {/* {attributes.length > 0 ? <AttributeLink attributes={attributes} /> : <></>} */}
- </div>
- ) : (
- <span></span>
- )}
- </TableCell>
- )}
- <TableCell className="w-5 min-w-5">
- {attributes.length > 0 ? <AttributeLink attributes={attributes} /> : <></>}
- </TableCell>
{props.displayLinksCol && (
<TableCell>
{childCount > 0 ? (
@@ -211,7 +247,7 @@ const ActionTableRow = (props: {
)}
</TableCell>
)}
- <TableCell>
+ <TableCell className="w-16">
<div className="max-w-min">
<StatusChip status={getActionStatus(props.step)} />
</div>
@@ -223,11 +259,7 @@ const ActionTableRow = (props: {
};
const LinkSubTable = (props: {
- step: Step;
- currentHoverIndex: number | undefined;
- setCurrentHoverIndex: (index?: number) => void;
- currentSelectedIndex: number | undefined;
- setCurrentSelectedIndex: (index?: number) => void;
+ step: StepWithEllapsedTime;
numPriorIndices: number;
minimized: boolean;
links: ChildApplicationModel[];
@@ -235,14 +267,17 @@ const LinkSubTable = (props: {
displaySpansCol: boolean;
displayLinksCol: boolean;
}) => {
+ const { currentHoverIndex, setCurrentHoverIndex, currentSelectedIndex, setCurrentSelectedIndex } =
+ useContext(AppViewHighlightContext);
const sequenceID = props.step.step_start_log.sequence_id;
- const isHovered = props.currentHoverIndex === sequenceID;
+ const isHovered = currentHoverIndex === sequenceID;
const shouldBeHighlighted =
- props.currentSelectedIndex !== undefined &&
- sequenceID <= props.currentSelectedIndex &&
- sequenceID >= props.currentSelectedIndex - props.numPriorIndices;
+ currentSelectedIndex !== undefined &&
+ sequenceID <= currentSelectedIndex &&
+ sequenceID >= currentSelectedIndex - props.numPriorIndices;
const normalText = shouldBeHighlighted ? 'text-gray-100' : 'text-gray-600';
const iconColor = shouldBeHighlighted ? 'text-gray-100' : 'text-gray-400';
+ const navigate = useNavigate();
return (
<>
{props.links.map((subApp) => {
@@ -254,29 +289,35 @@ const LinkSubTable = (props: {
sequenceID={sequenceID}
isHovered={isHovered}
shouldBeHighlighted={shouldBeHighlighted}
- currentSelectedIndex={props.currentSelectedIndex}
+ currentSelectedIndex={currentSelectedIndex}
step={props.step}
- setCurrentHoverIndex={props.setCurrentHoverIndex}
- setCurrentSelectedIndex={props.setCurrentSelectedIndex}
- >
+ setCurrentHoverIndex={setCurrentHoverIndex}
+ setCurrentSelectedIndex={setCurrentSelectedIndex}>
<TableCell colSpan={1}>
- <Icon className={`h-5 w-5 ${iconColor} `} />
+ <Icon className={`h-5 w-5 ${iconColor} -ml-1 `} />
</TableCell>
- <TableCell colSpan={1} className={` ${normalText} w-48 min-w-48 max-w-48 truncate`}>
- <Link
- to={`/project/${props.projectId}/${subApp.child.partition_key || 'null'}/${subApp.child.app_id}`}
- >
+ <TableCell
+ colSpan={3}
+ className={` ${normalText} w-48 min-w-48 max-w-48 truncate pl-9`}>
+ <div
+ className="z-50"
+ onClick={(e) => {
+ navigate(
+ `/project/${props.projectId}/${subApp.child.partition_key || 'null'}/${subApp.child.app_id}`
+ );
+ e.stopPropagation();
+ }}>
<span className="hover:underline">{subApp.child.app_id}</span>
- </Link>
+ </div>
</TableCell>
- <TableCell colSpan={1} className={` ${normalText} min-w-10`}>
+ {/* <TableCell colSpan={1} className={` ${normalText} min-w-10`}>
<div className="flex flex-row justify-end">
<DateTimeDisplay date={subApp.event_time} mode={'short'} />
</div>
- </TableCell>
- <TableCell
+ </TableCell> */}
+ {/* <TableCell
colSpan={1 + +!!props.displayLinksCol + +!!props.displaySpansCol}
- ></TableCell>
+ ></TableCell> */}
<TableCell colSpan={1} className="text-gray-500">
<Chip
label={subApp.event_type === 'fork' ? 'forked' : 'spawned'}
@@ -291,176 +332,713 @@ const LinkSubTable = (props: {
);
};
-const scrollToAttribute = (attribute: AttributeModel) => {
- const element = document.getElementById(getUniqueAttributeID(attribute));
- if (element) {
- const scroll = () => {
- element.scrollIntoView({ behavior: 'smooth', block: 'start', inline: 'nearest' });
- };
- scroll();
- const observer = new ResizeObserver(() => {
- scroll();
- });
- observer.observe(element);
- setTimeout(() => observer.disconnect(), 1000); // Adjust timeout as needed
+const StepSubTableRow = (props: {
+ spanID: string | null; // undefined if it is not associated with a span, E.G a free-standing attribute
+ name: string;
+ minimized: boolean;
+ sequenceID: number;
+ isHovered: boolean;
+ shouldBeHighlighted: boolean;
+ step: StepWithEllapsedTime;
+ startTime: Date;
+ endTime: Date | undefined;
+ model: Span | AttributeModel | InitializeStreamModel | FirstItemStreamModel | EndStreamModel;
+ modelType: 'span' | 'attribute' | 'first_item_stream' | 'end_stream';
+ earliestTimeSeen: Date;
+ latestTimeSeen: Date;
+ displayFullAppWaterfall: boolean;
+ displaySpanID: boolean;
+ setDisplayAttributes?: (b: boolean) => void;
+ displayAttributes?: boolean;
+}) => {
+ const {
+ setCurrentHoverIndex,
+ currentSelectedIndex,
+ setCurrentSelectedIndex,
+ setTab,
+ setAttributesHighlighted
+ } = useContext(AppViewHighlightContext);
+ const lightText = 'text-gray-300';
+ const normalText = props.shouldBeHighlighted ? 'text-gray-100' : 'text-gray-600';
+ const attrsForSpan = props.step.attributes.filter((attr) => attr.span_id === props.spanID);
+ const spanIDUniqueToAction = props.spanID?.split(':')[1] || '';
+ const Icon = props.modelType === 'span' ? RiCornerDownRightLine : RxActivityLog;
+ const [displayAttributeValue, setDisplayAttributeValue] = useState(
+ props.modelType === 'attribute'
+ );
+ // This is a quick implementation for prototyping -- we will likely switch this up
+ // This assumes that the span UID is of the form "actionID:spanID.spanID.spanID..."
+ // Which is currently the case
+ let depth = spanIDUniqueToAction.split('.').length;
+ if (props.modelType === 'attribute') {
+ depth += 1;
}
-};
-
-const AttributeLink = (props: { attributes: AttributeModel[] }) => {
- const { setAttributesHighlighted, setTab } = useContext(AppViewHighlightContext);
+ if (props.modelType === 'first_item_stream' || props.modelType === 'end_stream') {
+ depth += 1;
+ }
+ const isEvent = props.modelType !== 'span';
+ // const idToDisplay = props.displaySpanID ? spanIDUniqueToAction : '';
+ const onClick = () => {
+ if (props.modelType !== 'attribute') {
+ return;
+ }
+ setAttributesHighlighted([props.model as AttributeModel]);
+ // TODO -- this is not setting in the URL, we need to figure out why
+ setTab('data');
+ };
return (
- <FiEye
- className="text-xl cursor-pointer hover:scale-125"
- onClick={() => {
- scrollToAttribute(props.attributes[0]);
- setAttributesHighlighted(props.attributes);
- setTab('data');
- }}
- />
+ <CommonTableRow
+ sequenceID={props.sequenceID}
+ isHovered={props.isHovered}
+ shouldBeHighlighted={props.shouldBeHighlighted}
+ currentSelectedIndex={currentSelectedIndex}
+ step={props.step}
+ setCurrentHoverIndex={setCurrentHoverIndex}
+ setCurrentSelectedIndex={setCurrentSelectedIndex}>
+ <TableCell
+ className={` ${lightText} w-10 min-w-10 ${props.displaySpanID ? '' : 'text-opacity-0'}`}>
+ {spanIDUniqueToAction}
+ </TableCell>
+ {!props.minimized ? (
+ <>
+ <TableCell
+ onClick={onClick}
+ className={`${normalText} ${props.minimized ? 'w-32 min-w-32' : 'w-72 max-w-72'} flex flex-col`}>
+ <div className="flex flex-row gap-1 items-center">
+ {[...Array(depth).keys()].map((i) => (
+ <Icon
+ key={i}
+ className={`${i === depth - 1 ? 'opacity-0' : 'opacity-0'} text-lg text-gray-600 w-4 flex-shrink-0`}></Icon>
+ ))}
+ <Chip
+ label={
+ props.modelType === 'end_stream'
+ ? 'end'
+ : props.modelType === 'first_item_stream'
+ ? 'start'
+ : props.modelType
+ }
+ chipType={props.modelType}
+ className="w-16 min-w-16 justify-center"
+ />
+ {props.modelType === 'attribute' ? (
+ <ToggleButton
+ isExpanded={displayAttributeValue}
+ toggle={() => setDisplayAttributeValue(!displayAttributeValue)}
+ disabled={false}
+ IconExpanded={FiChevronUp}
+ IconCollapsed={FiChevronDown}
+ />
+ ) : (
+ <></>
+ )}
+ <span>{props.name}</span>
+ {props.setDisplayAttributes && attrsForSpan.length > 0 ? (
+ <ToggleButton
+ isExpanded={props.displayAttributes || false}
+ toggle={() => props.setDisplayAttributes?.(!props.displayAttributes)}
+ disabled={false}
+ IconExpanded={MinusIcon}
+ IconCollapsed={FiDatabase}
+ />
+ ) : (
+ <></>
+ )}
+ </div>
+ </TableCell>
+ <TableCell className="h-[1px] pl-0">
+ {!displayAttributeValue ? (
+ <WaterfallPiece
+ step={props.step}
+ earliestStartTime={props.earliestTimeSeen}
+ latestEndTime={props.latestTimeSeen}
+ endTime={props.endTime}
+ startTime={props.startTime}
+ bgColor={backgroundColorsForStatus(getActionStatus(props.step))}
+ isHighlighted={props.shouldBeHighlighted}
+ isEvent={isEvent}
+ globalEllapsedTimeMillis={props.step.latestGlobalEllapsedTime}
+ />
+ ) : (
+ <div
+ className="flex justify-start overflow-hidden pl-20"
+ onClick={(e) => {
+ e.stopPropagation();
+ }}>
+ <RenderedField
+ value={(props.model as AttributeModel).value}
+ defaultExpanded={true} // no real need for default expanded
+ />
+ </div>
+ )}
+ </TableCell>
+ <TableCell />
+ </>
+ ) : (
+ <TableCell colSpan={5}></TableCell>
+ )}
+ </CommonTableRow>
);
};
-const TraceSubTable = (props: {
+const StepSubTable = (props: {
spans: Span[];
- step: Step;
- currentHoverIndex: number | undefined;
- setCurrentHoverIndex: (index?: number) => void;
- currentSelectedIndex: number | undefined;
- setCurrentSelectedIndex: (index?: number) => void;
+ attributes: AttributeModel[];
+ streamingEvents: Array<InitializeStreamModel | FirstItemStreamModel | EndStreamModel>;
+ step: StepWithEllapsedTime;
numPriorIndices: number;
minimized: boolean;
displaySpansCol: boolean;
displayLinksCol: boolean;
+ earliestTimeSeen: Date;
+ latestTimeSeen: Date;
+ expandNonSpanAttributes: boolean;
+ topToBottomChronological: boolean;
}) => {
+ const { currentHoverIndex, currentSelectedIndex } = useContext(AppViewHighlightContext);
+ const attributesBySpanID = props.attributes.reduce((acc, attr) => {
+ const existing = acc.get(attr.span_id) || [];
+ existing.push(attr);
+ acc.set(attr.span_id, existing);
+ return acc;
+ }, new Map<string | null, AttributeModel[]>());
+ // TODO -- display
+ // const streamingEventsBySpanID = props.streamingEvents.reduce((acc, event) => {
+ // const existing = acc.get(event.span_id) || [];
+ // existing.push(event);
+ // acc.set(event.span_id, existing);
+ // return acc;
+ // }, new Map<string | null, Array<InitializeStreamModel | FirstItemStreamModel | EndStreamModel>>());
+ const sequenceID = props.step.step_start_log.sequence_id;
+ const isHovered = currentHoverIndex === sequenceID;
+ const shouldBeHighlighted =
+ currentSelectedIndex !== undefined &&
+ sequenceID <= currentSelectedIndex &&
+ sequenceID >= currentSelectedIndex - props.numPriorIndices;
+ const displayFullAppWaterfall = true; // TODO -- configure if we zoom on a step
+ const allSpanIds = props.spans.map((span) => span.begin_entry.span_id);
+ const [spanIdsWithAttributesDisplayed, setSpanIdsWithAttributesDisplayed] = useState<string[]>(
+ []
+ );
+ // N^2
+ // This is because we create span references without logging them -- using the trace at the root level
+ // E.G. 15:0 -- this is just the root. No need to display it, we'll just show it on the action
+ const attributesNoSpanInfo = props.attributes.filter(
+ (attr) => !allSpanIds.includes(attr.span_id || '')
+ );
+ const nonSpanAttributes = attributesBySpanID.get(null) || [];
+ const stepStartTime = new Date(props.step.step_start_log.start_time);
+ nonSpanAttributes.sort((a, b) => {
+ return (
+ (new Date(a.time_logged || stepStartTime) > new Date(b.time_logged || stepStartTime)
+ ? 1
+ : -1) * (props.topToBottomChronological ? -1 : 1)
+ );
+ });
+ const spans = [...props.spans];
+ spans.sort((a, b) => {
+ if (a.begin_entry.span_id > b.begin_entry.span_id) {
+ return 1;
+ }
+ return -1;
+ });
+
+ const seenNonSpanAttributes = new Set<string | null>();
+
+ const firstStream = props.streamingEvents.find((event) => event.type === 'first_item_stream') as
+ | FirstItemStreamModel
+ | undefined;
+
+ const streamingEventsToRender = props.streamingEvents.filter(
+ (item) => item.type === 'first_item_stream' || item.type === 'end_stream'
+ );
+ streamingEventsToRender.sort((a, b) => {
+ return (
+ (new Date((a as FirstItemStreamModel).first_item_time) >
+ new Date((b as FirstItemStreamModel).first_item_time)
+ ? 1
+ : -1) * (props.topToBottomChronological ? -1 : 1)
+ );
+ });
+
return (
<>
- {props.spans.map((span) => {
- // This is a quick implementation for prototyping -- we will likely switch this up
- // This assumes that the span UID is of the form "actionID:spanID.spanID.spanID..."
- // Which is currently the case
- const spanIDUniqueToAction = span.begin_entry.span_id.split(':')[1];
- const depth = spanIDUniqueToAction.split('.').length;
- const sequenceID = props.step.step_start_log.sequence_id;
- const isHovered = props.currentHoverIndex === sequenceID;
- const shouldBeHighlighted =
- props.currentSelectedIndex !== undefined &&
- sequenceID <= props.currentSelectedIndex &&
- sequenceID >= props.currentSelectedIndex - props.numPriorIndices;
- const lightText = 'text-gray-300';
- const normalText = shouldBeHighlighted ? 'text-gray-100' : 'text-gray-400';
- const attrsForSpan = props.step.attributes.filter(
- (attr) => attr.span_id === span.begin_entry.span_id
- );
- return (
- <CommonTableRow
- key={`${span.begin_entry.span_id}-trace-table-row`}
+ {streamingEventsToRender.map((event, i) => {
+ if (event.type === 'first_item_stream') {
+ const streamModel = event as FirstItemStreamModel;
+ const ttfs =
+ new Date(streamModel.first_item_time).getTime() -
+ new Date(props.step.step_start_log.start_time).getTime();
+ return (
+ <StepSubTableRow
+ key={`streaming-${i}`}
+ spanID={null}
+ name={`delay: ${ttfs}ms`}
+ minimized={props.minimized}
+ sequenceID={sequenceID}
+ isHovered={isHovered}
+ shouldBeHighlighted={shouldBeHighlighted}
+ step={props.step}
+ startTime={new Date(streamModel.first_item_time)}
+ endTime={new Date(streamModel.first_item_time)}
+ model={streamModel}
+ modelType={event.type}
+ earliestTimeSeen={props.earliestTimeSeen}
+ latestTimeSeen={props.latestTimeSeen}
+ displayFullAppWaterfall={displayFullAppWaterfall}
+ displaySpanID={true}
+ />
+ );
+ } else {
+ const streamModel = event as EndStreamModel;
+ const ellapsedStreamTime = firstStream
+ ? new Date(streamModel.end_time).getTime() -
+ new Date(firstStream?.first_item_time).getTime()
+ : undefined;
+ const numStreamed = streamModel.items_streamed;
+ // const name = ellapsedStreamTime ? `last token (throughput=${ellapsedStreamTime/streamModel.items_streamed} ms/token)` : 'last token';
+ // const name = `throughput: ${(ellapsedStreamTime || 0) / numStreamed} ms/token (${numStreamed} tokens/${ellapsedStreamTime}ms)`;
+ const name = `throughput: ${((ellapsedStreamTime || 0) / numStreamed).toFixed(1)} ms/token (${numStreamed}/${ellapsedStreamTime}ms)`;
+ return (
+ <StepSubTableRow
+ key={`streaming-${i}`}
+ spanID={null}
+ name={name}
+ minimized={props.minimized}
+ sequenceID={sequenceID}
+ isHovered={isHovered}
+ shouldBeHighlighted={shouldBeHighlighted}
+ step={props.step}
+ startTime={new Date(streamModel.end_time)}
+ endTime={new Date(streamModel.end_time)}
+ model={streamModel}
+ modelType={'end_stream'}
+ earliestTimeSeen={props.earliestTimeSeen}
+ latestTimeSeen={props.latestTimeSeen}
+ displayFullAppWaterfall={displayFullAppWaterfall}
+ displaySpanID={true}
+ />
+ );
+ }
+ })}
+ {props.expandNonSpanAttributes ? (
+ attributesNoSpanInfo.map((attr, i) => {
+ const displaySpanID = !seenNonSpanAttributes.has(attr.span_id) && attr.span_id !== null;
+ seenNonSpanAttributes.add(attr.span_id);
+ return (
+ <StepSubTableRow
+ key={`${attr.key}-${i}`}
+ spanID={attr.span_id}
+ name={attr.key}
+ minimized={props.minimized}
+ sequenceID={sequenceID}
+ isHovered={isHovered}
+ shouldBeHighlighted={shouldBeHighlighted}
+ step={props.step}
+ startTime={new Date(attr.time_logged || stepStartTime)}
+ endTime={new Date(attr.time_logged || stepStartTime)}
+ model={attr}
+ modelType="attribute"
+ earliestTimeSeen={props.earliestTimeSeen}
+ latestTimeSeen={props.latestTimeSeen}
+ displayFullAppWaterfall={displayFullAppWaterfall}
+ displaySpanID={displaySpanID}
+ />
+ );
+ })
+ ) : (
+ <></>
+ )}
+ {spans.flatMap((span, i) => {
+ const spanID = span.begin_entry.span_id;
+ // if (!openSpanIDs.includes(spanID)) {
+ // return [];
+ // }
+ // TODO -- add null
+ const hasAttributes = attributesBySpanID.has(spanID);
+ const attributesToDisplay =
+ hasAttributes && spanIdsWithAttributesDisplayed.includes(spanID)
+ ? attributesBySpanID.get(spanID) || []
+ : [];
+
+ return [
+ <StepSubTableRow
+ key={i}
+ spanID={spanID}
+ name={span.begin_entry.span_name}
+ minimized={props.minimized}
sequenceID={sequenceID}
isHovered={isHovered}
shouldBeHighlighted={shouldBeHighlighted}
- currentSelectedIndex={props.currentSelectedIndex}
step={props.step}
- setCurrentHoverIndex={props.setCurrentHoverIndex}
- setCurrentSelectedIndex={props.setCurrentSelectedIndex}
- >
- <TableCell className={` ${lightText} w-10 min-w-10`}>{spanIDUniqueToAction}</TableCell>
- {!props.minimized && (
- <>
- <TableCell className={`${normalText} w-12 max-w-12 min-w-12`}>
- <div className="flex flex-row gap-1 items-center min-w-48">
- {[...Array(depth).keys()].map((i) => (
- <RiCornerDownRightLine
- key={i}
- className={`${i === depth - 1 ? 'opacity-100' : 'opacity-0'} text-lg`}
- ></RiCornerDownRightLine>
- ))}
- {span.begin_entry.span_name}
- </div>
- </TableCell>
- <TableCell>
- <div className="flex flex-row justify-end">
- <TimeDisplay date={props.step.step_start_log.start_time} />
- </div>
- </TableCell>
- <TableCell colSpan={1}>
- <RuntimeDisplay
- start={span.begin_entry.start_time}
- end={span.end_entry?.end_time}
- />
- </TableCell>
- <TableCell colSpan={1} className="h-full">
- <div className="flex flex-row justify-between">
- <WaterfallPiece
- step={props.step}
- span={span}
- bgColor={backgroundColorsForStatus(getActionStatus(props.step))}
- isHighlighted={shouldBeHighlighted}
- />
- </div>
- </TableCell>
- <TableCell className="w-5 min-w-5">
- {attrsForSpan.length > 0 ? <AttributeLink attributes={attrsForSpan} /> : <></>}
- </TableCell>
- <TableCell />
- </>
- )}
- </CommonTableRow>
- );
+ startTime={new Date(span.begin_entry.start_time)}
+ endTime={span.end_entry?.end_time ? new Date(span.end_entry.end_time) : undefined}
+ model={span}
+ modelType="span"
+ earliestTimeSeen={props.earliestTimeSeen}
+ latestTimeSeen={props.latestTimeSeen}
+ displayFullAppWaterfall={displayFullAppWaterfall}
+ displaySpanID={true}
+ setDisplayAttributes={(b) => {
+ if (b) {
+ setSpanIdsWithAttributesDisplayed([...spanIdsWithAttributesDisplayed, spanID]);
+ } else {
+ setSpanIdsWithAttributesDisplayed(
+ spanIdsWithAttributesDisplayed.filter((id) => id !== spanID)
+ );
+ }
+ }}
+ displayAttributes={spanIdsWithAttributesDisplayed.includes(spanID)}
+ />,
+ ...attributesToDisplay.map((attr, i) => {
+ return (
+ <StepSubTableRow
+ key={`${attr.key}-${i}`}
+ spanID={attr.span_id}
+ name={attr.key}
+ minimized={props.minimized}
+ sequenceID={sequenceID}
+ isHovered={isHovered}
+ shouldBeHighlighted={shouldBeHighlighted}
+ step={props.step}
+ startTime={new Date(attr.time_logged || new Date(span.begin_entry.start_time))}
+ endTime={new Date(attr.time_logged || new Date(span.begin_entry.start_time))}
+ model={attr}
+ modelType="attribute"
+ earliestTimeSeen={props.earliestTimeSeen}
+ latestTimeSeen={props.latestTimeSeen}
+ displayFullAppWaterfall={displayFullAppWaterfall}
+ displaySpanID={false}
+ />
+ );
+ })
+ ];
})}
</>
);
};
const WaterfallPiece: React.FC<{
- step: Step;
- span: Span;
+ step: StepWithEllapsedTime;
+ startTime: Date;
+ endTime: Date | undefined;
+ earliestStartTime: Date;
+ latestEndTime: Date | undefined;
+ globalEllapsedTimeMillis: number; // Total time of active trace
bgColor: string;
isHighlighted: boolean;
+ isEvent: boolean;
+ // Whether to display just ellapsed (clock) time
+ displayAbsoluteOrEllapsedTime?: 'absolute' | 'ellapsed';
}> = (props) => {
+ const useAbsoluteTime = (props.displayAbsoluteOrEllapsedTime || 'ellapsed') === 'absolute';
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 stepStartTimeAbsolute = new Date(props.step.step_start_log.start_time).getTime();
+ // Subtract the duration of the step to get the start time
+ const stepStartTimeRelative = props.step.cumulativeTimeMillis - props.step.stepDurationMillis;
+ const eventStartTimeSinceStepBegan = props.startTime.getTime() - stepStartTimeAbsolute;
+ const eventEndTimeSinceStepBegan =
+ (props.endTime || new Date()).getTime() - stepStartTimeAbsolute;
+
+ const earliestStartTimeMilliseconds = useAbsoluteTime ? props.earliestStartTime.getTime() : 0;
+
+ const latestEndTimeMilliseconds = useAbsoluteTime
+ ? (props.latestEndTime || new Date()).getTime()
+ : props.globalEllapsedTimeMillis;
+
+ const stepBeganReferencePoint = useAbsoluteTime ? stepStartTimeAbsolute : stepStartTimeRelative;
+
+ const startTimeMilliseconds = stepBeganReferencePoint + eventStartTimeSinceStepBegan;
+ const endTimeMilliseconds = stepBeganReferencePoint + eventEndTimeSinceStepBegan;
+ const earliestToLatestMilliseconds = latestEndTimeMilliseconds - earliestStartTimeMilliseconds;
- const spanEndMilliseconds = new Date(props.span.end_entry?.end_time || new Date()).getTime();
const bgColor = props.isHighlighted ? 'bg-white' : props.bgColor;
+ const [isHovered, setIsHovered] = useState(false);
return (
- <div ref={containerRef} className="w-full h-4 px-3">
- <div
- className={`${bgColor} opacity-50`}
- style={{
- width: `${Math.min(((spanEndMilliseconds - spanStartMilliseconds) / totalTimeMilliseconds) * 100, 100)}%`,
- position: 'relative',
- height: '100%',
- left: `${((spanStartMilliseconds - new Date(props.step.step_start_log.start_time).getTime()) / totalTimeMilliseconds) * 100}%`
- }}
- ></div>
+ <div ref={containerRef} className="w-full px-2 h-full relative">
+ {(() => {
+ const leftPositionPercentage =
+ ((startTimeMilliseconds - earliestStartTimeMilliseconds) / earliestToLatestMilliseconds) *
+ 100;
+ const widthPercentage = Math.max(
+ Math.min(
+ ((endTimeMilliseconds - startTimeMilliseconds) / earliestToLatestMilliseconds) * 100,
+ 100
+ ),
+ 0.1
+ );
+ const isCloseToEnd = leftPositionPercentage + widthPercentage > 80; // Threshold for "close to the end"
+ // TODO -- unhack these, we're converting back and forth cause we already have interfaces for strings and
+ // don't want to change
+ const hoverItem = props.isEvent ? (
+ <></>
+ ) : (
+ <div className="flex flex-row gap-1 items-center">
+ <DurationDisplay
+ startDate={new Date(startTimeMilliseconds).toISOString()}
+ endDate={new Date(endTimeMilliseconds).toISOString()}
+ />
+ <DateTimeDisplay
+ date={props.startTime.toISOString()}
+ mode={'short'}
+ displayMillis={true}
+ />
+ </div>
+ );
+
+ return (
+ <>
+ {!props.isEvent ? (
+ <div
+ className={`${bgColor} opacity-50 h-full px-0 rounded-none`}
+ onMouseEnter={() => setIsHovered(true)}
+ onMouseLeave={() => setIsHovered(false)}
+ style={{
+ width: `${widthPercentage}%`,
+ position: 'absolute',
+ height: '100%',
+ left: `${leftPositionPercentage}%`
+ }}></div>
+ ) : (
+ <div
+ className={`h-5 w-5 ${bgColor} opacity-50 absolute`}
+ style={{
+ left: `${leftPositionPercentage}%`,
+ top: '50%',
+ transform: 'translate(-50%, -50%) rotate(45deg)'
+ }}
+ />
+ )}
+
+ {/* Hoverable zone with buffer to avoid flicker */}
+ <div
+ className="absolute h-full"
+ onMouseEnter={() => setIsHovered(true)}
+ onMouseLeave={() => setIsHovered(false)}
+ style={{
+ left: `calc(${leftPositionPercentage}% - 20px)`,
+ width: `calc(${widthPercentage}% + 40px)` // 20px buffer on each side
+ }}></div>
+
+ {
+ <div
+ className={`px-4 transition-opacity duration-500 ${
+ isHovered ? 'opacity-100' : 'opacity-0 pointer-events-none'
+ }`}
+ style={{
+ position: 'absolute',
+ top: 0,
+ right: isCloseToEnd ? `calc(100% - ${leftPositionPercentage}%)` : `auto`,
+ left: isCloseToEnd
+ ? `auto`
+ : `calc(${leftPositionPercentage}% + ${widthPercentage}%)`
+ }}>
+ {hoverItem}
+ </div>
+ }
+ </>
+ );
+ })()}
</div>
);
};
-const ExpandAllButton = (props: {
+const ToggleButton = (props: {
isExpanded: boolean;
- toggleExpandAll: () => void;
+ toggle: () => void;
disabled: boolean;
+ IconExpanded?: React.FC;
+ IconCollapsed?: React.FC;
}) => {
- const ExpandAllIcon = props.isExpanded ? MinusIcon : PlusIcon;
+ const IconExpanded = props.IconExpanded || MinusIcon;
+ const IconCollapsed = props.IconCollapsed || PlusIcon;
+ const ToggleIcon = props.isExpanded ? IconExpanded : IconCollapsed;
const textColor = props.disabled ? 'text-gray-300' : 'text-gray-600';
const hoverScale = props.disabled ? '' : 'hover:scale-110 cursor-pointer';
return (
- <ExpandAllIcon
- className={`h-4 w-4 cursor-pointer ${textColor} ${hoverScale}`}
+ <ToggleIcon
+ className={`h-4 w-4 min-w-4 cursor-pointer ${textColor} ${hoverScale}`}
onClick={(e) => {
if (!props.disabled) {
- props.toggleExpandAll();
+ props.toggle();
}
e.stopPropagation();
+ e.preventDefault();
}}
/>
);
};
+type StepWithEllapsedTime = Step & {
+ cumulativeTimeMillis: number;
+ stepDurationMillis: number;
+ pauseAfterLastStepMillis: number;
+ latestGlobalEllapsedTime: number;
+};
+
+/**
+ * Quick function to collapse to ellapsed time
+ * Note this may break if steps are not in a perfectly linear order.
+ * This is not the case now, but as we add parallelism it very well may be.
+ * @param steps
+ * @returns
+ */
+const collapseTimestampsToEllapsedTime = (steps: Step[]): StepWithEllapsedTime[] => {
+ const sortedSteps = steps.sort((a, b) => {
+ return new Date(a.step_start_log.start_time) > new Date(b.step_start_log.start_time) ? 1 : -1;
+ });
+ if (sortedSteps.length === 0) {
+ return [];
+ }
+ let lastTime = new Date(sortedSteps[0].step_start_log.start_time);
+ let cumulativeTimeMillis = 0;
+ return sortedSteps
+ .map((step) => {
+ const stepStartTime = new Date(step.step_start_log.start_time);
+ const stepEndTime = new Date(step.step_end_log?.end_time || new Date());
+ const pauseAfterLastStepMillis = stepStartTime.getTime() - lastTime.getTime();
+ cumulativeTimeMillis += stepEndTime.getTime() - stepStartTime.getTime();
+ lastTime = stepEndTime;
+ return {
+ ...step,
+ cumulativeTimeMillis,
+ pauseAfterLastStepMillis: pauseAfterLastStepMillis,
+ stepDurationMillis: stepEndTime.getTime() - stepStartTime.getTime(),
+ latestGlobalEllapsedTime: 0
+ };
+ })
+ .map((step) => {
+ return {
+ ...step,
+ latestGlobalEllapsedTime: cumulativeTimeMillis
+ };
+ });
+};
+
+const PauseRow = (props: { pauseMillis: number }) => {
+ return (
+ <TableRow className=" bg-gray-50 text-sm text-gray-300">
+ <TableCell colSpan={1}>
+ <FiClock className="w-5 h-t" />
+ {/* <span className="text-gray-500">pause</span> */}
+ </TableCell>
+ <TableCell colSpan={1}>
+ <DurationDisplay startDate={0} endDate={props.pauseMillis} />
+ </TableCell>
+ <TableCell colSpan={5}></TableCell>
+ </TableRow>
+ );
+};
+
+const ActionSubTable = (props: {
+ step: StepWithEllapsedTime;
+ numPriorIndices: number;
+ isTraceExpanded: boolean;
+ toggleTraceExpandedActions: (index: number) => void;
+ isLinksExpanded: boolean;
+ toggleLinksExpanded: (index: number) => void;
+ minimized: boolean;
+ links: ChildApplicationModel[];
+ displaySpansCol: boolean;
+ displayLinksCol: boolean;
+ earliestTimeSeen: Date;
+ latestTimeSeen: Date;
+ setTraceExpanded: (b: boolean) => void;
+ projectId: string;
+ pauseLocation?: 'top' | 'bottom'; // If it's top then we put one above, if it's bottom then below, otherwise no pause
+ pauseTime?: number;
+ topToBottomChronological: boolean;
+}) => {
+ const {
+ step,
+ latestTimeSeen,
+ isTraceExpanded,
+ toggleTraceExpandedActions,
+ isLinksExpanded,
+ toggleLinksExpanded,
+ links,
+ displaySpansCol,
+ displayLinksCol,
+ earliestTimeSeen,
+ setTraceExpanded,
+ pauseTime,
+ topToBottomChronological
+ } = props;
+ const [expandNonSpanAttributes, setExpandNonSpanAttributes] = useState<boolean>(false); // attributes that are associated with the action, not the span...
+ // TODO -- lower a lot of this state into this component
+ // This was pulled out quickly and we need to put anyting that's not read above into this
+ return (
+ <>
+ {props.pauseLocation === 'top' && pauseTime !== undefined && (
+ <PauseRow pauseMillis={pauseTime} />
+ )}
+ <ActionTableRow
+ key={`${step.step_start_log.sequence_id}-action-table-row`}
+ step={step}
+ numPriorIndices={props.numPriorIndices}
+ isTracesExpanded={isTraceExpanded}
+ isLinksExpanded={isLinksExpanded}
+ toggleTraceExpanded={toggleTraceExpandedActions}
+ toggleLinksExpanded={toggleLinksExpanded}
+ minimized={props.minimized}
+ links={links}
+ displaySpansCol={displaySpansCol}
+ displayLinksCol={displayLinksCol}
+ earliestTimeSeen={earliestTimeSeen}
+ isExpanded={isTraceExpanded}
+ setExpanded={setTraceExpanded}
+ allowExpand={
+ step.spans.length > 0 ||
+ // step.streaming_events.length > 0 ||
+ step.attributes.length > 0
+ }
+ latestTimeSeen={latestTimeSeen}
+ expandNonSpanAttributes={expandNonSpanAttributes}
+ setExpandNonSpanAttributes={setExpandNonSpanAttributes}
+ streamingEvents={step.streaming_events}
+ />
+ {isTraceExpanded && (
+ <StepSubTable
+ spans={step.spans}
+ attributes={step.attributes}
+ step={step}
+ numPriorIndices={props.numPriorIndices}
+ minimized={props.minimized}
+ displaySpansCol={displaySpansCol}
+ displayLinksCol={displayLinksCol}
+ earliestTimeSeen={earliestTimeSeen}
+ latestTimeSeen={latestTimeSeen}
+ expandNonSpanAttributes={expandNonSpanAttributes}
+ streamingEvents={step.streaming_events}
+ topToBottomChronological={topToBottomChronological}
+ // forceCollapsed={!intentionExpandAll}
+ />
+ )}
+ {isLinksExpanded && (
+ <LinkSubTable
+ step={step}
+ links={links}
+ numPriorIndices={props.numPriorIndices}
+ minimized={props.minimized}
+ projectId={props.projectId}
+ displaySpansCol={displaySpansCol}
+ displayLinksCol={displayLinksCol}
+ />
+ )}
+ {props.pauseLocation === 'bottom' && pauseTime !== undefined && (
+ <PauseRow pauseMillis={pauseTime} />
+ )}
+ </>
+ );
+};
+
+// const TableWithRef = forwardRef<HTMLDivElement, React.ComponentProps<typeof Table>>(
+// (props, ref) => {
+// return <Table {...props} ref={ref as React.Ref<HTMLDivElement>} />;
+// }
+// );
+
/**
* Table with a list of steps.
* The indexing is off here -- as it updates the index stays the same.
@@ -473,22 +1051,26 @@ const ExpandAllButton = (props: {
*/
export const StepList = (props: {
steps: Step[];
- currentHoverIndex?: number;
- setCurrentHoverIndex: (index?: number) => void;
- currentSelectedIndex?: number;
- setCurrentSelectedIndex: (index?: number) => void;
numPriorIndices: number;
autoRefresh: boolean;
setAutoRefresh: (b: boolean) => void;
minimized: boolean;
setMinimized: (b: boolean) => void;
+ allowMinimized: boolean;
projectId: string;
parentPointer: PointerModel | undefined;
spawningParentPointer: PointerModel | undefined;
links: ChildApplicationModel[];
+ fullScreen: boolean;
+ allowFullScreen: boolean;
+ setFullScreen: (b: boolean) => void;
+ topToBottomChronological: boolean;
+ setTopToBottomChronological: (b: boolean) => void;
+ toggleInspectViewOpen: () => void;
}) => {
// This is a quick way of expanding the actions all at once
const [traceExpandedActions, setTraceExpandedActions] = useState<number[]>([]);
+
const toggleTraceExpandedActions = (index: number) => {
if (traceExpandedActions.includes(index)) {
setTraceExpandedActions(traceExpandedActions.filter((i) => i !== index));
@@ -499,11 +1081,42 @@ export const StepList = (props: {
const [intentionExpandAll, setIntentionExpandAll] = useState(false);
const [linksExpandedActions, setLinksExpandedActions] = useState<number[]>([]);
+ const stepsWithEllapsedTime = collapseTimestampsToEllapsedTime(props.steps);
+ const tableRef = useRef<HTMLTableElement>(null);
+ const tableScrollRef = useRef<HTMLDivElement>(null);
+
+ const uniqueStepView = props.steps.flatMap((step) => {
+ return [
+ step.step_start_log.sequence_id,
+ step.step_end_log?.sequence_id || '-',
+ ...step.attributes.map((attr) => attr.key || '-'),
+ ...step.spans.map((span) => span.begin_entry.span_id || '-')
+ ];
+ });
+
+ uniqueStepView.sort();
+ useEffect(() => {
+ if (props.autoRefresh && tableScrollRef.current && props.topToBottomChronological) {
+ //TODO -- scroll to the end if we we're on auto-refresh
+ tableScrollRef.current.scrollIntoView({ behavior: 'smooth', block: 'end' });
+ }
+ }, [uniqueStepView.map((i) => i.toString()).join(''), props.autoRefresh]);
+
+ stepsWithEllapsedTime
+ .sort((a, b) => {
+ const naturalOrder = b.step_start_log.sequence_id - a.step_start_log.sequence_id;
+ if (naturalOrder !== 0) {
+ return props.topToBottomChronological ? naturalOrder : -naturalOrder;
+ }
+ return 0;
+ })
+ .reverse();
+
const toggleExpandAllTraces = () => {
if (intentionExpandAll) {
setTraceExpandedActions([]);
} else {
- const allIndices = props.steps.map((step) => step.step_start_log.sequence_id);
+ const allIndices = stepsWithEllapsedTime.map((step) => step.step_start_log.sequence_id);
setTraceExpandedActions(allIndices);
}
setIntentionExpandAll(!intentionExpandAll);
@@ -518,8 +1131,25 @@ export const StepList = (props: {
setLinksExpandedActions([...linksExpandedActions, index]);
}
};
+ const earliestTimeSeen =
+ stepsWithEllapsedTime.length > 0
+ ? new Date(
+ Math.min(
+ ...stepsWithEllapsedTime.map((step) =>
+ new Date(step.step_start_log.start_time).getTime()
+ )
+ )
+ )
+ : new Date();
+
+ const endTimes = stepsWithEllapsedTime.map((step) => step.step_end_log?.end_time || new Date());
+ const latestTimeSeen =
+ endTimes.length > 0
+ ? new Date(Math.max(...endTimes.map((date) => new Date(date).getTime())))
+ : new Date();
const MinimizeTableIcon = props.minimized ? ChevronRightIcon : ChevronLeftIcon;
- const displaySpansCol = props.steps.some((step) => step.spans.length > 0);
+ const FullScreenIcon = props.fullScreen ? AiOutlineFullscreenExit : AiOutlineFullscreen;
+ const displaySpansCol = stepsWithEllapsedTime.some((step) => step.spans.length > 0);
const displayLinksCol = props.links.length > 0;
const linksBySequenceID = props.links.reduce((acc, child) => {
const existing = acc.get(child.sequence_id || -1) || [];
@@ -527,160 +1157,195 @@ export const StepList = (props: {
acc.set(child.sequence_id || -1, existing);
return acc;
}, new Map<number, ChildApplicationModel[]>());
+
+ const [tableHeight, setTableHeight] = useState('auto');
+
+ const updateTableHeight = () => {
+ if (tableRef.current) {
+ const parentElement = tableRef.current.parentElement;
+ if (parentElement) {
+ const parentHeight = parentElement.clientHeight;
+ const tableTop =
+ tableRef.current.getBoundingClientRect().top - parentElement.getBoundingClientRect().top;
+ const availableHeight = parentHeight - tableTop;
+ setTableHeight(`${availableHeight}px`);
+ }
+ }
+ };
+
+ useEffect(() => {
+ updateTableHeight(); // Initial calculation on mount
+ window.addEventListener('resize', updateTableHeight); // Recalculate on window resize
+
+ // Set up a ResizeObserver to listen to changes in the parent element's size
+ const observer = new ResizeObserver(updateTableHeight);
+ if (tableRef.current?.parentElement) {
+ observer.observe(tableRef.current.parentElement);
+ }
+
+ return () => {
+ window.removeEventListener('resize', updateTableHeight);
+ observer.disconnect(); // Cleanup observer on unmount
+ };
+ }, []);
+
+ const parentRows = (
+ <>
+ {props.parentPointer ? (
+ <ParentLink parentPointer={props.parentPointer} projectId={props.projectId} type="fork" />
+ ) : (
+ <></>
+ )}
+ {props.spawningParentPointer ? (
+ <ParentLink
+ parentPointer={props.spawningParentPointer}
+ projectId={props.projectId}
+ type="spawn"
+ displayLinksCol={displayLinksCol}
+ displaySpansCol={displaySpansCol}
+ />
+ ) : (
+ <></>
+ )}
+ </>
+ );
+
return (
- <Table dense={2}>
- <TableHead className=" bg-white">
- <TableRow className="">
- <TableHeader className="">
- <div className="py-1 flex flex-row gap-2">
- <MinimizeTableIcon
- className="h-4 w-4 text-gray-600 hover:scale-110 cursor-pointer"
- onClick={(e) => {
- props.setMinimized(!props.minimized);
- e.stopPropagation();
- }}
- />
- {props.minimized ? (
- <ExpandAllButton
+ <div ref={tableRef} style={{ height: tableHeight }}>
+ <Table dense={2} style={{ maxHeight: tableHeight }} className="hide-scrollbar">
+ <TableHead className=" bg-white sticky top-0 z-50">
+ <TableRow className="">
+ <TableHeader className="" colSpan={1}>
+ <div className="py-1 flex flex-row gap-2 items-center">
+ <MinimizeTableIcon
+ className={`h-4 w-4 ${props.fullScreen ? 'text-gray-300' : 'hover:scale-110 cursor-pointer text-gray-600'} ${props.allowMinimized ? '' : 'invisible'}`}
+ onClick={(e) => {
+ if (props.fullScreen) {
+ return;
+ }
+ props.setMinimized(!props.minimized);
+ e.stopPropagation();
+ }}
+ />
+ <FullScreenIcon
+ className={`h-4 w-4 text-white hover:scale-125 cursor-pointer bg-dwdarkblue/70 rounded-sm ${!props.allowFullScreen ? 'invisible' : ''}`}
+ onClick={(e) => {
+ props.setFullScreen(!props.fullScreen);
+ props.setMinimized(false);
+ e.stopPropagation();
+ }}
+ />
+ {props.minimized ? (
+ <ToggleButton
+ disabled={!displaySpansCol}
+ isExpanded={intentionExpandAll}
+ toggle={toggleExpandAllTraces}
+ />
+ ) : (
+ <></>
+ )}
+ {props.minimized ? (
+ <AutoRefreshSwitch
+ setAutoRefresh={props.setAutoRefresh}
+ autoRefresh={props.autoRefresh}
+ />
+ ) : (
+ <></>
+ )}
+ </div>
+ </TableHeader>
+ <TableHeader className="w-72">
+ <div className="flex gap-1 items-center justify-start">
+ <ToggleButton
disabled={!displaySpansCol}
isExpanded={intentionExpandAll}
- toggleExpandAll={toggleExpandAllTraces}
+ toggle={toggleExpandAllTraces}
/>
- ) : (
- <></>
- )}
- {props.minimized ? (
- <AutoRefreshSwitch
- setAutoRefresh={props.setAutoRefresh}
- autoRefresh={props.autoRefresh}
+ Action
+ <ToggleButton
+ disabled={false}
+ isExpanded={props.topToBottomChronological}
+ toggle={() => props.setTopToBottomChronological(!props.topToBottomChronological)}
+ IconCollapsed={FiArrowUp}
+ IconExpanded={FiArrowDown}
/>
- ) : (
- <></>
- )}
- </div>
- </TableHeader>
- <TableHeader>Action</TableHeader>
-
- {!props.minimized && (
- <>
- <TableHeader>
- <span className="flex justify-end">Ran</span>
- </TableHeader>
- <TableHeader>Duration</TableHeader>
- {displaySpansCol && (
- <TableHeader>
- <div className="flex flex-row items-center gap-2">
- <ExpandAllButton
- disabled={!displaySpansCol}
- isExpanded={intentionExpandAll}
- toggleExpandAll={toggleExpandAllTraces}
- />
- Spans
- </div>
- </TableHeader>
- )}
- <TableHeader className="w-5"></TableHeader>
-
- {displayLinksCol && (
- <TableHeader>
- <div className="flex flex-row items-center gap-2">
- <ExpandAllButton
- disabled={!displaySpansCol}
- isExpanded={intentionExpandAll}
- toggleExpandAll={toggleExpandAllTraces}
+ </div>
+ </TableHeader>
+
+ {!props.minimized && (
+ <>
+ {displayLinksCol && (
+ <TableHeader>
+ <div className="flex flex-row items-center gap-2">
+ <ToggleButton
+ disabled={!displaySpansCol}
+ isExpanded={intentionExpandAll}
+ toggle={toggleExpandAllTraces}
+ />
+ Links
+ </div>
+ </TableHeader>
+ )}
+ <TableHeader></TableHeader>
+ <TableHeader className="flex justify-end items-center">
+ <div className="flex flex-row items-center gap-2 bg-dwdarkblue/70 text-white px-1 rounded-md hover:opacity-75">
+ <AutoRefreshSwitch
+ setAutoRefresh={props.setAutoRefresh}
+ autoRefresh={props.autoRefresh}
+ textColor="text-white"
/>
- Links
+ <span className="">Live</span>
</div>
</TableHeader>
- )}
- <TableHeader>
- <div className="flex flex-row items-center gap-2">
- <AutoRefreshSwitch
- setAutoRefresh={props.setAutoRefresh}
- autoRefresh={props.autoRefresh}
- />
- <span>Live</span>
- </div>
- </TableHeader>
- </>
- )}
- </TableRow>
- </TableHead>
- {/* <div className="h-10"></div> */}
- <TableBody className="pt-10">
- {props.steps.map((step) => {
- const isTraceExpanded = traceExpandedActions.includes(step.step_start_log.sequence_id);
- const isLinksExpanded = linksExpandedActions.includes(step.step_start_log.sequence_id);
- const links = linksBySequenceID.get(step.step_start_log.sequence_id) || [];
- return (
- <>
- <ActionTableRow
- key={`${step.step_start_log.sequence_id}-action-table-row`}
+ </>
+ )}
+ </TableRow>
+ </TableHead>
+ {/* <div className="h-10"></div> */}
+ {props.topToBottomChronological ? parentRows : <></>}
+ <TableBody className="pt-10">
+ {stepsWithEllapsedTime.map((step) => {
+ const isTraceExpanded = traceExpandedActions.includes(step.step_start_log.sequence_id);
+ const setTraceExpanded = (b: boolean) => {
+ if (b) {
+ setTraceExpandedActions([...traceExpandedActions, step.step_start_log.sequence_id]);
+ } else {
+ setTraceExpandedActions(
+ traceExpandedActions.filter((i) => i !== step.step_start_log.sequence_id)
+ );
+ }
+ };
+ const isLinksExpanded = linksExpandedActions.includes(step.step_start_log.sequence_id);
+ const links = linksBySequenceID.get(step.step_start_log.sequence_id) || [];
+ const beforePause = step.pauseAfterLastStepMillis > PAUSE_TIME_THRESHOLD_MILLIS;
+ return (
+ <ActionSubTable
+ key={step.step_start_log.sequence_id}
step={step}
- currentHoverIndex={props.currentHoverIndex}
- setCurrentHoverIndex={props.setCurrentHoverIndex}
- currentSelectedIndex={props.currentSelectedIndex}
- setCurrentSelectedIndex={props.setCurrentSelectedIndex}
numPriorIndices={props.numPriorIndices}
- isTracesExpanded={isTraceExpanded}
+ isTraceExpanded={isTraceExpanded}
+ toggleTraceExpandedActions={toggleTraceExpandedActions}
isLinksExpanded={isLinksExpanded}
- toggleTraceExpanded={toggleTraceExpandedActions}
toggleLinksExpanded={toggleLinksExpanded}
minimized={props.minimized}
links={links}
displaySpansCol={displaySpansCol}
displayLinksCol={displayLinksCol}
- ></ActionTableRow>
- {isTraceExpanded && (
- <TraceSubTable
- spans={step.spans}
- step={step}
- currentHoverIndex={props.currentHoverIndex}
- setCurrentHoverIndex={props.setCurrentHoverIndex}
- currentSelectedIndex={props.currentSelectedIndex}
- setCurrentSelectedIndex={props.setCurrentSelectedIndex}
- numPriorIndices={props.numPriorIndices}
- minimized={props.minimized}
- displaySpansCol={displaySpansCol}
- displayLinksCol={displayLinksCol}
- />
- )}
- {isLinksExpanded && (
- <LinkSubTable
- step={step}
- links={links}
- currentHoverIndex={props.currentHoverIndex}
- setCurrentHoverIndex={props.setCurrentHoverIndex}
- currentSelectedIndex={props.currentSelectedIndex}
- setCurrentSelectedIndex={props.setCurrentSelectedIndex}
- numPriorIndices={props.numPriorIndices}
- minimized={props.minimized}
- projectId={props.projectId}
- displaySpansCol={displaySpansCol}
- displayLinksCol={displayLinksCol}
- />
- )}
- </>
- );
- })}
- {props.parentPointer ? (
- <ParentLink parentPointer={props.parentPointer} projectId={props.projectId} type="fork" />
- ) : (
- <></>
- )}
- {props.spawningParentPointer ? (
- <ParentLink
- parentPointer={props.spawningParentPointer}
- projectId={props.projectId}
- type="spawn"
- displayLinksCol={displayLinksCol}
- displaySpansCol={displaySpansCol}
- />
- ) : (
- <></>
- )}
- </TableBody>
- </Table>
+ earliestTimeSeen={earliestTimeSeen}
+ latestTimeSeen={latestTimeSeen}
+ setTraceExpanded={setTraceExpanded}
+ projectId={props.projectId}
+ pauseLocation={beforePause ? 'bottom' : undefined}
+ pauseTime={step.pauseAfterLastStepMillis}
+ topToBottomChronological={props.topToBottomChronological}
+ />
+ );
+ })}
+ {!props.topToBottomChronological ? parentRows : <></>}
+ </TableBody>
+ <div ref={tableScrollRef}></div>
+ </Table>
+ </div>
);
};
@@ -694,17 +1359,13 @@ const ParentLink = (props: {
const Icon = props.type === 'fork' ? TbGrillFork : TiFlowChildren;
return (
<TableRow className="text-gray-500 cursor-pointer bg-gray-100">
- <TableCell colSpan={1} className="items-center justify-center flex max-w-20">
- <Icon className="h-5 w-5 -ml-1.5" />
+ <TableCell colSpan={1} className="items-center justify-center flex max-w-20 -ml-5">
+ <Icon className="h-5 w-5 -ml-1" />
</TableCell>
- <TableCell
- colSpan={3 + +!!props.displayLinksCol + +!!props.displaySpansCol}
- className="text-gray-500"
- >
- <div className="flex flex-row gap-1 items-center ">
+ <TableCell colSpan={2} className="text-gray-500">
+ <div className="flex flex-row gap-1 items-center pl-5">
<Link
- to={`/project/${props.projectId}/${props.parentPointer.partition_key}/${props.parentPointer.app_id}`}
- >
+ to={`/project/${props.projectId}/${props.parentPointer.partition_key}/${props.parentPointer.app_id}`}>
<span className="hover:underline">{props.parentPointer.app_id}</span>
</Link>
<span>@</span>
diff --git a/telemetry/ui/src/examples/MiniTelemetry.tsx b/telemetry/ui/src/examples/MiniTelemetry.tsx
index 646bbccc..98544e8c 100644
--- a/telemetry/ui/src/examples/MiniTelemetry.tsx
+++ b/telemetry/ui/src/examples/MiniTelemetry.tsx
@@ -12,6 +12,8 @@ export const MiniTelemetry = (props: { projectId: string; appId: string | undefi
appId={appId}
orientation="stacked_vertical"
defaultAutoRefresh={true}
+ enableFullScreenStepView={false}
+ enableMinizedStepView={false}
/>
);
};