: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(health-alerts): mount entry points and add per-check render_alert (#59986)
Rafael Audibertff7384d00646
diff --git a/frontend/src/scenes/health-alerts/HealthAlertsEntryPoint.tsx b/frontend/src/scenes/health-alerts/HealthAlertsEntryPoint.tsxindex 16012da8b484..4adbdfcd6ea2 100644--- a/frontend/src/scenes/health-alerts/HealthAlertsEntryPoint.tsx+++ b/frontend/src/scenes/health-alerts/HealthAlertsEntryPoint.tsx@@ -8,12 +8,14 @@ import {AlertCreationView,AlertWizardLogicProps,alertWizardLogic,+ applyKindFilter,+ decorateAlertName,} from 'scenes/hog-functions/AlertWizard/alertWizardLogic'import { HogFunctionList } from 'scenes/hog-functions/list/HogFunctionsList'import { HogFunctionTemplateList } from 'scenes/hog-functions/list/HogFunctionTemplateList'import { getFiltersFromSubTemplateId } from 'scenes/hog-functions/list/LinkedHogFunctions'-import { CyclotronJobFiltersType } from '~/types'+import { CyclotronJobFiltersType, HogFunctionSubTemplateType } from '~/types'import {HEALTH_ALERT_DESTINATIONS,@@ -26,11 +28,12 @@ const HOG_FUNCTION_FILTER_LIST = HEALTH_ALERT_SUB_TEMPLATE_IDS.map(getFiltersFro) as CyclotronJobFiltersType[]export interface HealthAlertsEntryPointProps {- // `logicKey` keeps multiple mounts (e.g. SDK Doctor + central page in the- // same session) from sharing wizard state.logicKey?: string// Restricts the resulting HogFunction's filter to a `kind IN (...)` set.- // Omit on the central page to leave filters unrestricted (every kind).+ // The central scene reads this from the `preset_kinds` URL search param so+ // per-page entry points (SDK Doctor, Pipeline Status) can deep-link in with+ // a scoped wizard. Omit (or pass an empty array) to leave filters+ // unrestricted (every kind).presetKinds?: string[]}@@ -54,7 +57,7 @@ export function HealthAlertsEntryPoint({}function HealthAlertsEntryPointInner(): JSX.Element {- const { alertCreationView, subTemplateIds } = useValues(alertWizardLogic)+ const { alertCreationView, subTemplateIds, selectedKinds } = useValues(alertWizardLogic)const { setAlertCreationView, resetWizard } = useActions(alertWizardLogic)if (alertCreationView === AlertCreationView.Wizard) {@@ -78,7 +81,25 @@ function HealthAlertsEntryPointInner(): JSX.Element {<HogFunctionTemplateListtype="destination"subTemplateIds={subTemplateIds}- getConfigurationOverrides={(id) => (id ? getFiltersFromSubTemplateId(id) : undefined)}+ getConfigurationOverrides={(_id, subTemplate) => {+ if (!subTemplate) {+ return undefined+ }+ const overrides: Partial<HogFunctionSubTemplateType> = {}+ const filters = applyKindFilter(subTemplate.filters, selectedKinds)+ if (filters && filters !== subTemplate.filters) {+ overrides.filters = filters+ }+ if (selectedKinds && selectedKinds.length > 0) {+ if (subTemplate.name) {+ overrides.name = decorateAlertName(subTemplate.name, selectedKinds)+ }+ if (subTemplate.description) {+ overrides.description = decorateAlertName(subTemplate.description, selectedKinds)+ }+ }+ return Object.keys(overrides).length > 0 ? overrides : undefined+ }}extraControls={<LemonButtontype="secondary"diff --git a/frontend/src/scenes/health-alerts/HealthAlertsScene.tsx b/frontend/src/scenes/health-alerts/HealthAlertsScene.tsxindex 102a733d9d9e..af1b1e0770e4 100644--- a/frontend/src/scenes/health-alerts/HealthAlertsScene.tsx+++ b/frontend/src/scenes/health-alerts/HealthAlertsScene.tsx@@ -1,3 +1,6 @@+import { useValues } from 'kea'+import { router } from 'kea-router'+import { SceneExport } from 'scenes/sceneTypes'import { SceneContent } from '~/layout/scenes/components/SceneContent'@@ -9,7 +12,23 @@ export const scene: SceneExport = {component: HealthAlertsScene,}+function parsePresetKinds(raw: unknown): string[] | undefined {+ if (typeof raw !== 'string' || raw.length === 0) {+ return undefined+ }+ const kinds = raw+ .split(',')+ .map((k) => k.trim())+ .filter(Boolean)+ return kinds.length > 0 ? kinds : undefined+}+export function HealthAlertsScene(): JSX.Element {+ const {+ searchParams: { preset_kinds: rawPresetKinds },+ } = useValues(router)+ const presetKinds = parsePresetKinds(rawPresetKinds)+return (<SceneContent><SceneTitleSection@@ -17,7 +36,7 @@ export function HealthAlertsScene(): JSX.Element {description="Get notified when a PostHog health check fires or recovers. Pick a destination (Slack, Discord, Teams, email, or webhook) and the kinds of checks you care about."resourceType={{ type: 'health' }}/>- <HealthAlertsEntryPoint />+ <HealthAlertsEntryPoint presetKinds={presetKinds} /></SceneContent>)}diff --git a/frontend/src/scenes/health/HealthScene.tsx b/frontend/src/scenes/health/HealthScene.tsxindex 264f9117922a..32883d791aea 100644--- a/frontend/src/scenes/health/HealthScene.tsx+++ b/frontend/src/scenes/health/HealthScene.tsx@@ -1,6 +1,15 @@import { useActions, useValues } from 'kea'-import { IconCheck, IconCode, IconDatabase, IconEllipsis, IconRefresh, IconSupport, IconWarning } from '@posthog/icons'+import {+ IconBell,+ IconCheck,+ IconCode,+ IconDatabase,+ IconEllipsis,+ IconRefresh,+ IconSupport,+ IconWarning,+} from '@posthog/icons'import { LemonBanner, LemonButton, LemonMenu, Link } from '@posthog/lemon-ui'import { supportLogic } from 'lib/components/Support/supportLogic'@@ -91,6 +100,8 @@ const UnifiedHealthScene = (): JSX.Element => {useValues(healthSceneLogic)const { refreshHealthData, setShowDismissed } = useActions(healthSceneLogic)const { openSupportForm } = useActions(supportLogic)+ const { featureFlags } = useValues(featureFlagLogic)+ const healthAlertsEnabled = !!featureFlags[FEATURE_FLAGS.HEALTH_ALERTS]const now = Date.now()const inCooldown = nextRefreshAvailableAt !== null && nextRefreshAvailableAt > now@@ -110,6 +121,17 @@ const UnifiedHealthScene = (): JSX.Element => {<div className="flex items-center justify-between -mt-2 mb-2"><p className="text-sm mb-0">See an at-a-glance view of the health of your project.</p><div className="flex items-center gap-1">+ {healthAlertsEnabled && (+ <LemonButton+ icon={<IconBell />}+ type="secondary"+ size="small"+ to={urls.healthAlerts()}+ tooltip="Subscribe to alerts when any health check fires"+ >+ Alerts+ </LemonButton>+ )}<LemonButtonicon={<IconSupport />}type="secondary"diff --git a/frontend/src/scenes/health/pipelineStatus/PipelineStatusScene.tsx b/frontend/src/scenes/health/pipelineStatus/PipelineStatusScene.tsxindex 1cfc415fd73f..a90f05d5437a 100644--- a/frontend/src/scenes/health/pipelineStatus/PipelineStatusScene.tsx+++ b/frontend/src/scenes/health/pipelineStatus/PipelineStatusScene.tsx@@ -1,11 +1,15 @@import { useActions, useValues } from 'kea'+import posthog from 'posthog-js'-import { IconRefresh } from '@posthog/icons'+import { IconBell, IconRefresh } from '@posthog/icons'+import { FEATURE_FLAGS } from 'lib/constants'import { LemonBanner } from 'lib/lemon-ui/LemonBanner'import { LemonButton } from 'lib/lemon-ui/LemonButton'import { LemonSkeleton } from 'lib/lemon-ui/LemonSkeleton'+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { SceneExport } from 'scenes/sceneTypes'+import { urls } from 'scenes/urls'import { SceneContent } from '~/layout/scenes/components/SceneContent'import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'@@ -27,6 +31,8 @@ export function PipelineStatusScene(): JSX.Element {const { loadHealthIssues } = useActions(pipelineHealthLogic)const { filteredIssues, filteredIssueCount, isIssueDismissed } = useValues(pipelineStatusSceneLogic)const { dismissIssue, undismissIssue } = useActions(pipelineStatusSceneLogic)+ const { featureFlags } = useValues(featureFlagLogic)+ const healthAlertsEnabled = !!featureFlags[FEATURE_FLAGS.HEALTH_ALERTS]return (<SceneContent>@@ -38,15 +44,33 @@ export function PipelineStatusScene(): JSX.Element {type: 'pipeline_status',}}actions={- <LemonButton- type="primary"- size="small"- icon={<IconRefresh className="size-4" />}- disabledReason={healthIssuesLoading ? 'Refreshing...' : undefined}- onClick={() => loadHealthIssues()}- >- {healthIssuesLoading ? 'Refreshing...' : 'Refresh'}- </LemonButton>+ <>+ {healthAlertsEnabled && (+ <LemonButton+ type="secondary"+ size="small"+ icon={<IconBell className="size-4" />}+ to={urls.healthAlerts(['external_data_failure', 'materialized_view_failure'])}+ onClick={() => {+ posthog.capture('health_alerts_entry_point_clicked', {+ source: 'pipeline_status',+ })+ }}+ tooltip="Subscribe to alerts when a pipeline fails"+ >+ Alerts+ </LemonButton>+ )}+ <LemonButton+ type="primary"+ size="small"+ icon={<IconRefresh className="size-4" />}+ disabledReason={healthIssuesLoading ? 'Refreshing...' : undefined}+ onClick={() => loadHealthIssues()}+ >+ {healthIssuesLoading ? 'Refreshing...' : 'Refresh'}+ </LemonButton>+ </>}/>diff --git a/frontend/src/scenes/hog-functions/AlertWizard/alertWizardLogic.test.ts b/frontend/src/scenes/hog-functions/AlertWizard/alertWizardLogic.test.tsindex 4274a910a32c..d2f260d44286 100644--- a/frontend/src/scenes/hog-functions/AlertWizard/alertWizardLogic.test.ts+++ b/frontend/src/scenes/hog-functions/AlertWizard/alertWizardLogic.test.ts@@ -1,6 +1,6 @@import { CyclotronJobFiltersType, PropertyFilterType, PropertyOperator } from '~/types'-import { applyKindFilter } from './alertWizardLogic'+import { applyKindFilter, decorateAlertName } from './alertWizardLogic'describe('applyKindFilter', () => {const baseFilters: CyclotronJobFiltersType = {@@ -18,45 +18,40 @@ describe('applyKindFilter', () => {expect(applyKindFilter(undefined, ['sdk_outdated'])).toBeUndefined()})- it('adds a kind IN (...) property filter on the first event', () => {+ it('adds a top-level kind IN (...) property filter', () => {const result = applyKindFilter(baseFilters, ['sdk_outdated', 'ingestion_warning'])expect(result?.events?.[0]).toEqual({id: '$health_check_issue_firing',type: 'events',- properties: [- {- key: 'kind',- value: ['sdk_outdated', 'ingestion_warning'],- operator: PropertyOperator.Exact,- type: PropertyFilterType.Event,- },- ],})+ expect(result?.properties).toEqual([+ {+ key: 'kind',+ value: ['sdk_outdated', 'ingestion_warning'],+ operator: PropertyOperator.Exact,+ type: PropertyFilterType.Event,+ },+ ])})- it('replaces any existing properties on the first event', () => {+ it('replaces any existing top-level properties', () => {const withProps: CyclotronJobFiltersType = {- events: [+ ...baseFilters,+ properties: [{- id: '$health_check_issue_firing',- type: 'events',- properties: [- {- key: 'some_other',- value: 'x',- operator: PropertyOperator.Exact,- type: PropertyFilterType.Event,- },- ],+ key: 'some_other',+ value: 'x',+ operator: PropertyOperator.Exact,+ type: PropertyFilterType.Event,},],}const result = applyKindFilter(withProps, ['sdk_outdated'])- expect(result?.events?.[0].properties).toHaveLength(1)- expect(result?.events?.[0].properties?.[0].key).toBe('kind')+ expect(result?.properties).toHaveLength(1)+ expect(result?.properties?.[0].key).toBe('kind')})- it('does not touch additional events past the first', () => {+ it('leaves events untouched', () => {const twoEvents: CyclotronJobFiltersType = {events: [{ id: '$health_check_issue_firing', type: 'events' },@@ -64,6 +59,34 @@ describe('applyKindFilter', () => {],}const result = applyKindFilter(twoEvents, ['sdk_outdated'])- expect(result?.events?.[1]).toEqual({ id: '$other_event', type: 'events' })+ expect(result?.events).toEqual(twoEvents.events)+ })+})++describe('decorateAlertName', () => {+ const baseName = 'Email when a Health check fires'++ it.each([+ ['null', null],+ ['undefined', undefined],+ ['an empty array', [] as string[]],+ ])('returns the base name unchanged when selectedKinds is %s', (_, kinds) => {+ expect(decorateAlertName(baseName, kinds)).toBe(baseName)+ })++ it('appends a single kind label in parens', () => {+ expect(decorateAlertName(baseName, ['sdk_outdated'])).toBe('Email when a Health check fires (SDK outdated)')+ })++ it('joins multiple kind labels with commas', () => {+ expect(decorateAlertName(baseName, ['external_data_failure', 'materialized_view_failure'])).toBe(+ 'Email when a Health check fires (External data failures, Materialized view failure)'+ )+ })++ it('falls back to the raw kind when no label is registered', () => {+ expect(decorateAlertName(baseName, ['some_future_kind'])).toBe(+ 'Email when a Health check fires (some_future_kind)'+ )})})diff --git a/frontend/src/scenes/hog-functions/AlertWizard/alertWizardLogic.ts b/frontend/src/scenes/hog-functions/AlertWizard/alertWizardLogic.tsindex 6f382ad4426a..dcb4c1c5357a 100644--- a/frontend/src/scenes/hog-functions/AlertWizard/alertWizardLogic.ts+++ b/frontend/src/scenes/hog-functions/AlertWizard/alertWizardLogic.ts@@ -6,6 +6,7 @@ import posthog from 'posthog-js'import { lemonToast } from '@posthog/lemon-ui'import api from 'lib/api'+import { HealthIssueKind, KIND_LABELS } from 'scenes/health/healthCategories'import {HOG_FUNCTION_SUB_TEMPLATES,HOG_FUNCTION_SUB_TEMPLATE_COMMON_PROPERTIES,@@ -75,10 +76,15 @@ function hasSubTemplateForDestination(return subTemplates?.some((t) => t.template_id === destination.templateId) ?? false}-// Pre-applies `kind IN (selectedKinds)` to the first event of the sub-template's-// filter group. A null or empty `selectedKinds` leaves filters untouched (matches-// every kind). Used by the health-alerts family so a per-page entry point can-// scope the resulting HogFunction to specific kinds.+// Pre-applies `kind IN (selectedKinds)` as a top-level property filter on the+// sub-template's filter group. A null or empty `selectedKinds` leaves filters+// untouched (matches every kind). Used by the health-alerts family so a per-page+// entry point can scope the resulting HogFunction to specific kinds.+//+// Top-level (vs `events[0].properties`) matches the convention of the trigger+// UI in HogFunctionFiltersInternal, so the kind filter remains visible and+// editable on the new-function page, and survives a trigger change (which+// rewrites `events`).export function applyKindFilter(baseFilters: CyclotronJobFiltersType | null | undefined,selectedKinds: string[] | null@@ -86,30 +92,35 @@ export function applyKindFilter(if (!baseFilters || !selectedKinds || selectedKinds.length === 0) {return baseFilters}- const events = baseFilters.events ?? []- const firstEvent = events[0]- if (!firstEvent) {- return baseFilters- }return {...baseFilters,- events: [+ properties: [{- ...firstEvent,- properties: [- {- key: 'kind',- value: selectedKinds,- operator: PropertyOperator.Exact,- type: PropertyFilterType.Event,- },- ],+ key: 'kind',+ value: selectedKinds,+ operator: PropertyOperator.Exact,+ type: PropertyFilterType.Event,},- ...events.slice(1),],}}+// Renders a selectedKinds list as a short, human-readable parenthetical suffix+// (e.g. "(SDK outdated)" or "(SDK outdated, External data failures)") that can+// be appended to a sub-template's generic name/description, so the created+// HogFunction is immediately identifiable in lists.+function formatKindsSuffix(selectedKinds: string[] | null | undefined): string {+ if (!selectedKinds || selectedKinds.length === 0) {+ return ''+ }+ const labels = selectedKinds.map((k) => KIND_LABELS[k as HealthIssueKind] ?? k)+ return ` (${labels.join(', ')})`+}++export function decorateAlertName(baseName: string, selectedKinds: string[] | null | undefined): string {+ return `${baseName}${formatKindsSuffix(selectedKinds)}`+}+function extractDestinationKeyFromAlert(alert: HogFunctionType, allDestinations: WizardDestination[]): string | null {const templateId = alert.template?.idif (!templateId) {@@ -486,12 +497,14 @@ export const alertWizardLogic = kea<alertWizardLogicType>([}const filters = applyKindFilter(subTemplate.filters, values.selectedKinds)+ const name = decorateAlertName(subTemplate.name ?? '', values.selectedKinds)+ const description = decorateAlertName(subTemplate.description ?? '', values.selectedKinds)const configuration: Record<string, any> = {type: 'internal_destination',template_id: destination.templateId,- name: subTemplate.name,- description: subTemplate.description,+ name,+ description,filters,enabled: true,masking: null,diff --git a/frontend/src/scenes/hog-functions/filters/HogFunctionFiltersInternal.tsx b/frontend/src/scenes/hog-functions/filters/HogFunctionFiltersInternal.tsxindex b3e299e6d028..d289dc11c068 100644--- a/frontend/src/scenes/hog-functions/filters/HogFunctionFiltersInternal.tsx+++ b/frontend/src/scenes/hog-functions/filters/HogFunctionFiltersInternal.tsx@@ -65,6 +65,17 @@ export const getProductEventFilterOptions = (contextId: HogFunctionConfigurationvalue: '$discussion_mention_created',},]+ case 'health-alerts':+ return [+ {+ label: 'Health check fired',+ value: '$health_check_issue_firing',+ },+ {+ label: 'Health check resolved',+ value: '$health_check_issue_resolved',+ },+ ]default:return [{@@ -143,6 +154,8 @@ export function HogFunctionFiltersInternal(): JSX.Element {return [TaxonomicFilterGroupType.ActivityLogProperties]} else if (contextId === 'logs-alerting') {return [TaxonomicFilterGroupType.EventProperties]+ } else if (contextId === 'health-alerts') {+ return [TaxonomicFilterGroupType.EventProperties]}return []}, [contextId])diff --git a/frontend/src/scenes/hog-functions/list/LinkedHogFunctions.tsx b/frontend/src/scenes/hog-functions/list/LinkedHogFunctions.tsxindex 80469683626e..11f2805f901f 100644--- a/frontend/src/scenes/hog-functions/list/LinkedHogFunctions.tsx+++ b/frontend/src/scenes/hog-functions/list/LinkedHogFunctions.tsx@@ -44,13 +44,14 @@ export function LinkedHogFunctions({const templateType = type === 'internal_destination' ? 'destination' : typeconst getConfigurationOverrides = (- subTemplateId?: HogFunctionSubTemplateIdType- ): CyclotronJobFiltersType | undefined => {+ subTemplateId: HogFunctionSubTemplateIdType | undefined+ ): { filters: CyclotronJobFiltersType } | undefined => {if (forceFilterGroups && forceFilterGroups.length > 0) {- return forceFilterGroups[0]+ return { filters: forceFilterGroups[0] }}if (subTemplateId) {- return getFiltersFromSubTemplateId(subTemplateId)+ const filters = getFiltersFromSubTemplateId(subTemplateId)+ return filters ? { filters } : undefined}return undefined}diff --git a/frontend/src/scenes/hog-functions/list/hogFunctionTemplateListLogic.test.ts b/frontend/src/scenes/hog-functions/list/hogFunctionTemplateListLogic.test.tsindex 82f67a18278a..417f277eb5da 100644--- a/frontend/src/scenes/hog-functions/list/hogFunctionTemplateListLogic.test.ts+++ b/frontend/src/scenes/hog-functions/list/hogFunctionTemplateListLogic.test.ts@@ -15,7 +15,7 @@ describe('hogFunctionTemplateListLogic - configuration structure', () => {it('should wrap filters in configuration object, not spread at top level', () => {const alertId = 'test-alert-id-123'- const getConfigurationOverrides = (): CyclotronJobFiltersType => ({+ const filters: CyclotronJobFiltersType = {properties: [{key: 'alert_id',@@ -25,7 +25,8 @@ describe('hogFunctionTemplateListLogic - configuration structure', () => {},],events: [{ id: '$insight_alert_firing', type: 'events' as const }],- })+ }+ const getConfigurationOverrides = (): { filters: CyclotronJobFiltersType } => ({ filters })const logic = hogFunctionTemplateListLogic.build({type: 'destination',diff --git a/frontend/src/scenes/hog-functions/list/hogFunctionTemplateListLogic.tsx b/frontend/src/scenes/hog-functions/list/hogFunctionTemplateListLogic.tsxindex f79ec5578d9b..a53658a995d7 100644--- a/frontend/src/scenes/hog-functions/list/hogFunctionTemplateListLogic.tsx+++ b/frontend/src/scenes/hog-functions/list/hogFunctionTemplateListLogic.tsx@@ -15,8 +15,8 @@ import { urls } from 'scenes/urls'import { userLogic } from 'scenes/userLogic'import {- CyclotronJobFiltersType,HogFunctionSubTemplateIdType,+ HogFunctionSubTemplateType,HogFunctionTemplateType,HogFunctionTemplateWithSubTemplateType,HogFunctionTypeType,@@ -42,8 +42,18 @@ export type HogFunctionTemplateListLogicProps = {additionalTypes?: HogFunctionTypeType[]/** If provided, only those templates will be shown */subTemplateIds?: HogFunctionSubTemplateIdType[] | null- /** Overrides to be used when creating a new hog function */- getConfigurationOverrides?: (subTemplateId?: HogFunctionSubTemplateIdType) => CyclotronJobFiltersType | undefined+ /**+ * Overrides to merge into the sub-template before building the new-function URL.+ * Common fields: `filters` (merged with the sub-template's defaults), `name`,+ * `description`. Anything else returned overrides the matching field on the+ * sub-template. The resolved sub-template is passed as the second argument so+ * callers that need to decorate the sub-template's own name/description (e.g.+ * health alerts adding the selected `kind` to the name) can do so.+ */+ getConfigurationOverrides?: (+ subTemplateId: HogFunctionSubTemplateIdType | undefined,+ subTemplate: HogFunctionSubTemplateType | null+ ) => Partial<HogFunctionSubTemplateType> | undefinedsyncFiltersWithUrl?: booleanmanualTemplates?: HogFunctionTemplateType[] | nullmanualTemplatesLoading?: boolean@@ -261,21 +271,22 @@ export const hogFunctionTemplateListLogic = kea<hogFunctionTemplateListLogicType? getSubTemplate(template, template.sub_template_id): null- const configurationOverrides = getConfigurationOverrides- ? getConfigurationOverrides(subTemplate?.sub_template_id)- : null+ const overrides = getConfigurationOverrides+ ? getConfigurationOverrides(subTemplate?.sub_template_id, subTemplate)+ : undefined- const filters =- configurationOverrides || subTemplate?.filters+ const mergedFilters =+ overrides?.filters || subTemplate?.filters? {...subTemplate?.filters,- ...configurationOverrides,+ ...overrides?.filters,}: undefinedconst configuration: Record<string, any> = {...subTemplate,- ...(filters ? { filters } : {}),+ ...overrides,+ ...(mergedFilters ? { filters: mergedFilters } : {}),}return combineUrl(urls.hogFunctionNew(template.id), queryParams ?? {}, {diff --git a/frontend/src/scenes/onboarding/sdks/SdkDoctorScene.tsx b/frontend/src/scenes/onboarding/sdks/SdkDoctorScene.tsxindex 5c3e6ca5201f..81e4586291bb 100644--- a/frontend/src/scenes/onboarding/sdks/SdkDoctorScene.tsx+++ b/frontend/src/scenes/onboarding/sdks/SdkDoctorScene.tsx@@ -1,13 +1,16 @@import { useActions, useValues } from 'kea'import posthog from 'posthog-js'-import { IconRefresh } from '@posthog/icons'+import { IconBell, IconRefresh } from '@posthog/icons'import { LemonBanner, LemonButton, LemonTag, Link } from '@posthog/lemon-ui'+import { FEATURE_FLAGS } from 'lib/constants'import { useOnMountEffect } from 'lib/hooks/useOnMountEffect'+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { inStorybook, inStorybookTestRunner } from 'lib/utils'import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'import { SceneExport } from 'scenes/sceneTypes'+import { urls } from 'scenes/urls'import { SceneContent } from '~/layout/scenes/components/SceneContent'import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'@@ -31,6 +34,8 @@ export function SdkDoctorScene(): JSX.Element {snoozedUntil,} = useValues(sdkDoctorLogic)const { isDev } = useValues(preflightLogic)+ const { featureFlags } = useValues(featureFlagLogic)+ const healthAlertsEnabled = !!featureFlags[FEATURE_FLAGS.HEALTH_ALERTS]const { loadRawData, snoozeSdkDoctor } = useActions(sdkDoctorLogic)@@ -59,6 +64,20 @@ export function SdkDoctorScene(): JSX.Element {}}actions={<>+ {healthAlertsEnabled && (+ <LemonButton+ size="small"+ type="secondary"+ to={urls.healthAlerts(['sdk_outdated'])}+ onClick={() => {+ posthog.capture('health_alerts_entry_point_clicked', { source: 'sdk_doctor' })+ }}+ icon={<IconBell className="size-4" />}+ tooltip="Subscribe to alerts when SDKs go outdated"+ >+ Alerts+ </LemonButton>+ )}<LemonButtonsize="small"type="primary"diff --git a/frontend/src/scenes/urls.ts b/frontend/src/scenes/urls.tsindex feaae9373f55..a9c6258700db 100644--- a/frontend/src/scenes/urls.ts+++ b/frontend/src/scenes/urls.ts@@ -288,7 +288,10 @@ export const urls = {approval: (id: string): string => `/approvals/${id}`,health: (): string => '/health',healthCategory: (category: string): string => `/health/${category}`,- healthAlerts: (): string => '/health/alerts',+ healthAlerts: (presetKinds?: string[]): string =>+ presetKinds && presetKinds.length > 0+ ? `/health/alerts?preset_kinds=${encodeURIComponent(presetKinds.join(','))}`+ : '/health/alerts',inbox: (reportId?: string): string => `/inbox${reportId ? `/${reportId}` : ''}`,webAnalyticsBotAnalytics: (): string => '/web/bots',webAnalyticsHealth: (): string => '/web/health',diff --git a/products/cdp/backend/temporal/health_checks/ingestion_warnings.py b/products/cdp/backend/temporal/health_checks/ingestion_warnings.pyindex db2d06f27e52..97b3950083f4 100644--- a/products/cdp/backend/temporal/health_checks/ingestion_warnings.py+++ b/products/cdp/backend/temporal/health_checks/ingestion_warnings.py@@ -3,7 +3,7 @@ import structlogfrom posthog.dags.common.owners import JobOwnersfrom posthog.models.health_issue import HealthIssuefrom posthog.temporal.health_checks.detectors import CLICKHOUSE_BATCH_EXECUTION_POLICY-from posthog.temporal.health_checks.framework import HealthCheck+from posthog.temporal.health_checks.framework import AlertContent, HealthCheckfrom posthog.temporal.health_checks.models import HealthCheckResultfrom posthog.temporal.health_checks.query import execute_clickhouse_health_team_query@@ -46,6 +46,13 @@ class IngestionWarningsCheck(HealthCheck):schedule = "0 7 * * *"active_since_days = 30+ @classmethod+ def render_alert(cls, issue: HealthIssue) -> AlertContent:+ warning_type = issue.payload.get("warning_type", "ingestion warning")+ count = issue.payload.get("affected_count")+ summary = f"{warning_type} fired {count} times" if count is not None else f"{warning_type} detected"+ return AlertContent(title="Ingestion warning detected", summary=summary, link="/health/ingestion")+def detect(self, team_ids: list[int]) -> dict[int, list[HealthCheckResult]]:rows = execute_clickhouse_health_team_query(INGESTION_WARNINGS_SQL,diff --git a/products/data_warehouse/backend/temporal/health_checks/external_data_failure.py b/products/data_warehouse/backend/temporal/health_checks/external_data_failure.pyindex d5b277a68f79..d4b2dc6b1ef4 100644--- a/products/data_warehouse/backend/temporal/health_checks/external_data_failure.py+++ b/products/data_warehouse/backend/temporal/health_checks/external_data_failure.py@@ -3,7 +3,7 @@ from django.db.models import Qfrom posthog.dags.common.owners import JobOwnersfrom posthog.models.health_issue import HealthIssuefrom posthog.temporal.health_checks.detectors import DEFAULT_EXECUTION_POLICY-from posthog.temporal.health_checks.framework import HealthCheck+from posthog.temporal.health_checks.framework import AlertContent, HealthCheckfrom posthog.temporal.health_checks.models import HealthCheckResultfrom products.warehouse_sources.backend.models.external_data_schema import ExternalDataSchema@@ -17,6 +17,15 @@ class ExternalDataFailureCheck(HealthCheck):schedule = "15 7 * * *"active_since_days = 30+ @classmethod+ def render_alert(cls, issue: HealthIssue) -> AlertContent:+ name = issue.payload.get("pipeline_name") or issue.payload.get("source_type", "an external data sync")+ return AlertContent(+ title="External data sync failed",+ summary=f"{name} is failing to sync",+ link="/health/pipeline-status",+ )+def detect(self, team_ids: list[int]) -> dict[int, list[HealthCheckResult]]:issues: dict[int, list[HealthCheckResult]] = {}diff --git a/products/data_warehouse/backend/temporal/health_checks/materialized_view_failure.py b/products/data_warehouse/backend/temporal/health_checks/materialized_view_failure.pyindex 64aa74c6cdca..66528b47337a 100644--- a/products/data_warehouse/backend/temporal/health_checks/materialized_view_failure.py+++ b/products/data_warehouse/backend/temporal/health_checks/materialized_view_failure.py@@ -3,7 +3,7 @@ from django.db.models import Qfrom posthog.dags.common.owners import JobOwnersfrom posthog.models.health_issue import HealthIssuefrom posthog.temporal.health_checks.detectors import DEFAULT_EXECUTION_POLICY-from posthog.temporal.health_checks.framework import HealthCheck+from posthog.temporal.health_checks.framework import AlertContent, HealthCheckfrom posthog.temporal.health_checks.models import HealthCheckResultfrom products.data_modeling.backend.models.datawarehouse_saved_query import DataWarehouseSavedQuery@@ -17,6 +17,15 @@ class MaterializedViewFailureCheck(HealthCheck):schedule = "30 7 * * *"active_since_days = 30+ @classmethod+ def render_alert(cls, issue: HealthIssue) -> AlertContent:+ name = issue.payload.get("pipeline_name", "a materialized view")+ return AlertContent(+ title="Materialized view failed",+ summary=f"{name} failed to refresh",+ link="/health/data_modeling",+ )+def detect(self, team_ids: list[int]) -> dict[int, list[HealthCheckResult]]:queryset = (DataWarehouseSavedQuery.objects.filter(diff --git a/products/error_tracking/frontend/scenes/ErrorTrackingConfigurationScene/alerting/ErrorTrackingAlerting.tsx b/products/error_tracking/frontend/scenes/ErrorTrackingConfigurationScene/alerting/ErrorTrackingAlerting.tsxindex 0927309ecab8..625be28c2e5d 100644--- a/products/error_tracking/frontend/scenes/ErrorTrackingConfigurationScene/alerting/ErrorTrackingAlerting.tsx+++ b/products/error_tracking/frontend/scenes/ErrorTrackingConfigurationScene/alerting/ErrorTrackingAlerting.tsx@@ -67,7 +67,7 @@ function ErrorTrackingAlertingInner(): JSX.Element {<HogFunctionTemplateListtype="destination"subTemplateIds={subTemplateIds}- getConfigurationOverrides={(id) => (id ? getFiltersFromSubTemplateId(id) : undefined)}+ getConfigurationOverrides={(id) => (id ? { filters: getFiltersFromSubTemplateId(id) } : undefined)}extraControls={<LemonButtontype="secondary"diff --git a/products/web_analytics/backend/temporal/health_checks/authorized_urls.py b/products/web_analytics/backend/temporal/health_checks/authorized_urls.pyindex 0c19f916fdc7..d95004d4a214 100644--- a/products/web_analytics/backend/temporal/health_checks/authorized_urls.py+++ b/products/web_analytics/backend/temporal/health_checks/authorized_urls.py@@ -4,7 +4,7 @@ from posthog.dags.common.owners import JobOwnersfrom posthog.models.health_issue import HealthIssuefrom posthog.models.team import Teamfrom posthog.temporal.health_checks.detectors import DEFAULT_EXECUTION_POLICY-from posthog.temporal.health_checks.framework import HealthCheck+from posthog.temporal.health_checks.framework import AlertContent, HealthCheckfrom posthog.temporal.health_checks.models import HealthCheckResult@@ -16,6 +16,14 @@ class AuthorizedUrlsCheck(HealthCheck):schedule = "15 8 * * *"active_since_days = 30+ @classmethod+ def render_alert(cls, issue: HealthIssue) -> AlertContent:+ return AlertContent(+ title="No authorized URLs configured",+ summary=issue.payload.get("reason", "Authorized URLs are not set"),+ link="/web/health",+ )+def detect(self, team_ids: list[int]) -> dict[int, list[HealthCheckResult]]:teams_missing_urls = (Team.objects.filter(diff --git a/products/web_analytics/backend/temporal/health_checks/no_live_events.py b/products/web_analytics/backend/temporal/health_checks/no_live_events.pyindex e8e2b0f960e3..85f0d66de899 100644--- a/products/web_analytics/backend/temporal/health_checks/no_live_events.py+++ b/products/web_analytics/backend/temporal/health_checks/no_live_events.py@@ -2,7 +2,7 @@ from posthog.clickhouse.query_tagging import Productfrom posthog.dags.common.owners import JobOwnersfrom posthog.models.health_issue import HealthIssuefrom posthog.temporal.health_checks.detectors import CLICKHOUSE_BATCH_EXECUTION_POLICY-from posthog.temporal.health_checks.framework import HealthCheck+from posthog.temporal.health_checks.framework import AlertContent, HealthCheckfrom posthog.temporal.health_checks.models import HealthCheckResultfrom posthog.temporal.health_checks.query import execute_clickhouse_health_team_query@@ -26,6 +26,14 @@ class NoLiveEventsCheck(HealthCheck):schedule = "30 4 * * *"active_since_days = 30+ @classmethod+ def render_alert(cls, issue: HealthIssue) -> AlertContent:+ return AlertContent(+ title="No live events",+ summary=issue.payload.get("reason", "No $pageview or $screen events received recently"),+ link="/web/health",+ )+def detect(self, team_ids: list[int]) -> dict[int, list[HealthCheckResult]]:rows = execute_clickhouse_health_team_query(NO_LIVE_EVENTS_SQL,diff --git a/products/web_analytics/backend/temporal/health_checks/no_pageleave_events.py b/products/web_analytics/backend/temporal/health_checks/no_pageleave_events.pyindex 35787b385b89..c19f95acf3e2 100644--- a/products/web_analytics/backend/temporal/health_checks/no_pageleave_events.py+++ b/products/web_analytics/backend/temporal/health_checks/no_pageleave_events.py@@ -2,7 +2,7 @@ from posthog.clickhouse.query_tagging import Productfrom posthog.dags.common.owners import JobOwnersfrom posthog.models.health_issue import HealthIssuefrom posthog.temporal.health_checks.detectors import CLICKHOUSE_BATCH_EXECUTION_POLICY-from posthog.temporal.health_checks.framework import HealthCheck+from posthog.temporal.health_checks.framework import AlertContent, HealthCheckfrom posthog.temporal.health_checks.models import HealthCheckResultfrom posthog.temporal.health_checks.query import execute_clickhouse_health_team_query@@ -28,6 +28,14 @@ class NoPageleaveEventsCheck(HealthCheck):schedule = "30 3 * * *"active_since_days = 30+ @classmethod+ def render_alert(cls, issue: HealthIssue) -> AlertContent:+ return AlertContent(+ title="No $pageleave events",+ summary=issue.payload.get("reason", "$pageview events present but no $pageleave events"),+ link="/web/health",+ )+def detect(self, team_ids: list[int]) -> dict[int, list[HealthCheckResult]]:rows = execute_clickhouse_health_team_query(NO_PAGELEAVE_SQL,diff --git a/products/web_analytics/backend/temporal/health_checks/partial_proxy.py b/products/web_analytics/backend/temporal/health_checks/partial_proxy.pyindex a08b0b55357d..fd2ba7863eeb 100644--- a/products/web_analytics/backend/temporal/health_checks/partial_proxy.py+++ b/products/web_analytics/backend/temporal/health_checks/partial_proxy.py@@ -4,7 +4,7 @@ from collections import defaultdictfrom posthog.dags.common.owners import JobOwnersfrom posthog.models.health_issue import HealthIssuefrom posthog.temporal.health_checks.detectors import CLICKHOUSE_BATCH_EXECUTION_POLICY-from posthog.temporal.health_checks.framework import HealthCheck+from posthog.temporal.health_checks.framework import AlertContent, HealthCheckfrom posthog.temporal.health_checks.models import HealthCheckResultfrom posthog.temporal.health_checks.query import execute_clickhouse_health_team_query@@ -48,6 +48,16 @@ class PartialProxyCheck(HealthCheck):schedule = "45 6 * * *"active_since_days = 30+ @classmethod+ def render_alert(cls, issue: HealthIssue) -> AlertContent:+ unproxied = issue.payload.get("unproxied_hosts") or []+ summary = (+ f"{len(unproxied)} host(s) lack a reverse proxy: {', '.join(unproxied[:3])}"+ if unproxied+ else issue.payload.get("reason", "Reverse proxy is only configured on some hostnames")+ )+ return AlertContent(title="Partial reverse-proxy coverage", summary=summary, link="/web/health")+def detect(self, team_ids: list[int]) -> dict[int, list[HealthCheckResult]]:rows = execute_clickhouse_health_team_query(PARTIAL_PROXY_SQL,diff --git a/products/web_analytics/backend/temporal/health_checks/reverse_proxy.py b/products/web_analytics/backend/temporal/health_checks/reverse_proxy.pyindex 5925971bb209..6f66ecedc6cd 100644--- a/products/web_analytics/backend/temporal/health_checks/reverse_proxy.py+++ b/products/web_analytics/backend/temporal/health_checks/reverse_proxy.py@@ -1,7 +1,7 @@from posthog.dags.common.owners import JobOwnersfrom posthog.models.health_issue import HealthIssuefrom posthog.temporal.health_checks.detectors import CLICKHOUSE_BATCH_EXECUTION_POLICY-from posthog.temporal.health_checks.framework import HealthCheck+from posthog.temporal.health_checks.framework import AlertContent, HealthCheckfrom posthog.temporal.health_checks.models import HealthCheckResultfrom posthog.temporal.health_checks.query import execute_clickhouse_health_team_query@@ -25,6 +25,14 @@ class ReverseProxyCheck(HealthCheck):schedule = "30 6 * * *"active_since_days = 30+ @classmethod+ def render_alert(cls, issue: HealthIssue) -> AlertContent:+ return AlertContent(+ title="No reverse proxy detected",+ summary=issue.payload.get("reason", "Ad blockers may affect tracking accuracy"),+ link="/web/health",+ )+def detect(self, team_ids: list[int]) -> dict[int, list[HealthCheckResult]]:rows = execute_clickhouse_health_team_query(REVERSE_PROXY_SQL,diff --git a/products/web_analytics/backend/temporal/health_checks/scroll_depth.py b/products/web_analytics/backend/temporal/health_checks/scroll_depth.pyindex 98b848e78086..bb7b4dbc1094 100644--- a/products/web_analytics/backend/temporal/health_checks/scroll_depth.py+++ b/products/web_analytics/backend/temporal/health_checks/scroll_depth.py@@ -1,7 +1,7 @@from posthog.dags.common.owners import JobOwnersfrom posthog.models.health_issue import HealthIssuefrom posthog.temporal.health_checks.detectors import CLICKHOUSE_BATCH_EXECUTION_POLICY-from posthog.temporal.health_checks.framework import HealthCheck+from posthog.temporal.health_checks.framework import AlertContent, HealthCheckfrom posthog.temporal.health_checks.models import HealthCheckResultfrom posthog.temporal.health_checks.query import execute_clickhouse_health_team_query@@ -25,6 +25,14 @@ class ScrollDepthCheck(HealthCheck):schedule = "0 1 * * *"active_since_days = 30+ @classmethod+ def render_alert(cls, issue: HealthIssue) -> AlertContent:+ return AlertContent(+ title="Scroll-depth tracking disabled",+ summary=issue.payload.get("reason", "$pageleave events have no scroll-depth metadata"),+ link="/web/health",+ )+def detect(self, team_ids: list[int]) -> dict[int, list[HealthCheckResult]]:rows = execute_clickhouse_health_team_query(SCROLL_DEPTH_SQL,diff --git a/products/web_analytics/backend/temporal/health_checks/web_vitals.py b/products/web_analytics/backend/temporal/health_checks/web_vitals.pyindex 1612b6ca8315..13855d1e0d8f 100644--- a/products/web_analytics/backend/temporal/health_checks/web_vitals.py+++ b/products/web_analytics/backend/temporal/health_checks/web_vitals.py@@ -1,7 +1,7 @@from posthog.dags.common.owners import JobOwnersfrom posthog.models.health_issue import HealthIssuefrom posthog.temporal.health_checks.detectors import CLICKHOUSE_BATCH_EXECUTION_POLICY-from posthog.temporal.health_checks.framework import HealthCheck+from posthog.temporal.health_checks.framework import AlertContent, HealthCheckfrom posthog.temporal.health_checks.models import HealthCheckResultfrom posthog.temporal.health_checks.query import execute_clickhouse_health_team_query@@ -26,6 +26,14 @@ class WebVitalsCheck(HealthCheck):schedule = "30 5 * * *"active_since_days = 30+ @classmethod+ def render_alert(cls, issue: HealthIssue) -> AlertContent:+ return AlertContent(+ title="No web vitals events",+ summary=issue.payload.get("reason", "$web_vitals events are not being received"),+ link="/web/health",+ )+def detect(self, team_ids: list[int]) -> dict[int, list[HealthCheckResult]]:rows = execute_clickhouse_health_team_query(WEB_VITALS_SQL,