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(tracing): add documentation links to scene header and empty state (#60954)

Jon McCallum3d68c82c6c99
diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.json
index 88082f27d122..444125b3aa69 100644
--- a/frontend/src/queries/schema.json
+++ b/frontend/src/queries/schema.json
@@ -28935,7 +28935,8 @@
"vercel_integration",
"endpoint_created",
"endpoint_created_from_insight",
- "endpoint_created_from_sql_editor"
+ "endpoint_created_from_sql_editor",
+ "tracing_docs_viewed"
],
"type": "string"
},
diff --git a/frontend/src/queries/schema/schema-general.ts b/frontend/src/queries/schema/schema-general.ts
index 05399d2f814a..aad45c2dfd67 100644
--- a/frontend/src/queries/schema/schema-general.ts
+++ b/frontend/src/queries/schema/schema-general.ts
@@ -6764,6 +6764,9 @@ export enum ProductIntentContext {
ENDPOINT_CREATED = 'endpoint_created',
ENDPOINT_CREATED_FROM_INSIGHT = 'endpoint_created_from_insight',
ENDPOINT_CREATED_FROM_SQL_EDITOR = 'endpoint_created_from_sql_editor',
+
+ // Tracing
+ TRACING_DOCS_VIEWED = 'tracing_docs_viewed',
}
// Known prod_interest values from posthog.com
diff --git a/posthog/schema.py b/posthog/schema.py
index 8163bb4608ed..2393fba72a11 100644
--- a/posthog/schema.py
+++ b/posthog/schema.py
@@ -3990,6 +3990,7 @@ class ProductIntentContext(StrEnum):
ENDPOINT_CREATED = "endpoint_created"
ENDPOINT_CREATED_FROM_INSIGHT = "endpoint_created_from_insight"
ENDPOINT_CREATED_FROM_SQL_EDITOR = "endpoint_created_from_sql_editor"
+ TRACING_DOCS_VIEWED = "tracing_docs_viewed"
class ProductItemCategory(StrEnum):
diff --git a/products/tracing/frontend/TracingScene.tsx b/products/tracing/frontend/TracingScene.tsx
index f8a16258571d..1af6a0302935 100644
--- a/products/tracing/frontend/TracingScene.tsx
+++ b/products/tracing/frontend/TracingScene.tsx
@@ -1,17 +1,18 @@
import { useActions, useValues } from 'kea'
import posthog from 'posthog-js'
-import { LemonBanner, LemonModal } from '@posthog/lemon-ui'
+import { LemonBanner, LemonButton, LemonModal, Link } from '@posthog/lemon-ui'
import { IconFeedback } from 'lib/lemon-ui/icons'
import { SpinnerOverlay } from 'lib/lemon-ui/Spinner/Spinner'
import { useAttachedLogic } from 'lib/logic/scenes/useAttachedLogic'
import { SceneExport } from 'scenes/sceneTypes'
+import { teamLogic } from 'scenes/teamLogic'
import { SceneContent } from '~/layout/scenes/components/SceneContent'
import { SceneDivider } from '~/layout/scenes/components/SceneDivider'
import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'
-import { ProductKey } from '~/queries/schema/schema-general'
+import { ProductIntentContext, ProductKey } from '~/queries/schema/schema-general'
import { VirtualizedSpanList } from './components/VirtualizedSpanList/VirtualizedSpanList'
import { TraceCompareFlame } from './TraceCompareFlame'
@@ -26,6 +27,7 @@ import { TracingTabIdProvider, useTracingTabId } from './TracingTabContext'
import type { Span } from './types'
const TRACING_FEEDBACK_SURVEY_ID = '019e6a26-4943-0000-24a0-dc46310f6b7c'
+const TRACING_DOCS_URL = 'https://posthog.com/docs/tracing'
export const scene: SceneExport<TracingSceneLogicProps> = {
component: TracingScene,
@@ -80,8 +82,16 @@ function TracingSceneContents(): JSX.Element {
fetchNextPage,
setVisibleRowRange,
} = useActions(tracingSceneLogic({ tabId }))
+ const { addProductIntent } = useActions(teamLogic)
const compareMode = filters.compareMode
+ const onDocsLinkClick = (): void => {
+ addProductIntent({
+ product_type: ProductKey.TRACING,
+ intent_context: ProductIntentContext.TRACING_DOCS_VIEWED,
+ })
+ }
+
// Anchor the overlay's coordinate space to the *fetched* sparkline data so overlay
// drags never shift the canvas underfoot. The sparkline only refetches when dateRange
// changes (via the DateFilter), never via overlay interaction.
@@ -107,6 +117,17 @@ function TracingSceneContents(): JSX.Element {
resourceType={{
type: 'tracing',
}}
+ actions={
+ <LemonButton
+ to={TRACING_DOCS_URL}
+ onClick={onDocsLinkClick}
+ type="secondary"
+ size="small"
+ targetBlank
+ >
+ Documentation
+ </LemonButton>
+ }
/>
<LemonBanner
type="warning"
@@ -150,6 +171,14 @@ function TracingSceneContents(): JSX.Element {
hasMoreToLoad={hasMoreToLoad}
onLoadMore={fetchNextPage}
onVisibleRowRangeChange={setVisibleRowRange}
+ emptyState={
+ <div className="flex flex-col items-center gap-1">
+ <span>No spans found</span>
+ <Link to={TRACING_DOCS_URL} onClick={onDocsLinkClick} target="_blank">
+ Learn how to send traces
+ </Link>
+ </div>
+ }
onRowClick={(span: Span) => {
// Clicking a row leaves the scrollable <main tabIndex="0"> as the active
// element; react-modal then scrolls it back into view when restoring focus
diff --git a/products/tracing/frontend/components/VirtualizedSpanList/VirtualizedSpanList.tsx b/products/tracing/frontend/components/VirtualizedSpanList/VirtualizedSpanList.tsx
index c241269d3965..f2a9259ff538 100644
--- a/products/tracing/frontend/components/VirtualizedSpanList/VirtualizedSpanList.tsx
+++ b/products/tracing/frontend/components/VirtualizedSpanList/VirtualizedSpanList.tsx
@@ -1,4 +1,4 @@
-import { CSSProperties, useCallback, useMemo, useRef } from 'react'
+import { CSSProperties, ReactNode, useCallback, useMemo, useRef } from 'react'
import { List } from 'react-window'
import { LemonTag } from '@posthog/lemon-ui'
@@ -40,6 +40,7 @@ interface VirtualizedSpanListProps {
onVisibleRowRangeChange: (startIndex: number, stopIndex: number) => void
hasMoreToLoad?: boolean
onLoadMore?: () => void
+ emptyState?: ReactNode
}
interface SpanRowProps {
@@ -146,6 +147,7 @@ export function VirtualizedSpanList({
onVisibleRowRangeChange,
hasMoreToLoad = false,
onLoadMore,
+ emptyState = 'No spans found',
}: VirtualizedSpanListProps): JSX.Element {
// Tracks the last range we dispatched so we don't fire on every overscan tick.
const lastVisibleRangeRef = useRef<{ startIndex: number; stopIndex: number } | null>(null)
@@ -178,7 +180,7 @@ export function VirtualizedSpanList({
if (dataSource.length === 0 && !loading) {
return (
<div className="flex items-center justify-center p-8 text-muted border rounded bg-bg-light">
- No spans found
+ {emptyState}
</div>
)
}