Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(error-tracking): open the trace drawer from view trace (#130874)

Jon McCallumf1af6416faed
diff --git a/frontend/src/lib/components/ViewTraceButton/traceDialogOpenLogic.ts b/frontend/src/lib/components/ViewTraceButton/traceDialogOpenLogic.ts
index 981abee6dce3..5b411f9c0162 100644
--- a/frontend/src/lib/components/ViewTraceButton/traceDialogOpenLogic.ts
+++ b/frontend/src/lib/components/ViewTraceButton/traceDialogOpenLogic.ts
@@ -24,6 +24,7 @@ export type TraceDialogEntryPoint =
| 'log_trace_id_cell'
| 'metric_sample'
| 'metric_exemplar'
+ | 'exception_card'
export type TraceDialogCloseReason = 'dismissed' | 'back_to_log' | 'open_in_tracing' | 'navigated' | 'replaced'
diff --git a/products/error_tracking/frontend/components/ExceptionCard/ExceptionCard.tsx b/products/error_tracking/frontend/components/ExceptionCard/ExceptionCard.tsx
index 3b9198808746..41e4307c8d2c 100644
--- a/products/error_tracking/frontend/components/ExceptionCard/ExceptionCard.tsx
+++ b/products/error_tracking/frontend/components/ExceptionCard/ExceptionCard.tsx
@@ -13,6 +13,7 @@ import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { Tabs, TabsList, TabsTrigger } from 'lib/ui/quill'
import { ViewLogsButton } from 'products/logs/frontend/components/ViewLogsButton'
+import { useOpenTraceDialog } from 'products/tracing/frontend/components/TraceDialog/useOpenTraceDialog'
import { ExceptionCardFooter } from './ExceptionCardFooter'
import { exceptionCardLogic } from './exceptionCardLogic'
@@ -90,6 +91,9 @@ function ExceptionCardContent({
const { sessionId, spanId, traceId } = useValues(errorPropertiesLogic)
const { setCurrentTab } = useActions(exceptionCardLogic)
const logsEnabled = useFeatureFlag('LOGS_IN_ERROR_TRACKING')
+ const openTraceDialog = useOpenTraceDialog()
+ const usableTraceId = usableId(traceId)
+ const usableSpanId = usableId(spanId)
const headerRef = useRef<HTMLDivElement>(null)
// Base UI scrolls the active tab into view on mount and on keyboard navigation, but not when the
@@ -195,13 +199,22 @@ function ExceptionCardContent({
)}
</TabsList>
<div className="flex justify-end gap-1">
- <ViewTraceButton
- traceId={usableId(traceId)}
- spanId={usableId(spanId)}
- timestamp={timestamp}
- size="xsmall"
- data-attr="error-tracking-view-trace"
- />
+ {usableTraceId && (
+ <ViewTraceButton
+ traceId={usableTraceId}
+ spanId={usableSpanId}
+ timestamp={timestamp}
+ size="xsmall"
+ data-attr="error-tracking-view-trace"
+ onClick={(event) =>
+ openTraceDialog(
+ event,
+ { traceId: usableTraceId, spanId: usableSpanId, ts: timestamp },
+ { entryPoint: 'exception_card' }
+ )
+ }
+ />
+ )}
{sessionId && (currentTab === 'timeline' || currentTab === 'recording') ? (
<ViewLogsButton
sessionId={sessionId}