: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(tracing): remove the tracing-metrics-tab flag (#128534)
Daniel Visca364c8a5b307e
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsxindex 3dbc903b8e0a..690ba44b83d3 100644--- a/frontend/src/lib/constants.tsx+++ b/frontend/src/lib/constants.tsx@@ -558,7 +558,6 @@ export const FEATURE_FLAGS = {TRACING_FACET_RAIL: 'tracing-facet-rail', // owner: #team-apm — gates the facet rail (faceted filter sidebar) in tracingTRACING_IMPACT_STRIP: 'tracing-impact-strip', // owner: #team-apm — gates the sessions/users impact strip and the Operations table's impact columnsTRACING_LATENCY_HEATMAP: 'tracing-latency-heatmap', // owner: #team-apm — gates the latency-over-time heatmap chart in tracing- TRACING_METRICS_TAB: 'tracing-metrics-tab', // owner: #team-apm — gates the Metrics tab (metrics correlated via exemplars) in the trace drawerTRACING_OPERATIONS_VIEW: 'tracing-operations-view', // owner: #team-apm — gates the Operations (per-operation aggregate) tab in tracingTRACING_SAVED_VIEWS: 'tracing-saved-views', // owner: #team-apm — gates saved views (saved filter sets) in tracingTRACING_SCENE_TABS: 'tracing-scene-tabs', // owner: #team-apm — gates the Viewer and SQL tabs in the tracing scenediff --git a/products/tracing/frontend/components/SpanInspector/SpanInspector.tsx b/products/tracing/frontend/components/SpanInspector/SpanInspector.tsxindex 5c52dff79a73..77c5484c8dcf 100644--- a/products/tracing/frontend/components/SpanInspector/SpanInspector.tsx+++ b/products/tracing/frontend/components/SpanInspector/SpanInspector.tsx@@ -70,9 +70,8 @@ export function SpanInspector({const { featureFlags } = useValues(featureFlagLogic)// Metrics correlate to a trace via exemplars, so the tab only exists where the metrics- // product does: its own flag, plus the metrics feature and view access.- const showMetricsTab =- !!featureFlags[FEATURE_FLAGS.TRACING_METRICS_TAB] && !!featureFlags[FEATURE_FLAGS.METRICS] && canViewMetrics()+ // product does: the metrics feature and view access.+ const showMetricsTab = !!featureFlags[FEATURE_FLAGS.METRICS] && canViewMetrics()// Only DB spans carry a query; the Query tab appears only when one is present.const queryText = getQueryText(span)@@ -162,7 +161,7 @@ export function SpanInspector({content: <TraceOperationsTab key={span.trace_id} span={span} {...operations} />,}: null,- // Conditional: needs the metrics product (flag + access) and its own flag.+ // Conditional: needs the metrics product (flag + access).showMetricsTab? {key: 'metrics',diff --git a/products/tracing/frontend/components/TraceDrawer/TraceDrawer.test.tsx b/products/tracing/frontend/components/TraceDrawer/TraceDrawer.test.tsxindex 8501e452b85f..b88d1c4d4724 100644--- a/products/tracing/frontend/components/TraceDrawer/TraceDrawer.test.tsx+++ b/products/tracing/frontend/components/TraceDrawer/TraceDrawer.test.tsx@@ -8,6 +8,7 @@ import { FEATURE_FLAGS } from 'lib/constants'import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { initKeaTests } from '~/test/init'+import { AccessControlLevel, AccessControlResourceType, AppContext } from '~/types'import { tracingSpansTraceAiEventsRetrieve } from 'products/tracing/frontend/generated/api'@@ -23,6 +24,10 @@ jest.mock('products/tracing/frontend/generated/api', () => ({tracingSpansTraceAiEventsRetrieve: jest.fn(),}))+jest.mock('products/metrics/frontend/components/TraceMetricSamples', () => ({+ TraceMetricSamples: () => null,+}))+const mockAiEventsRetrieve = tracingSpansTraceAiEventsRetrieve as jest.MockedFunction<typeof tracingSpansTraceAiEventsRetrieve>@@ -186,6 +191,33 @@ describe('TraceDrawer', () => {expect(traceViewLogic({ id: 'trace-drawer-test' }).values.operationSpans).toHaveLength(2)})+ // Fails when the Metrics tab needs a gate other than the metrics product flag and metrics view access,+ // or when the tab shows without one of them.+ it.each([+ { metricsFlag: true, access: AccessControlLevel.Viewer, shows: true },+ { metricsFlag: false, access: AccessControlLevel.Viewer, shows: false },+ { metricsFlag: true, access: AccessControlLevel.None, shows: false },+ ])(+ 'with the metrics flag on: $metricsFlag and metrics access: $access, shows the Metrics tab: $shows',+ ({ metricsFlag, access, shows }) => {+ featureFlagLogic.mount()+ featureFlagLogic.actions.setFeatureFlags([], { [FEATURE_FLAGS.METRICS]: metricsFlag })+ window.POSTHOG_APP_CONTEXT = {+ ...window.POSTHOG_APP_CONTEXT,+ resource_access_control: {+ ...window.POSTHOG_APP_CONTEXT?.resource_access_control,+ [AccessControlResourceType.Metrics]: access,+ },+ } as AppContext+ renderDrawer({ spans: [makeSpan({ trace_id: 'abc123', span_id: 'span-1', is_root_span: true })] })++ const tabBar = within(+ document.querySelector('[data-attr="tracing-inspector-tabs"] [role="tablist"]') as HTMLElement+ )+ expect(tabBar.queryByText('Metrics') !== null).toBe(shows)+ }+ )+// Fails when a click on the tab already on screen sends the tab event. The span has no query, so the chosen// Query tab falls back to Attributes, and a click on Attributes changes nothing the person sees. The click on// Raw keeps the first check from passing on a tab bar that sends nothing at all.