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(alerts): test anomaly alert guidance (#80833)

Matt Pua053065c4e861
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx
index b63566f3a602..8c1e2fcfece3 100644
--- a/frontend/src/lib/constants.tsx
+++ b/frontend/src/lib/constants.tsx
@@ -256,6 +256,7 @@ export const FEATURE_FLAGS = {
AI_GATEWAY: 'ai-gateway', // owner: #team-ai-gateway, gates the AI gateway UI and llm_gateway:read on project secret API keys
/** Alert edit modal: check history chart + chart/table toggle (table remains when off). */
ALERTS_15_MINUTE_INTERVAL: 'alerts-15-minute-interval', // owner: #team-analytics-platform, gates 15-minute insight alert interval
+ ANOMALY_ALERT_GUIDANCE_EXPERIMENT: 'anomaly-alert-guidance',
ALERTS_INLINE_NOTIFICATIONS: 'alerts-inline-notifications', // owner: @vdekrijger
ALERTS_INVESTIGATION_AGENT: 'alerts-investigation-agent', // owner: @andrewm4894, anomaly alerts — investigation agent on firing
ALERTS_REAL_TIME_INTERVAL: 'alerts-real-time-interval', // owner: #team-analytics-platform, gates real-time (2-minute) insight alert interval
diff --git a/products/alerts/frontend/components/AlertDefinitionSection.tsx b/products/alerts/frontend/components/AlertDefinitionSection.tsx
index 3224d6be0197..4b9e457be8db 100644
--- a/products/alerts/frontend/components/AlertDefinitionSection.tsx
+++ b/products/alerts/frontend/components/AlertDefinitionSection.tsx
@@ -61,6 +61,7 @@ export interface AlertDefinitionSectionProps {
funnel: FunnelDefinitionProps
hogql: HogQLDefinitionProps
supportsAnomalyDetection: boolean
+ showAnomalyGuidance?: boolean
twoColumnLayout?: boolean
investigationAgentEnabled: boolean
simulationResult: AlertSimulationResult | null
@@ -85,6 +86,7 @@ export function AlertDefinitionSection({
funnel,
hogql,
supportsAnomalyDetection,
+ showAnomalyGuidance = false,
twoColumnLayout = false,
investigationAgentEnabled,
simulationResult,
@@ -176,8 +178,9 @@ export function AlertDefinitionSection({
{
value: 'detector',
label: 'Anomaly detection',
- description:
- 'Automatically flag unusual changes using statistical models. No fixed value needed.',
+ description: showAnomalyGuidance
+ ? 'Choose this when you want an alert for unusual changes and do not know what threshold to set.'
+ : 'Automatically flag unusual changes using statistical models. No fixed value needed.',
'data-attr': 'alertForm-mode-detector',
},
]}
diff --git a/products/alerts/frontend/views/EditAlertModal.tsx b/products/alerts/frontend/views/EditAlertModal.tsx
index d78b3c3c0906..cf335a30f5af 100644
--- a/products/alerts/frontend/views/EditAlertModal.tsx
+++ b/products/alerts/frontend/views/EditAlertModal.tsx
@@ -141,6 +141,7 @@ export function EditAlertModal(props: AlertModalProps): JSX.Element {
(node, index) => getDisplayNameFromEntityNode(node) ?? `Step ${index + 1}`
)
const insightAlertKind = insightAlertKindForQuery(query)
+ const anomalyAlertGuidanceEnabled = useFeatureFlag('ANOMALY_ALERT_GUIDANCE_EXPERIMENT', 'anomaly_guidance')
const formLogicProps = {
alert,
@@ -344,6 +345,7 @@ export function EditAlertModal(props: AlertModalProps): JSX.Element {
labelColumnOptions: hogqlLabelColumnOptions,
}}
supportsAnomalyDetection={!isNonTimeSeriesDisplay && supportsAnomalyDetection(alertForm.config)}
+ showAnomalyGuidance={creatingNewAlert && anomalyAlertGuidanceEnabled}
twoColumnLayout
investigationAgentEnabled={investigationAgentEnabled}
simulationResult={simulationResult}