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 flag-gated facet rail shell (#68597)

Jon McCallumabdd385b804d
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx
index 6f933adaa98d..d0a802213c0c 100644
--- a/frontend/src/lib/constants.tsx
+++ b/frontend/src/lib/constants.tsx
@@ -491,6 +491,7 @@ export const FEATURE_FLAGS = {
TAXONOMIC_FILTER_MENU_REBUILD: 'taxonomic-filter-menu-rebuild', // owner: @adamleith, opt-in to the rebuilt TaxonomicFilter — headless filter panel + new popover menu (column / preview-pane)
TOGGLE_PROPERTY_ARRAYS: 'toggle-property-arrays', // owner: @arthurdedeus #team-customer-analytics
TRACING: 'tracing', // owner: #team-apm (@jonmcwest, @frankh)
+ TRACING_FACET_RAIL: 'tracing-facet-rail', // owner: #team-apm — gates the facet rail (faceted filter sidebar) in tracing
TRACING_OPERATIONS_VIEW: 'tracing-operations-view', // owner: #team-apm — gates the Operations (per-operation aggregate) tab in tracing
TRACING_SAVED_VIEWS: 'tracing-saved-views', // owner: #team-apm — gates saved views (saved filter sets) in tracing
TRAFFIC_TYPE_VIRTUAL_PROPERTIES: 'traffic-type-virtual-properties', // owner: #team-web-analytics
diff --git a/products/tracing/frontend/TracingFilterBar.tsx b/products/tracing/frontend/TracingFilterBar.tsx
index 09ea7a91e9b4..bd68a5487e75 100644
--- a/products/tracing/frontend/TracingFilterBar.tsx
+++ b/products/tracing/frontend/TracingFilterBar.tsx
@@ -1,7 +1,7 @@
import { BindLogic, useActions, useValues } from 'kea'
import { useRef, useState } from 'react'
-import { IconChevronDown, IconList, IconListTree, IconRefresh } from '@posthog/icons'
+import { IconChevronDown, IconChevronLeft, IconChevronRight, IconList, IconListTree, IconRefresh } from '@posthog/icons'
import {
LemonButton,
LemonCheckbox,
@@ -21,6 +21,7 @@ import UniversalFilters from 'lib/components/UniversalFilters/UniversalFilters'
import { universalFiltersLogic } from 'lib/components/UniversalFilters/universalFiltersLogic'
import { isUniversalGroupFilterLike } from 'lib/components/UniversalFilters/utils'
import { dayjs } from 'lib/dayjs'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { useOnMountEffect } from 'lib/hooks/useOnMountEffect'
import { DateRange } from '~/queries/schema/schema-general'
@@ -33,6 +34,7 @@ import {
} from '~/types'
import { SavedViewsButton } from './savedViews/SavedViewsButton'
+import { tracingConfigLogic } from './tracingConfigLogic'
import { tracingDataLogic } from './tracingDataLogic'
import { tracingFiltersLogic, type TracingViewMode } from './tracingFiltersLogic'
import { tracingServiceFilterLogic, TracingServiceFilterLogicProps } from './tracingServiceFilterLogic'
@@ -51,12 +53,26 @@ export function TracingFilterBar(): JSX.Element {
const { setDateRange, setTimezone, setServiceNames, setFilterGroup, setViewMode, setCompareMode } =
useActions(tracingFiltersLogic())
const { dateRange, serviceNames, filterGroup, viewMode, compareMode } = filters
+ const showFacetRail = useFeatureFlag('TRACING_FACET_RAIL')
+ const { facetRailCollapsed } = useValues(tracingConfigLogic)
+ const { setFacetRailCollapsed } = useActions(tracingConfigLogic)
return (
<TracingFilterGroup filterGroup={filterGroup} onFilterGroupChange={setFilterGroup}>
<div className="flex flex-col gap-2 w-full">
<div className="flex gap-2 flex-wrap w-full justify-between">
<div className="flex shrink-0 flex-1 gap-1.5">
+ {showFacetRail && !compareMode && (
+ <LemonButton
+ size="small"
+ type="secondary"
+ icon={facetRailCollapsed ? <IconChevronRight /> : <IconChevronLeft />}
+ onClick={() => setFacetRailCollapsed(!facetRailCollapsed)}
+ aria-label={facetRailCollapsed ? 'Show facets' : 'Hide facets'}
+ tooltip={facetRailCollapsed ? 'Show facets' : 'Hide facets'}
+ data-attr="tracing-facet-rail-toggle"
+ />
+ )}
<TracingServiceFilter
value={serviceNames}
onChange={setServiceNames}
diff --git a/products/tracing/frontend/TracingScene.tsx b/products/tracing/frontend/TracingScene.tsx
index 2bcf676cca5f..e1b5538b50a8 100644
--- a/products/tracing/frontend/TracingScene.tsx
+++ b/products/tracing/frontend/TracingScene.tsx
@@ -18,12 +18,14 @@ import { SceneDivider } from '~/layout/scenes/components/SceneDivider'
import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'
import { ProductIntentContext, ProductKey } from '~/queries/schema/schema-general'
+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 { OperationsTable } from './OperationsTable'
import { TraceCompareFlame } from './TraceCompareFlame'
import { TraceCompareTable } from './TraceCompareTable'
+import { tracingConfigLogic } from './tracingConfigLogic'
import { tracingDataLogic } from './tracingDataLogic'
import { TracingFilterBar } from './TracingFilterBar'
import { tracingFiltersLogic } from './tracingFiltersLogic'
@@ -96,8 +98,10 @@ function TracingSceneContents(): JSX.Element {
setActiveTracingTab,
} = useActions(tracingSceneLogic())
const { addProductIntent } = useActions(teamLogic)
+ const { facetRailCollapsed } = useValues(tracingConfigLogic)
const compareMode = filters.compareMode
const operationsViewEnabled = !!featureFlags[FEATURE_FLAGS.TRACING_OPERATIONS_VIEW]
+ const facetRailEnabled = !!featureFlags[FEATURE_FLAGS.TRACING_FACET_RAIL]
// Resolved aggregation window (ms) — turns span counts into a request rate.
// Use sparklineWindowMs which correctly resolves relative date strings (e.g. '-1h').
@@ -199,58 +203,63 @@ function TracingSceneContents(): JSX.Element {
onRowClick={(row) => router.actions.push(urls.tracingOperation(row.service_name, row.name))}
/>
) : (
- <>
- {/* No loading guard: keep the last (view-mode-independent) count visible across reloads,
+ <div className="flex flex-row gap-2 flex-1 min-h-0">
+ {facetRailEnabled && !compareMode && !facetRailCollapsed && <FacetRail />}
+ <div className="flex flex-col gap-y-4 flex-1 min-w-0 min-h-0">
+ {/* No loading guard: keep the last (view-mode-independent) count visible across reloads,
so a Traces/Spans switch doesn't flicker the label out and back in. */}
- {!compareMode && totalMatchingFilters > 0 && (
- <div className="text-xs text-muted px-1">
- {humanFriendlyNumber(totalMatchingFilters)}{' '}
- {filters.viewMode === 'spans' ? 'spans' : 'traces'} matching filters
- </div>
- )}
- {compareMode ? (
- <TraceCompareTable
- current={aggregation.current}
- previous={aggregation.previous}
- loading={aggregationLoading}
- onRowClick={(row) => openCompareFlame(row.name, row.service_name)}
- />
- ) : (
- <VirtualizedSpanList
- dataSource={listRows}
- loading={spansLoading}
- hasMoreToLoad={hasMoreToLoad}
- onLoadMore={fetchNextPage}
- onVisibleRowRangeChange={setVisibleRowRange}
- orderBy={filters.orderBy}
- orderDirection={filters.orderDirection}
- onSort={(column) =>
- // Click an active column to flip direction; a new column starts at DESC.
- setSort(
- column,
- column === filters.orderBy && filters.orderDirection === 'DESC' ? 'ASC' : 'DESC'
- )
- }
- 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
- // on close. Blur so the restore target is <body>, which doesn't scroll.
- ;(document.activeElement as HTMLElement | null)?.blur?.()
- // Anchor the waterfall on the clicked span — in Spans mode this is often a
- // child span, so without spanId the drawer would open unfocused at the root.
- openTrace(span.trace_id, { spanId: span.span_id, ts: span.timestamp })
- }}
- />
- )}
- </>
+ {!compareMode && totalMatchingFilters > 0 && (
+ <div className="text-xs text-muted px-1">
+ {humanFriendlyNumber(totalMatchingFilters)}{' '}
+ {filters.viewMode === 'spans' ? 'spans' : 'traces'} matching filters
+ </div>
+ )}
+ {compareMode ? (
+ <TraceCompareTable
+ current={aggregation.current}
+ previous={aggregation.previous}
+ loading={aggregationLoading}
+ onRowClick={(row) => openCompareFlame(row.name, row.service_name)}
+ />
+ ) : (
+ <VirtualizedSpanList
+ dataSource={listRows}
+ loading={spansLoading}
+ hasMoreToLoad={hasMoreToLoad}
+ onLoadMore={fetchNextPage}
+ onVisibleRowRangeChange={setVisibleRowRange}
+ orderBy={filters.orderBy}
+ orderDirection={filters.orderDirection}
+ onSort={(column) =>
+ // Click an active column to flip direction; a new column starts at DESC.
+ setSort(
+ column,
+ column === filters.orderBy && filters.orderDirection === 'DESC'
+ ? 'ASC'
+ : 'DESC'
+ )
+ }
+ 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
+ // on close. Blur so the restore target is <body>, which doesn't scroll.
+ ;(document.activeElement as HTMLElement | null)?.blur?.()
+ // Anchor the waterfall on the clicked span — in Spans mode this is often a
+ // child span, so without spanId the drawer would open unfocused at the root.
+ openTrace(span.trace_id, { spanId: span.span_id, ts: span.timestamp })
+ }}
+ />
+ )}
+ </div>
+ </div>
)}
</TracingSetupPrompt>
<TraceDrawer
diff --git a/products/tracing/frontend/components/FacetRail/FacetRail.tsx b/products/tracing/frontend/components/FacetRail/FacetRail.tsx
new file mode 100644
index 000000000000..37276112cffd
--- /dev/null
+++ b/products/tracing/frontend/components/FacetRail/FacetRail.tsx
@@ -0,0 +1,52 @@
+import { useActions, useValues } from 'kea'
+import { useCallback, useMemo, useRef } from 'react'
+
+import { Resizer } from 'lib/components/Resizer/Resizer'
+import { ResizerLogicProps, resizerLogic } from 'lib/components/Resizer/resizerLogic'
+
+import { tracingConfigLogic } from '../../tracingConfigLogic'
+
+const DEFAULT_WIDTH_PX = 240
+const COLLAPSE_THRESHOLD_PX = 120
+
+/**
+ * Resizable left-hand facet rail for the tracing scene. Facets (values + counts) land in
+ * follow-up PRs — this is the flag-gated shell: sizing, persistence, and collapse behavior.
+ */
+export function FacetRail(): JSX.Element {
+ const railRef = useRef<HTMLDivElement>(null)
+ const { setFacetRailCollapsed } = useActions(tracingConfigLogic)
+
+ const onToggleClosed = useCallback(
+ (shouldBeClosed: boolean) => setFacetRailCollapsed(shouldBeClosed),
+ [setFacetRailCollapsed]
+ )
+ const resizerLogicProps: ResizerLogicProps = useMemo(
+ () => ({
+ logicKey: 'tracing-facet-rail',
+ containerRef: railRef,
+ persistent: true,
+ persistPrefix: '2026-07-06',
+ placement: 'right',
+ closeThreshold: COLLAPSE_THRESHOLD_PX,
+ onToggleClosed,
+ }),
+ [onToggleClosed]
+ )
+ const { desiredSize } = useValues(resizerLogic(resizerLogicProps))
+
+ return (
+ <div
+ ref={railRef}
+ className="relative flex flex-col shrink-0 border rounded bg-surface-primary overflow-hidden"
+ // eslint-disable-next-line react/forbid-dom-props
+ style={{ width: desiredSize ?? DEFAULT_WIDTH_PX, minWidth: 'min-content', maxWidth: '40%' }}
+ data-attr="tracing-facet-rail"
+ >
+ <div className="flex-1 min-h-0 overflow-y-auto p-2">
+ <div className="px-1 text-xs text-muted">Facets will appear here.</div>
+ </div>
+ <Resizer {...resizerLogicProps} visible={false} offset="0.25rem" handleClassName="rounded my-1" />
+ </div>
+ )
+}
diff --git a/products/tracing/frontend/tracingConfigLogic.ts b/products/tracing/frontend/tracingConfigLogic.ts
new file mode 100644
index 000000000000..a902ee93e814
--- /dev/null
+++ b/products/tracing/frontend/tracingConfigLogic.ts
@@ -0,0 +1,22 @@
+import { actions, kea, path, reducers } from 'kea'
+
+import type { tracingConfigLogicType } from './tracingConfigLogicType'
+
+/** Display-only preferences for the tracing scene — never affects the query. */
+export const tracingConfigLogic = kea<tracingConfigLogicType>([
+ path(['products', 'tracing', 'frontend', 'tracingConfigLogic']),
+
+ actions({
+ setFacetRailCollapsed: (facetRailCollapsed: boolean) => ({ facetRailCollapsed }),
+ }),
+
+ reducers({
+ facetRailCollapsed: [
+ false,
+ { persist: true },
+ {
+ setFacetRailCollapsed: (_, { facetRailCollapsed }) => facetRailCollapsed,
+ },
+ ],
+ }),
+])