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): replace the setup prompt with the product empty state (#90609)

Rafael Audiberte193ab6f1950
diff --git a/docs/internal/product-empty-state-adoption.md b/docs/internal/product-empty-state-adoption.md
index 4c326cf7b1eb..c0b8e9c541ba 100644
--- a/docs/internal/product-empty-state-adoption.md
+++ b/docs/internal/product-empty-state-adoption.md
@@ -52,7 +52,7 @@ Rows marked "in review" are not on `master` yet. See "Regenerating the lists" fo
| Web scripts | `frontend/src/scenes/data-pipelines/WebScriptsScene.tsx` | on master |
| Error tracking | `products/error_tracking/frontend/scenes/ErrorTrackingScene/ErrorTrackingScene.tsx` | on master |
| Logs | `products/logs/frontend/LogsScene.tsx` | on master |
-| Tracing | `products/tracing/frontend/TracingScene.tsx` | in review |
+| Tracing | `products/tracing/frontend/TracingScene.tsx` | on master |
| Metrics | `products/metrics/frontend/MetricsScene.tsx` | in review |
| Surveys | `frontend/src/scenes/surveys/Surveys.tsx` | in review |
| Session replay | `frontend/src/scenes/session-recordings/SessionRecordings.tsx` | in review |
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 2ed2347c81ba..2879bffcc52a 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -1856,6 +1856,10 @@ snapshots:
hash: v1.k794b7964.369d8902d1857ba89bc0995bbf90de39a2664d4c0ad9d7457b2c6c2972c65865.Q3OsOnoxbBawKNFS75yyCxSY3RTWKLXvDelOZhZQ6BE
components-product-empty-state--support-waiting-for-data--light:
hash: v1.k794b7964.81466638b2ad508f29fb15596fe41e493559cb42d140fc9a0631a5beb52a90af.eTpjSWKyf2FL3SoGdY-EGFLGwLo407-BlQiMsILXDkc
+ components-product-empty-state--tracing-needs-setup--dark:
+ hash: v1.k794b7964.31166d2274ea22226bc3281a0fe2f39caef85292a870fa58b0339964bcb2cb6b.xl8D1Zuw7EzZn8ptdhasdeA8LNEskINpumcYVM619Jg
+ components-product-empty-state--tracing-needs-setup--light:
+ hash: v1.k794b7964.186a74ebee46c9341b2dffbc73c647d7be5f38bdbabbeaf4098237c96ca56c35.i2DjPIjhqrqsIkHPC5Kkd28o97GAL-z6XDcrnjfsE54
components-product-empty-state--user-interviews-needs-setup--dark:
hash: v1.k794b7964.5834b5549690d205c2ec9d9b9765f392eeba757749a0cf243c810311f3733079.Ju4u90HdGqU4tcIDHMsmpInKHheBwMYRvpYnd8oGa30
components-product-empty-state--user-interviews-needs-setup--light:
diff --git a/frontend/src/lib/components/ProductEmptyState/ProductEmptyState.stories.tsx b/frontend/src/lib/components/ProductEmptyState/ProductEmptyState.stories.tsx
index 8b345b5264c6..41f3e118679b 100644
--- a/frontend/src/lib/components/ProductEmptyState/ProductEmptyState.stories.tsx
+++ b/frontend/src/lib/components/ProductEmptyState/ProductEmptyState.stories.tsx
@@ -19,6 +19,7 @@ import { mcpAnalyticsEmptyState } from 'products/mcp_analytics/frontend/emptySta
import { productToursEmptyState } from 'products/product_tours/frontend/emptyState/productToursEmptyState'
import { replayVisionEmptyState } from 'products/replay_vision/frontend/emptyState/replayVisionEmptyState'
import { llmSkillsEmptyState } from 'products/skills/frontend/emptyState/llmSkillsEmptyState'
+import { tracingEmptyState } from 'products/tracing/frontend/emptyState/tracingEmptyState'
import { userInterviewsEmptyState } from 'products/user_interviews/frontend/emptyState/userInterviewsEmptyState'
import { ProductEmptyState } from './ProductEmptyState'
@@ -213,3 +214,9 @@ export const LogsNeedsSetup: ProductEmptyStateStory = productEmptyStateStory(log
// nosemgrep: no-environments-api-urls-frontend -- api.logs is env-scoped, so the msw mock must match /api/environments to intercept it
mocks: { get: { '/api/environments/:team_id/logs/has_logs': [200, { hasLogs: false }] } },
})
+
+// Tracing detection asks the has-spans API on mount - answer "none yet".
+export const TracingNeedsSetup: ProductEmptyStateStory = productEmptyStateStory(tracingEmptyState, 'needs-setup', {
+ // nosemgrep: no-environments-api-urls-frontend -- api.tracing is env-scoped, so the msw mock must match /api/environments to intercept it
+ mocks: { get: { '/api/environments/:team_id/tracing/spans/has_spans': [200, { hasSpans: false }] } },
+})
diff --git a/products/tracing/frontend/TracingScene.tsx b/products/tracing/frontend/TracingScene.tsx
index 2bee4b448b6b..cb520e66e964 100644
--- a/products/tracing/frontend/TracingScene.tsx
+++ b/products/tracing/frontend/TracingScene.tsx
@@ -19,9 +19,9 @@ import { ProductIntentContext, ProductKey } from '~/queries/schema/schema-genera
import { ComparisonBar } from './components/Comparison/ComparisonBar'
import { FacetRail } from './components/FacetRail/FacetRail'
-import { TracingSetupPrompt } from './components/SetupPrompt/SetupPrompt'
import { TraceDrawer } from './components/TraceDrawer/TraceDrawer'
import { VirtualizedSpanList } from './components/VirtualizedSpanList/VirtualizedSpanList'
+import { tracingEmptyState } from './emptyState/tracingEmptyState'
import { OperationsTable } from './OperationsTable'
import { TraceCompareFlame } from './TraceCompareFlame'
import { TraceCompareTable } from './TraceCompareTable'
@@ -42,6 +42,7 @@ export const scene: SceneExport = {
component: TracingScene,
logic: tracingSceneLogic,
productKey: ProductKey.TRACING,
+ emptyState: tracingEmptyState,
}
export default function TracingScene(): JSX.Element {
@@ -195,7 +196,7 @@ function TracingSceneContents(): JSX.Element {
>
Tracing is now in beta. Please share feedback on how to improve the product.
</LemonBanner>
- <TracingSetupPrompt>
+ <>
<TracingFilterBar />
<SceneDivider />
<TracingSparkline
@@ -278,7 +279,7 @@ function TracingSceneContents(): JSX.Element {
)}
</div>
</div>
- </TracingSetupPrompt>
+ </>
<TraceDrawer
isOpen={isTraceOpen}
traceId={selectedTraceId}
diff --git a/products/tracing/frontend/components/SetupPrompt/SetupPrompt.tsx b/products/tracing/frontend/components/SetupPrompt/SetupPrompt.tsx
deleted file mode 100644
index fd07082ffe10..000000000000
--- a/products/tracing/frontend/components/SetupPrompt/SetupPrompt.tsx
+++ /dev/null
@@ -1,142 +0,0 @@
-import { useActions, useValues } from 'kea'
-import posthog from 'posthog-js'
-import { useEffect } from 'react'
-
-import * as xRayPng from '@posthog/brand/hoggies/png/x-ray'
-import { LemonButton, Link, Spinner } from '@posthog/lemon-ui'
-
-import { pngHoggie } from 'lib/brand/hoggies'
-import { ProductIntroduction } from 'lib/components/ProductIntroduction/ProductIntroduction'
-import { useInterval } from 'lib/hooks/useInterval'
-import goImage from 'scenes/onboarding/shared/logos/go.svg'
-import javaImage from 'scenes/onboarding/shared/logos/java.svg'
-import nodejsImage from 'scenes/onboarding/shared/logos/nodejs.svg'
-import pythonImage from 'scenes/onboarding/shared/logos/python.svg'
-import { teamLogic } from 'scenes/teamLogic'
-
-import { ProductIntentContext, ProductKey } from '~/queries/schema/schema-general'
-
-import { tracingIngestionLogic } from './tracingIngestionLogic'
-
-const HedgehogXRay = pngHoggie(xRayPng)
-
-const FRAMEWORK_LINKS: { name: string; image?: string; docsLink: string }[] = [
- { name: 'Node.js', image: nodejsImage, docsLink: 'https://opentelemetry.io/docs/languages/js/' },
- { name: 'Python', image: pythonImage, docsLink: 'https://opentelemetry.io/docs/languages/python/' },
- { name: 'Java', image: javaImage, docsLink: 'https://opentelemetry.io/docs/languages/java/' },
- { name: 'Go', image: goImage, docsLink: 'https://opentelemetry.io/docs/languages/go/' },
- { name: 'Other', docsLink: 'https://opentelemetry.io/docs/languages/' },
-]
-
-const POLLING_INTERVAL_MS = 5000
-
-export const TracingSetupPrompt = ({
- children,
- className,
-}: {
- children: React.ReactNode
- className?: string
-}): JSX.Element => {
- const { hasSpans, teamHasSpansLoading, teamHasSpansCheckFailed } = useValues(tracingIngestionLogic)
- const { currentTeam } = useValues(teamLogic)
-
- if ((teamHasSpansLoading && hasSpans === undefined) || !currentTeam) {
- return (
- <div className="flex justify-center">
- <Spinner />
- </div>
- )
- }
-
- if (teamHasSpansCheckFailed || hasSpans === undefined) {
- return <>{children}</>
- }
-
- if (!hasSpans) {
- return <NoSpansPrompt className={className} />
- }
-
- return <>{children}</>
-}
-
-const NoSpansPrompt = ({ className }: { className?: string }): JSX.Element | null => {
- const { addProductIntent } = useActions(teamLogic)
- const { hasSpans } = useValues(tracingIngestionLogic)
- const { loadTeamHasSpans } = useActions(tracingIngestionLogic)
-
- useEffect(() => {
- posthog.capture('tracing setup prompt viewed')
- }, [])
-
- useInterval(() => {
- if (!hasSpans) {
- loadTeamHasSpans()
- }
- }, POLLING_INTERVAL_MS)
-
- const onDocsLinkClick = (docsType: string): void => {
- posthog.capture('tracing onboarding docs clicked', { docs_type: docsType })
- addProductIntent({
- product_type: ProductKey.TRACING,
- intent_context: ProductIntentContext.TRACING_DOCS_VIEWED,
- })
- }
-
- return (
- <ProductIntroduction
- productName="Tracing"
- thingName="trace"
- titleOverride="You haven't sent any traces yet"
- description="PostHog tracing works with any OpenTelemetry-compatible client. You don't need any PostHog-specific packages – just use standard OpenTelemetry libraries to send spans via OTLP."
- isEmpty={true}
- productKey={ProductKey.TRACING}
- className={className}
- customHog={HedgehogXRay}
- actionElementOverride={
- <div className="flex flex-col items-start gap-4">
- <p className="text-sm text-secondary m-0">
- Read our{' '}
- <Link to="https://posthog.com/docs/tracing" onClick={() => onDocsLinkClick('Tracing')}>
- tracing docs
- </Link>
- , learn more about{' '}
- <Link
- to="https://opentelemetry.io/docs/what-is-opentelemetry/"
- target="_blank"
- disableDocsPanel
- onClick={() => onDocsLinkClick('OpenTelemetry')}
- >
- OpenTelemetry
- </Link>
- , or pick a language to get started:
- </p>
- <div className="flex flex-wrap gap-2">
- {FRAMEWORK_LINKS.map(({ name, image, docsLink }) => (
- <LemonButton
- key={name}
- type="secondary"
- size="small"
- to={docsLink}
- onClick={() => onDocsLinkClick(name)}
- icon={
- image ? (
- <img src={image} alt="" aria-hidden="true" className="w-5 h-5" />
- ) : undefined
- }
- >
- {name}
- </LemonButton>
- ))}
- </div>
- <div className="flex items-center gap-2 px-3 py-1.5 border border-accent rounded">
- <div className="relative flex items-center justify-center">
- <div className="absolute w-3 h-3 border-2 border-accent rounded-full animate-ping" />
- <div className="w-2 h-2 bg-accent rounded-full" />
- </div>
- <span className="text-sm">Watching for traces</span>
- </div>
- </div>
- }
- />
- )
-}
diff --git a/products/tracing/frontend/components/SetupPrompt/tracingIngestionLogic.test.ts b/products/tracing/frontend/components/SetupPrompt/tracingIngestionLogic.test.ts
deleted file mode 100644
index 917d064da2b3..000000000000
--- a/products/tracing/frontend/components/SetupPrompt/tracingIngestionLogic.test.ts
+++ /dev/null
@@ -1,192 +0,0 @@
-import { expectLogic } from 'kea-test-utils'
-
-import { resumeKeaLoadersErrors, silenceKeaLoadersErrors } from '~/initKea'
-import { useMocks } from '~/mocks/jest'
-import { initKeaTests } from '~/test/init'
-
-import { tracingIngestionLogic } from './tracingIngestionLogic'
-
-jest.mock('lib/utils/async', () => {
- const actual = jest.requireActual<typeof import('lib/utils/async')>('lib/utils/async')
- return {
- ...actual,
- // Run the real retry loop with no inter-attempt backoff. Otherwise the 1000ms + 1500ms
- // delays burn ~2.5s of real time per failing test and flake the 5s expectLogic timeout in CI.
- retryWithBackoff: (
- fn: Parameters<typeof actual.retryWithBackoff>[0],
- options: Parameters<typeof actual.retryWithBackoff>[1] = {}
- ) => actual.retryWithBackoff(fn, { ...options, initialDelayMs: 0 }),
- }
-})
-
-describe('tracingIngestionLogic', () => {
- afterEach(resumeKeaLoadersErrors)
- let logic: ReturnType<typeof tracingIngestionLogic.build>
-
- beforeEach(() => {
- localStorage.clear()
- initKeaTests()
- })
-
- afterEach(() => {
- logic?.unmount()
- localStorage.clear()
- })
-
- describe('loadTeamHasSpans', () => {
- it.each([
- { hasSpans: true, label: 'spans exist' },
- { hasSpans: false, label: 'no spans exist' },
- ])('loads teamHasSpans as $hasSpans when $label', async ({ hasSpans }) => {
- useMocks({
- get: {
- '/api/environments/:team_id/tracing/spans/has_spans/': () => [200, { hasSpans }],
- },
- })
-
- logic = tracingIngestionLogic()
- logic.mount()
-
- await expectLogic(logic).toDispatchActions(['loadTeamHasSpans', 'loadTeamHasSpansSuccess']).toMatchValues({
- teamHasSpans: hasSpans,
- teamHasSpansLoading: false,
- teamHasSpansCheckFailed: false,
- })
- })
-
- it('handles API failure and sets teamHasSpansCheckFailed', async () => {
- silenceKeaLoadersErrors()
- useMocks({
- get: {
- '/api/environments/:team_id/tracing/spans/has_spans/': () => [500, { detail: 'Server error' }],
- },
- })
-
- logic = tracingIngestionLogic()
- logic.mount()
-
- // With retry logic (3 attempts), this will eventually fail
- await expectLogic(logic).toDispatchActions(['loadTeamHasSpans', 'loadTeamHasSpansFailure']).toMatchValues({
- teamHasSpans: null, // kea-loaders sets to null on failure
- teamHasSpansLoading: false,
- teamHasSpansCheckFailed: true,
- })
- })
-
- it('starts with loading state on mount', async () => {
- useMocks({
- get: {
- '/api/environments/:team_id/tracing/spans/has_spans/': () => [200, { hasSpans: true }],
- },
- })
-
- logic = tracingIngestionLogic()
- logic.mount()
-
- // Immediately after mount, the loader should be in loading state
- expect(logic.values.teamHasSpansLoading).toBe(true)
-
- await expectLogic(logic).toDispatchActions(['loadTeamHasSpansSuccess'])
- })
-
- it('resets teamHasSpansCheckFailed on new load attempt', async () => {
- silenceKeaLoadersErrors()
- let callCount = 0
- useMocks({
- get: {
- '/api/environments/:team_id/tracing/spans/has_spans/': () => {
- callCount++
- if (callCount <= 3) {
- return [500, { detail: 'Server error' }]
- }
- return [200, { hasSpans: true }]
- },
- },
- })
-
- logic = tracingIngestionLogic()
- logic.mount()
-
- // First attempt fails after retries
- await expectLogic(logic).toDispatchActions(['loadTeamHasSpans', 'loadTeamHasSpansFailure']).toMatchValues({
- teamHasSpansCheckFailed: true,
- })
-
- // Manual retry succeeds
- logic.actions.loadTeamHasSpans()
-
- await expectLogic(logic).toDispatchActions(['loadTeamHasSpans', 'loadTeamHasSpansSuccess']).toMatchValues({
- teamHasSpans: true,
- teamHasSpansCheckFailed: false,
- })
- })
- })
-
- describe('caching', () => {
- it('skips API call when cachedTeamHasSpans is true', async () => {
- const mockFn = jest.fn(() => [200, { hasSpans: true }])
- useMocks({
- get: { '/api/environments/:team_id/tracing/spans/has_spans/': mockFn },
- })
-
- logic = tracingIngestionLogic()
- logic.mount()
-
- await expectLogic(logic).toDispatchActions(['loadTeamHasSpans', 'loadTeamHasSpansSuccess'])
- expect(mockFn).toHaveBeenCalledTimes(1)
-
- logic.unmount()
-
- // Mount again - should skip API call due to cache
- logic = tracingIngestionLogic()
- logic.mount()
-
- await expectLogic(logic).toNotHaveDispatchedActions(['loadTeamHasSpans'])
- expect(mockFn).toHaveBeenCalledTimes(1)
- expect(logic.values.hasSpans).toBe(true)
- })
-
- it('makes API call when cachedTeamHasSpans is null', async () => {
- const mockFn = jest.fn(() => [200, { hasSpans: false }])
- useMocks({
- get: { '/api/environments/:team_id/tracing/spans/has_spans/': mockFn },
- })
-
- logic = tracingIngestionLogic()
- logic.mount()
-
- await expectLogic(logic).toDispatchActions(['loadTeamHasSpans', 'loadTeamHasSpansSuccess'])
- expect(mockFn).toHaveBeenCalledTimes(1)
-
- logic.unmount()
-
- // Mount again - should make API call since false is not cached
- logic = tracingIngestionLogic()
- logic.mount()
-
- await expectLogic(logic).toDispatchActions(['loadTeamHasSpans', 'loadTeamHasSpansSuccess'])
- expect(mockFn).toHaveBeenCalledTimes(2)
- })
-
- it('hasSpans selector falls back to cachedTeamHasSpans when teamHasSpans is undefined', async () => {
- useMocks({
- get: { '/api/environments/:team_id/tracing/spans/has_spans/': () => [200, { hasSpans: true }] },
- })
-
- logic = tracingIngestionLogic()
- logic.mount()
-
- await expectLogic(logic).toDispatchActions(['loadTeamHasSpansSuccess'])
- expect(logic.values.cachedTeamHasSpans).toBe(true)
-
- logic.unmount()
-
- // Remount - teamHasSpans starts undefined, hasSpans should use cached
- logic = tracingIngestionLogic()
- logic.mount()
-
- expect(logic.values.teamHasSpans).toBeFalsy()
- expect(logic.values.hasSpans).toBe(true)
- })
- })
-})
diff --git a/products/tracing/frontend/components/SetupPrompt/tracingIngestionLogic.tsx b/products/tracing/frontend/components/SetupPrompt/tracingIngestionLogic.tsx
deleted file mode 100644
index 370f31e07c76..000000000000
--- a/products/tracing/frontend/components/SetupPrompt/tracingIngestionLogic.tsx
+++ /dev/null
@@ -1,94 +0,0 @@
-import { MakeLogicType, afterMount, kea, path, reducers, selectors } from 'kea'
-import { loaders } from 'kea-loaders'
-
-import api from 'lib/api'
-import { retryWithBackoff } from 'lib/utils/async'
-
-const teamId = window.POSTHOG_APP_CONTEXT?.current_team?.id
-
-// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
-export interface tracingIngestionLogicValues {
- cachedTeamHasSpans: boolean | null
- hasSpans: boolean | undefined
- teamHasSpans: boolean | undefined
- teamHasSpansCheckFailed: boolean
- teamHasSpansLoading: boolean
-}
-
-// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
-export interface tracingIngestionLogicActions {
- loadTeamHasSpans: () => any
- loadTeamHasSpansFailure: (
- error: string,
- errorObject?: any
- ) => {
- error: string
- errorObject?: any
- }
- loadTeamHasSpansSuccess: (
- teamHasSpans: boolean,
- payload?: any
- ) => {
- teamHasSpans: boolean
- payload?: any
- }
-}
-
-// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
-export interface tracingIngestionLogicMeta {
- __keaTypeGenInternalSelectorTypes: {
- hasSpans: (teamHasSpans: boolean | undefined, cachedTeamHasSpans: boolean | null) => boolean | undefined
- }
-}
-
-export type tracingIngestionLogicType = MakeLogicType<
- tracingIngestionLogicValues,
- tracingIngestionLogicActions,
- Record<string, any>,
- tracingIngestionLogicMeta
->
-
-export const tracingIngestionLogic = kea<tracingIngestionLogicType>([
- path(['products', 'tracing', 'components', 'SetupPrompt', 'tracingIngestionLogic']),
- loaders({
- teamHasSpans: {
- __default: undefined as boolean | undefined,
- loadTeamHasSpans: async (): Promise<boolean> => {
- return await retryWithBackoff(() => api.tracing.hasSpans(), { maxAttempts: 3 })
- },
- },
- }),
-
- reducers({
- teamHasSpansCheckFailed: [
- false,
- {
- loadTeamHasSpans: () => false,
- loadTeamHasSpansSuccess: () => false,
- loadTeamHasSpansFailure: () => true,
- },
- ],
- cachedTeamHasSpans: [
- null as boolean | null,
- { persist: true, prefix: `${teamId}__` },
- {
- // Only cache true - spans don't disappear once ingested
- loadTeamHasSpansSuccess: (_, { teamHasSpans }) => teamHasSpans || null,
- },
- ],
- }),
-
- selectors({
- hasSpans: [
- (s) => [s.teamHasSpans, s.cachedTeamHasSpans],
- (teamHasSpans: boolean | undefined, cachedTeamHasSpans: boolean | null): boolean | undefined =>
- teamHasSpans ?? cachedTeamHasSpans ?? undefined,
- ],
- }),
-
- afterMount(({ actions, values }) => {
- if (values.cachedTeamHasSpans !== true) {
- actions.loadTeamHasSpans()
- }
- }),
-])
diff --git a/products/tracing/frontend/emptyState/TracingPreview.scss b/products/tracing/frontend/emptyState/TracingPreview.scss
new file mode 100644
index 000000000000..0f1bcd3a9caf
--- /dev/null
+++ b/products/tracing/frontend/emptyState/TracingPreview.scss
@@ -0,0 +1,262 @@
+@import '../../../../frontend/src/lib/components/ProductEmptyState/previewMixins';
+
+.TracingPreview {
+ --tracing-preview-accent: var(--empty-state-accent, var(--color-primary-500));
+
+ display: flex;
+ flex-direction: column;
+ gap: 0.75rem;
+
+ // Hidden selection state. A direct child of .TracingPreview so `:checked ~` reaches both cards.
+ &__checkbox {
+ position: absolute;
+ width: 0;
+ height: 0;
+ pointer-events: none;
+ opacity: 0;
+ }
+
+ &__waterfall,
+ &__detail {
+ overflow: hidden;
+ background: var(--color-bg-surface-primary);
+ border: 1px solid var(--color-border-primary);
+ border-radius: var(--radius);
+ }
+
+ // Idle/selected pairs are stacked on one grid cell and crossfaded, so selecting
+ // never changes any element's size (no layout shift).
+ &__swap {
+ display: grid;
+ }
+
+ &__swap > * {
+ grid-area: 1 / 1;
+ min-width: 0;
+ }
+
+ &__when-selected {
+ @include preview-swap-hidden;
+ }
+
+ &__when-idle {
+ @include preview-swap-visible;
+ }
+
+ &__head {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 0.5rem 0.75rem;
+ border-bottom: 1px solid var(--color-border-primary);
+ }
+
+ &__title {
+ display: flex;
+ gap: 0.375rem;
+ align-items: center;
+ overflow: hidden;
+ font-size: 0.75rem;
+ font-weight: 600;
+ white-space: nowrap;
+ }
+
+ &__live-dot {
+ flex-shrink: 0;
+ width: 7px;
+ height: 7px;
+ background: var(--tracing-preview-accent);
+ border-radius: 50%;
+ animation: TracingPreview__pulse 2s ease-in-out infinite;
+ }
+
+ // Waterfall
+
+ &__rows {
+ display: flex;
+ flex-direction: column;
+ padding: 0.375rem 0.5rem;
+ }
+
+ &__row {
+ display: grid;
+ grid-template-columns: minmax(0, 11rem) minmax(0, 1fr) 3.25rem;
+ gap: 0.5rem;
+ align-items: center;
+ padding: 0.25rem 0.375rem;
+ border-radius: var(--radius);
+ transition: background-color 250ms ease;
+ }
+
+ &__row--hero {
+ cursor: pointer;
+ user-select: none;
+ }
+
+ &__row--hero:hover {
+ background: var(--color-bg-fill-highlight-50);
+ }
+
+ &__span-label {
+ display: flex;
+ gap: 0.375rem;
+ align-items: baseline;
+ min-width: 0;
+ }
+
+ &__service {
+ flex-shrink: 0;
+ font-size: 0.5625rem;
+ font-weight: 600;
+ color: var(--color-text-tertiary);
+ text-transform: uppercase;
+ }
+
+ &__span-name {
+ overflow: hidden;
+ font-family: var(--font-mono);
+ font-size: 0.625rem;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
+
+ &__track {
+ position: relative;
+ height: 0.5rem;
+ }
+
+ &__bar {
+ position: absolute;
+ top: 0;
+ height: 100%;
+ background: color-mix(in oklab, var(--tracing-preview-accent) 45%, transparent);
+ border-radius: 2px;
+ transition:
+ background-color 250ms ease,
+ box-shadow 250ms ease;
+ }
+
+ &__duration {
+ font-family: var(--font-mono);
+ font-size: 0.625rem;
+ font-variant-numeric: tabular-nums;
+ color: var(--color-text-secondary);
+ text-align: right;
+ }
+
+ &__hint {
+ padding: 0.375rem 0.75rem 0.5rem;
+ font-size: 0.625rem;
+ color: var(--color-text-tertiary);
+ }
+
+ // Detail panel
+
+ &__detail-body {
+ padding: 0.625rem 0.75rem;
+ }
+
+ &__detail-hint {
+ align-self: center;
+ font-size: 0.6875rem;
+ color: var(--color-text-tertiary);
+ }
+
+ &__attrs {
+ display: flex;
+ flex-direction: column;
+ gap: 0.25rem;
+ }
+
+ &__attr {
+ display: grid;
+ grid-template-columns: 7rem minmax(0, 1fr);
+ gap: 0.5rem;
+ font-family: var(--font-mono);
+ font-size: 0.625rem;
+ }
+
+ &__attr-key {
+ color: var(--color-text-tertiary);
+ }
+
+ &__attr-val {
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
+
+ &__attr-val--slow {
+ font-weight: 600;
+
+ @include preview-accent-text(var(--tracing-preview-accent));
+ }
+
+ &__fresh {
+ font-size: 0.5625rem;
+ font-weight: 600;
+
+ @include preview-accent-text(var(--tracing-preview-accent));
+ }
+}
+
+// Selected state (user clicked the payment span)
+
+.TracingPreview__checkbox:checked ~ * .TracingPreview__when-selected {
+ @include preview-swap-visible;
+}
+
+.TracingPreview__checkbox:checked ~ * .TracingPreview__when-idle {
+ @include preview-swap-hidden;
+}
+
+.TracingPreview__checkbox:checked ~ .TracingPreview__waterfall .TracingPreview__row--hero {
+ background: color-mix(in oklab, var(--tracing-preview-accent) 8%, transparent);
+}
+
+.TracingPreview__checkbox:checked ~ .TracingPreview__waterfall .TracingPreview__row--hero .TracingPreview__bar {
+ background: var(--tracing-preview-accent);
+ box-shadow: 0 0 0 1px color-mix(in oklab, var(--tracing-preview-accent) 45%, transparent);
+}
+
+// The checkbox stays keyboard-focusable while visually hidden, so the row it labels
+// needs a visible focus indicator (WCAG 2.4.7).
+.TracingPreview__checkbox:focus-visible ~ .TracingPreview__waterfall .TracingPreview__row--hero {
+ outline: 2px solid var(--tracing-preview-accent);
+ outline-offset: 1px;
+}
+
+// Nudge attention at the slow span until it's selected.
+.TracingPreview:not(.TracingPreview--static)
+ .TracingPreview__checkbox:not(:checked)
+ ~ .TracingPreview__waterfall
+ .TracingPreview__row--hero
+ .TracingPreview__bar {
+ animation: TracingPreview__nudge 2.4s ease-in-out infinite;
+}
+
+@keyframes TracingPreview__nudge {
+ 0%,
+ 100% {
+ box-shadow: 0 0 0 0 color-mix(in oklab, var(--tracing-preview-accent) 45%, transparent);
+ }
+
+ 50% {
+ box-shadow: 0 0 0 3px color-mix(in oklab, var(--tracing-preview-accent) 20%, transparent);
+ }
+}
+
+@keyframes TracingPreview__pulse {
+ 0%,
+ 100% {
+ opacity: 1;
+ }
+
+ 50% {
+ opacity: 0.35;
+ }
+}
+
+// Storybook snapshots and reduced motion drop all ambient motion; clicking the
+// span still flips the state (transitions only).
+@include preview-motion-guards('TracingPreview');
diff --git a/products/tracing/frontend/emptyState/TracingPreview.tsx b/products/tracing/frontend/emptyState/TracingPreview.tsx
new file mode 100644
index 000000000000..fae1128d0d2a
--- /dev/null
+++ b/products/tracing/frontend/emptyState/TracingPreview.tsx
@@ -0,0 +1,143 @@
+import './TracingPreview.scss'
+
+import { LemonTag } from 'lib/lemon-ui/LemonTag'
+import { cn } from 'lib/utils/css-classes'
+import { inStorybook, inStorybookTestRunner } from 'lib/utils/dom'
+
+interface SpanRow {
+ service: string
+ name: string
+ depth: number
+ /** Offset and width, in % of the trace's duration. */
+ offset: number
+ width: number
+ duration: string
+ hero?: boolean
+}
+
+const SPAN_ROWS: SpanRow[] = [
+ { service: 'web', name: 'POST /api/checkout', depth: 0, offset: 0, width: 100, duration: '812 ms' },
+ { service: 'checkout-api', name: 'process_order', depth: 1, offset: 4, width: 92, duration: '748 ms' },
+ { service: 'checkout-api', name: 'SELECT cart_items', depth: 2, offset: 6, width: 8, duration: '61 ms' },
+ {
+ service: 'payment-provider',
+ name: 'POST /v1/charges',
+ depth: 2,
+ offset: 16,
+ width: 79,
+ duration: '640 ms',
+ hero: true,
+ },
+ { service: 'checkout-api', name: 'INSERT orders', depth: 2, offset: 96, width: 3, duration: '24 ms' },
+]
+
+/**
+ * Example-data preview for the tracing empty state: the waterfall of one slow
+ * checkout request, and the details of its dominant span. Clicking the long
+ * payment span highlights it and fills the detail card with its attributes.
+ * One hidden checkbox drives it via `:checked ~` styles - no timers or state,
+ * per the preview rules in the `building-product-empty-states` skill. Detail
+ * states crossfade in `__swap` grids, so nothing shifts.
+ */
+export function TracingPreview(): JSX.Element {
+ const isStatic = inStorybook() || inStorybookTestRunner()
+
+ return (
+ <div className={cn('TracingPreview', isStatic && 'TracingPreview--static')}>
+ {/* Selection state, before both cards so `:checked ~` can style them. */}
+ <input type="checkbox" id="tracing-preview-select" className="TracingPreview__checkbox" />
+
+ <div className="TracingPreview__waterfall">
+ <div className="TracingPreview__head">
+ <span className="TracingPreview__title">
+ <span className="TracingPreview__live-dot" aria-hidden="true" />
+ POST /api/checkout · 812 ms
+ </span>
+ <LemonTag size="small">example data</LemonTag>
+ </div>
+
+ <div className="TracingPreview__rows">
+ {SPAN_ROWS.map((span) => {
+ const rowInner = (
+ <>
+ <span
+ className="TracingPreview__span-label"
+ style={{ paddingLeft: `${span.depth * 0.75}rem` }}
+ >
+ <span className="TracingPreview__service">{span.service}</span>
+ <span className="TracingPreview__span-name">{span.name}</span>
+ </span>
+ <span className="TracingPreview__track">
+ <span
+ className="TracingPreview__bar"
+ style={{ left: `${span.offset}%`, width: `${span.width}%` }}
+ />
+ </span>
+ <span className="TracingPreview__duration">{span.duration}</span>
+ </>
+ )
+ if (span.hero) {
+ return (
+ <label
+ key={span.name}
+ htmlFor="tracing-preview-select"
+ className="TracingPreview__row TracingPreview__row--hero"
+ >
+ {rowInner}
+ </label>
+ )
+ }
+ return (
+ <div key={span.name} className="TracingPreview__row">
+ {rowInner}
+ </div>
+ )
+ })}
+ </div>
+
+ <div className="TracingPreview__hint TracingPreview__swap">
+ <span className="TracingPreview__when-idle">Click the longest span to see why it's slow.</span>
+ <span className="TracingPreview__when-selected">
+ 79% of this request is the payment call. Click again to deselect.
+ </span>
+ </div>
+ </div>
+
+ <div className="TracingPreview__detail">
+ <div className="TracingPreview__head">
+ <span className="TracingPreview__title">Span details</span>
+ <span className="TracingPreview__fresh TracingPreview__when-selected">payment-provider</span>
+ </div>
+ <div className="TracingPreview__detail-body TracingPreview__swap">
+ <div className="TracingPreview__detail-hint TracingPreview__when-idle">
+ Select a span to inspect its attributes.
+ </div>
+ <div className="TracingPreview__attrs TracingPreview__when-selected">
+ <div className="TracingPreview__attr">
+ <span className="TracingPreview__attr-key">service.name</span>
+ <span className="TracingPreview__attr-val">payment-provider</span>
+ </div>
+ <div className="TracingPreview__attr">
+ <span className="TracingPreview__attr-key">duration</span>
+ <span className="TracingPreview__attr-val TracingPreview__attr-val--slow">
+ 640 ms · 79% of trace
+ </span>
+ </div>
+ <div className="TracingPreview__attr">
+ <span className="TracingPreview__attr-key">http.status_code</span>
+ <span className="TracingPreview__attr-val">200</span>
+ </div>
+ <div className="TracingPreview__attr">
+ <span className="TracingPreview__attr-key">retry.count</span>
+ <span className="TracingPreview__attr-val">2</span>
+ </div>
+ <div className="TracingPreview__attr">
+ <span className="TracingPreview__attr-key">peer.service</span>
+ <span className="TracingPreview__attr-val">payments.example.com</span>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ )
+}
diff --git a/products/tracing/frontend/emptyState/tracingEmptyState.tsx b/products/tracing/frontend/emptyState/tracingEmptyState.tsx
new file mode 100644
index 000000000000..51899c063c12
--- /dev/null
+++ b/products/tracing/frontend/emptyState/tracingEmptyState.tsx
@@ -0,0 +1,33 @@
+import * as xRayPng from '@posthog/brand/hoggies/png/x-ray'
+import { IconListTree } from '@posthog/icons'
+
+import { pngHoggie } from 'lib/brand/hoggies'
+import type { SceneProductEmptyState } from 'lib/components/ProductEmptyState/types'
+
+import { ProductKey } from '~/queries/schema/schema-general'
+
+import { TracingPreview } from './TracingPreview'
+import { tracingSetupLogic } from './tracingSetupLogic'
+
+const HedgehogXRay = pngHoggie(xRayPng)
+
+export const tracingEmptyState: SceneProductEmptyState = {
+ statusLogic: tracingSetupLogic,
+ config: {
+ productKey: ProductKey.TRACING,
+ productName: 'Tracing',
+ icon: <IconListTree />,
+ accentColor: 'var(--color-product-tracing-light)',
+ accentColorDark: 'var(--color-product-tracing-dark)',
+ hedgehog: HedgehogXRay,
+ text: {
+ 'needs-setup': {
+ headline: 'See where every request spends its time',
+ lead: 'Send spans from any OpenTelemetry-compatible client over OTLP. No PostHog-specific packages needed. Follow a request across services, find the span that slows it down, and watch latency over time.',
+ },
+ },
+ docsUrl: 'https://posthog.com/docs/tracing',
+ previewLabel: 'Your traces, once connected',
+ Preview: TracingPreview,
+ },
+}
diff --git a/products/tracing/frontend/emptyState/tracingSetupLogic.ts b/products/tracing/frontend/emptyState/tracingSetupLogic.ts
new file mode 100644
index 000000000000..ab07a7d9cc41
--- /dev/null
+++ b/products/tracing/frontend/emptyState/tracingSetupLogic.ts
@@ -0,0 +1,23 @@
+import api from 'lib/api'
+import { createSetupDetectionLogic } from 'lib/components/ProductEmptyState/setupDetectionLogic'
+import { retryWithBackoff } from 'lib/utils/async'
+
+import { ProductKey } from '~/queries/schema/schema-general'
+
+/**
+ * Setup detection for the tracing empty state. Binary: the team has ingested at
+ * least one span, or it hasn't - there is no "instrumented but quiet" signal to
+ * read, so no waiting-for-data state.
+ */
+export const tracingSetupLogic = createSetupDetectionLogic({
+ productKey: ProductKey.TRACING,
+ path: ['products', 'tracing', 'frontend', 'emptyState', 'tracingSetupLogic'],
+ detect: async () => {
+ const hasSpans = await retryWithBackoff(() => api.tracing.hasSpans(), { maxAttempts: 3 })
+ return hasSpans ? 'has-data' : 'needs-setup'
+ },
+ // The first span usually lands moments after the collector restarts, so
+ // re-check often enough for the flip to feel immediate.
+ pollIntervalMs: 5000,
+ cacheHasData: true,
+})