🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
feat(analytics): add posthoc event for trace timeline (#2327)
marliessophie87798edd95cb
diff --git a/web/src/components/trace/TraceTimelineView.tsx b/web/src/components/trace/TraceTimelineView.tsxindex 65d7c5ea22..769730e295 100644--- a/web/src/components/trace/TraceTimelineView.tsx+++ b/web/src/components/trace/TraceTimelineView.tsx@@ -83,7 +83,10 @@ function TreeItemInner({>{type}</span>- <span className="w-fit-content overflow-hidden text-ellipsis whitespace-nowrap break-all text-sm">+ <span+ className="w-fit-content overflow-hidden text-ellipsis whitespace-nowrap break-all text-sm"+ title={name ?? undefined}+ >{name}</span><div@@ -177,7 +180,7 @@ function TraceTreeItem({return (<TreeItemclasses={{- content: `border-l border-dashed !rounded-xs ${backgroundColor} !min-w-fit hover:!bg-muted`,+ content: `border-l border-dashed !rounded-none ${backgroundColor} !min-w-fit hover:!bg-muted`,selected: "!bg-background !important hover:!bg-muted",label: "!min-w-fit",}}diff --git a/web/src/components/trace/index.tsx b/web/src/components/trace/index.tsxindex 332f10058f..e9e5630779 100644--- a/web/src/components/trace/index.tsx+++ b/web/src/components/trace/index.tsx@@ -178,6 +178,7 @@ export function Trace(props: {}export function TracePage({ traceId }: { traceId: string }) {+ const capture = usePostHogClientCapture();const router = useRouter();const utils = api.useUtils();const trace = api.traces.byId.useQuery(@@ -306,7 +307,10 @@ export function TracePage({ traceId }: { traceId: string }) {</div><Tabsvalue={selectedTab}- onValueChange={setSelectedTab}+ onValueChange={(tab) => {+ setSelectedTab(tab);+ capture("trace_detail:display_mode_switch", { view: tab });+ }}className="flex w-full justify-end border-b bg-background"><TabsList className="bg-background py-0">diff --git a/web/src/features/posthog-analytics/usePostHogClientCapture.ts b/web/src/features/posthog-analytics/usePostHogClientCapture.tsindex 680c7277fd..a30b92b7ab 100644--- a/web/src/features/posthog-analytics/usePostHogClientCapture.ts+++ b/web/src/features/posthog-analytics/usePostHogClientCapture.ts@@ -25,6 +25,7 @@ const events = {"observation_tree_toggle_metrics","io_mode_switch","test_in_playground_button_click",+ "display_mode_switch",],generations: ["export"],score: [