: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
feat(metrics): gate the facet rail on the metrics flag (#122973)
Daniel Visca75919210f0e5
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsxindex 7b34db77069c..6ac0aeab2b57 100644--- a/frontend/src/lib/constants.tsx+++ b/frontend/src/lib/constants.tsx@@ -426,7 +426,6 @@ export const FEATURE_FLAGS = {METRICS_DASHBOARD_IMPORT: 'metrics-dashboard-import', // owner: #team-apm — gates the dashboard import from a Grafana JSON model or a screenshot, which bills AI creditsMETRICS_DASHBOARD_PANELS: 'metrics-dashboard-panels', // owner: #team-apm — gates the stat/gauge/bargauge/table panel picker entriesMETRICS_ERROR_OVERLAYS: 'metrics-error-overlays', // owner: #team-apm — gates the error-spike overlay PoC on metrics charts- METRICS_FACET_RAIL: 'metrics-facet-rail', // owner: #team-apm — gates the facet rail (faceted filter sidebar) in the metrics viewerMETRICS_INSIGHT_BUILDER: 'metrics-insight-builder', // owner: #team-apm — offers Metrics in the new insight menu and the metrics builder in insight edit modeMETRICS_QUERY_LANGUAGES: 'metrics-query-languages', // owner: #team-apm — lets a metrics insight switch between the builder, PromQL and SQLMETRICS_SUGGESTED_DASHBOARDS: 'metrics-suggested-dashboards', // owner: #team-apm — suggests bank dashboards that fit the ingested metrics, and runs the AI analysis and generation for the teamdiff --git a/products/metrics/frontend/components/MetricsViewer.test.tsx b/products/metrics/frontend/components/MetricsViewer.test.tsxindex bf5bde752a80..9747908dbf29 100644--- a/products/metrics/frontend/components/MetricsViewer.test.tsx+++ b/products/metrics/frontend/components/MetricsViewer.test.tsx@@ -188,6 +188,25 @@ describe('MetricsViewer', () => {expect(await screen.findByText('Create a dashboard')).toBeInTheDocument()})+ // The facet rail ships with the metrics product, so the product flag alone gates it.+ it.each([+ ['shows', true],+ ['hides', false],+ ])('%s the facet rail toggle when the metrics flag is %s', (_, metricsEnabled) => {+ featureFlagLogic.actions.setFeatureFlags([], {+ [FEATURE_FLAGS.METRICS_DASHBOARD_PANELS]: true,+ ...(metricsEnabled ? { [FEATURE_FLAGS.METRICS]: true } : {}),+ })++ render(+ <Provider>+ <MetricsViewer />+ </Provider>+ )++ expect(document.querySelector('[data-attr="metrics-facet-rail-toggle"]') !== null).toBe(metricsEnabled)+ })+// Request windows resolve in the project timezone at fetch time, so a timezone change must// refetch, or the chart keeps data for the old window under labels in the new timezone.it('refetches the chart and anomaly for the new window when the project timezone changes', async () => {diff --git a/products/metrics/frontend/components/MetricsViewer.tsx b/products/metrics/frontend/components/MetricsViewer.tsxindex 797ab31881b5..051ecb0b4c7f 100644--- a/products/metrics/frontend/components/MetricsViewer.tsx+++ b/products/metrics/frontend/components/MetricsViewer.tsx@@ -174,7 +174,7 @@ export const MetricsViewer = (): JSX.Element => {const languagesEnabled = useFeatureFlag('METRICS_QUERY_LANGUAGES')// The rail writes builder filter chips, which PromQL and SQL queries do not read.- const facetRailEnabled = useFeatureFlag('METRICS_FACET_RAIL') && language === 'builder'+ const facetRailEnabled = useFeatureFlag('METRICS') && language === 'builder'return (<MetricsFacetRailLayout enabled={facetRailEnabled}>