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.

732 B
Raw Blame
// Mirror of `products/cdp/backend/internal_events.py`. The managed-alert event boundary and the legacy
// insight-alert exemption must match the Python side exactly, so keep the two in sync.
export const MANAGED_ALERT_EVENT_PATTERN =
    /^\$[a-z0-9_]+_alert_(firing|resolved|errored|auto_disabled|match|incident_opened|incident_closed)$/
export const LEGACY_INSIGHT_ALERT_EVENT = '$insight_alert_firing'

/** Return whether an internal event is reserved for an alert-owned destination. */
export function isManagedAlertInternalEvent(eventName: unknown): boolean {
    return (
        typeof eventName === 'string' &&
        eventName !== LEGACY_INSIGHT_ALERT_EVENT &&
        MANAGED_ALERT_EVENT_PATTERN.test(eventName)
    )
}