: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(logs): scaffold flag-gated anomalies tab (#77476)
Jon McCallumaf4ac7e874dc
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsxindex b23ff7893df1..f11d7faf4ecd 100644--- a/frontend/src/lib/constants.tsx+++ b/frontend/src/lib/constants.tsx@@ -353,6 +353,7 @@ export const FEATURE_FLAGS = {LLM_PROMPT_LABELS: 'prompt-labels', // owner: @jurajmajerik #team-ai-observabilityLOGS: 'logs', // owner: #team-logsLOGS_ALERTING: 'logs-alerting', // owner: #team-logs+ LOGS_ANOMALIES: 'logs-anomalies', // owner: @jonmcwest #team-logsLOGS_COLUMN_CONFIGURATION: 'logs-column-configuration', // owner: #team-logsLOGS_GROUP_BY: 'logs-group-by', // owner: #team-logsLOGS_IN_ERROR_TRACKING: 'logs-in-error-tracking', // owner: @jonmcwest #team-logsdiff --git a/products/logs/frontend/LogsAnomalies.tsx b/products/logs/frontend/LogsAnomalies.tsxnew file mode 100644index 000000000000..f17dc6fd21d2--- /dev/null+++ b/products/logs/frontend/LogsAnomalies.tsx@@ -0,0 +1,11 @@+import { EmptyMessage } from 'lib/components/EmptyMessage/EmptyMessage'++// Intentionally bare: the learning-status surface lands here in a later change.+export function LogsAnomalies(): JSX.Element {+ return (+ <EmptyMessage+ title="Anomaly detection"+ description="PostHog learns each service's normal log volume and surfaces spikes, drops, and silences here, so there's nothing to configure."+ />+ )+}diff --git a/products/logs/frontend/LogsScene.tsx b/products/logs/frontend/LogsScene.tsxindex 8e7cfd68c407..4c2d26b84a59 100644--- a/products/logs/frontend/LogsScene.tsx+++ b/products/logs/frontend/LogsScene.tsx@@ -25,6 +25,7 @@ import { logsIngestionLogic } from 'products/logs/frontend/components/SetupPrompimport { LogsSetupPrompt } from 'products/logs/frontend/components/SetupPrompt/SetupPrompt'import { useOpenLogsSettingsPanel } from './hooks/useOpenLogsSettingsPanel'+import { LogsAnomalies } from './LogsAnomalies'import { LOGS_SCENE_VIEWER_ID, LogsSceneActiveTab, logsSceneLogic } from './logsSceneLogic'export const LOGS_LOGIC_KEY = 'logs'@@ -96,11 +97,13 @@ const LogsSceneTabbedContent = (): JSX.Element => {const showAlerting = useFeatureFlag('LOGS_ALERTING')const showSqlView = useFeatureFlag('LOGS_SQL_VIEW')const showTransformations = useFeatureFlag('LOGS_TRANSFORMATIONS')+ const showAnomalies = useFeatureFlag('LOGS_ANOMALIES')const tabs: { key: LogsSceneActiveTab; label: string }[] = [{ key: 'viewer', label: 'Viewer' },...(showServicesView ? [{ key: 'services' as const, label: 'Services' }] : []),...(showAlerting ? [{ key: 'alerts' as const, label: 'Alerts' }] : []),+ ...(showAnomalies ? [{ key: 'anomalies' as const, label: 'Anomalies' }] : []),...(showSqlView ? [{ key: 'sql' as const, label: 'SQL' }] : []),...(showTransformations ? [{ key: 'transformations' as const, label: 'Transformations' }] : []),{ key: 'configuration', label: 'Configuration' },@@ -156,6 +159,7 @@ const LogsSceneTabbedContent = (): JSX.Element => {</>)}{activeTab === 'alerts' && showAlerting && <LogsAlertingSection />}+ {activeTab === 'anomalies' && showAnomalies && <LogsAnomalies />}{activeTab === 'sql' && showSqlView && <LogsSqlEditor id={LOGS_SCENE_VIEWER_ID} />}{activeTab === 'transformations' && showTransformations && <LogsTransformations />}{activeTab === 'configuration' && (diff --git a/products/logs/frontend/logsSceneLogic.test.ts b/products/logs/frontend/logsSceneLogic.test.tsindex 4b12912d1dc1..0ac17d85bb0d 100644--- a/products/logs/frontend/logsSceneLogic.test.ts+++ b/products/logs/frontend/logsSceneLogic.test.ts@@ -145,6 +145,7 @@ describe('logsSceneLogic', () => {it.each([['viewer', 'viewer'],+ ['anomalies', 'anomalies'],['configuration', 'configuration'],])('parses valid activeTab "%s" from URL', async (urlValue, expected) => {await expectLogic(logic, () => {diff --git a/products/logs/frontend/logsSceneLogic.tsx b/products/logs/frontend/logsSceneLogic.tsxindex 5d29d66926d3..826bc5e7d2ec 100644--- a/products/logs/frontend/logsSceneLogic.tsx+++ b/products/logs/frontend/logsSceneLogic.tsx@@ -45,11 +45,19 @@ export const LOGS_SCENE_VIEWER_ID = `logs-scene-${window.POSTHOG_APP_CONTEXT?.cuconst VALID_VIEW_MODES: LogsViewerViewMode[] = ['logs', 'patterns', 'group']-export type LogsSceneActiveTab = 'viewer' | 'services' | 'alerts' | 'sql' | 'transformations' | 'configuration'+export type LogsSceneActiveTab =+ | 'viewer'+ | 'services'+ | 'alerts'+ | 'anomalies'+ | 'sql'+ | 'transformations'+ | 'configuration'const VALID_ACTIVE_TABS: LogsSceneActiveTab[] = ['viewer','services','alerts',+ 'anomalies','sql','transformations','configuration',