: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(alerts): add real_time to calculation interval choices with migration (#67946)
Matt Puaff73a34a051e
diff --git a/posthog/api/test/test_alert_real_time_interval.py b/posthog/api/test/test_alert_real_time_interval.pynew file mode 100644index 000000000000..0e7caff43121--- /dev/null+++ b/posthog/api/test/test_alert_real_time_interval.py@@ -0,0 +1,191 @@+from datetime import UTC, datetime+from typing import Any++from freezegun import freeze_time+from posthog.test.base import APIBaseTest+from unittest.mock import MagicMock++from rest_framework import status++from posthog.schema import AlertCalculationInterval, AlertConditionType, InsightThresholdType++from posthog.constants import AvailableFeature+from posthog.tasks.alerts.utils import (+ alert_calculation_interval_to_relativedelta,+ calculation_interval_to_order,+ next_check_time,+)++from products.alerts.backend.models.alert import AlertConfiguration+++class TestAlertRealTimeInterval(APIBaseTest):+ def setUp(self):+ super().setUp()+ self.default_insight_data: dict[str, Any] = {+ "query": {+ "kind": "TrendsQuery",+ "series": [+ {+ "kind": "EventsNode",+ "event": "$pageview",+ }+ ],+ "trendsFilter": {"display": "BoldNumber"},+ },+ }+ self.insight = self.client.post(f"/api/projects/{self.team.id}/insights", data=self.default_insight_data).json()++ def _creation_request(self, **overrides: Any) -> dict[str, Any]:+ payload = {+ "insight": self.insight["id"],+ "subscribed_users": [self.user.id],+ "condition": {"type": AlertConditionType.ABSOLUTE_VALUE},+ "config": {"type": "TrendsAlertConfig", "series_index": 0},+ "name": "real time alert",+ "threshold": {"configuration": {"type": InsightThresholdType.ABSOLUTE, "bounds": {"lower": 0}}},+ "calculation_interval": AlertCalculationInterval.REAL_TIME,+ }+ payload.update(overrides)+ return payload++ def _enable_real_time_alerts(self, limit: int | None = None) -> None:+ feature: dict[str, Any] = {"key": AvailableFeature.REAL_TIME_ALERTS, "name": "Real-time alerts"}+ if limit is not None:+ feature["limit"] = limit+ self.organization.available_product_features = [+ *(self.organization.available_product_features or []),+ feature,+ ]+ self.organization.save()++ def test_create_real_time_rejected_without_billing_entitlement(self) -> None:+ response = self.client.post(f"/api/projects/{self.team.id}/alerts", self._creation_request())+ assert response.status_code == status.HTTP_400_BAD_REQUEST+ assert "Scale or Enterprise" in str(response.json())++ def test_create_real_time_succeeds_with_entitlement(self) -> None:+ self._enable_real_time_alerts()+ response = self.client.post(f"/api/projects/{self.team.id}/alerts", self._creation_request())+ assert response.status_code == status.HTTP_201_CREATED, response.content+ assert response.json()["calculation_interval"] == AlertCalculationInterval.REAL_TIME++ def test_patch_real_time_succeeds_with_entitlement(self) -> None:+ self._enable_real_time_alerts()+ create_response = self.client.post(f"/api/projects/{self.team.id}/alerts", self._creation_request())+ alert_id = create_response.json()["id"]++ response = self.client.patch(+ f"/api/projects/{self.team.id}/alerts/{alert_id}",+ {"name": "updated real time alert"},+ )+ assert response.status_code == status.HTTP_200_OK, response.content+ assert response.json()["name"] == "updated real time alert"+ assert response.json()["calculation_interval"] == AlertCalculationInterval.REAL_TIME++ def test_patch_existing_real_time_rejected_after_entitlement_removed(self) -> None:+ self._enable_real_time_alerts()+ create_response = self.client.post(f"/api/projects/{self.team.id}/alerts", self._creation_request())+ alert_id = create_response.json()["id"]++ self.organization.available_product_features = []+ self.organization.save()++ response = self.client.patch(+ f"/api/projects/{self.team.id}/alerts/{alert_id}",+ {"name": "still real time"},+ )+ assert response.status_code == status.HTTP_400_BAD_REQUEST+ assert "Scale or Enterprise" in str(response.json())++ def test_create_real_time_rejected_when_limit_reached(self) -> None:+ self._enable_real_time_alerts(limit=1)+ first = self.client.post(f"/api/projects/{self.team.id}/alerts", self._creation_request())+ assert first.status_code == status.HTTP_201_CREATED, first.content++ second = self.client.post(f"/api/projects/{self.team.id}/alerts", self._creation_request(name="second"))+ assert second.status_code == status.HTTP_400_BAD_REQUEST+ assert "limit of 1 real-time alerts" in str(second.json())++ def test_real_time_limit_ignores_disabled_alerts(self) -> None:+ self._enable_real_time_alerts(limit=1)+ first = self.client.post(f"/api/projects/{self.team.id}/alerts", self._creation_request())+ assert first.status_code == status.HTTP_201_CREATED, first.content++ self.client.patch(+ f"/api/projects/{self.team.id}/alerts/{first.json()['id']}",+ {"enabled": False},+ )++ second = self.client.post(f"/api/projects/{self.team.id}/alerts", self._creation_request(name="second"))+ assert second.status_code == status.HTTP_201_CREATED, second.content++ def test_real_time_limit_ignores_other_intervals(self) -> None:+ self._enable_real_time_alerts(limit=1)+ daily = self.client.post(+ f"/api/projects/{self.team.id}/alerts",+ self._creation_request(name="daily", calculation_interval=AlertCalculationInterval.DAILY),+ )+ assert daily.status_code == status.HTTP_201_CREATED, daily.content++ response = self.client.post(f"/api/projects/{self.team.id}/alerts", self._creation_request())+ assert response.status_code == status.HTTP_201_CREATED, response.content++ def test_patch_to_real_time_rejected_when_limit_reached(self) -> None:+ self._enable_real_time_alerts(limit=1)+ real_time = self.client.post(f"/api/projects/{self.team.id}/alerts", self._creation_request())+ assert real_time.status_code == status.HTTP_201_CREATED, real_time.content++ daily = self.client.post(+ f"/api/projects/{self.team.id}/alerts",+ self._creation_request(name="daily", calculation_interval=AlertCalculationInterval.DAILY),+ )+ assert daily.status_code == status.HTTP_201_CREATED, daily.content++ response = self.client.patch(+ f"/api/projects/{self.team.id}/alerts/{daily.json()['id']}",+ {"calculation_interval": AlertCalculationInterval.REAL_TIME},+ )+ assert response.status_code == status.HTTP_400_BAD_REQUEST+ assert "limit of 1 real-time alerts" in str(response.json())++ def test_enable_real_time_rejected_when_limit_reached(self) -> None:+ self._enable_real_time_alerts(limit=1)+ first = self.client.post(f"/api/projects/{self.team.id}/alerts", self._creation_request())+ assert first.status_code == status.HTTP_201_CREATED, first.content++ disabled = self.client.post(+ f"/api/projects/{self.team.id}/alerts",+ self._creation_request(name="disabled", enabled=False),+ )+ assert disabled.status_code == status.HTTP_201_CREATED, disabled.content++ response = self.client.patch(+ f"/api/projects/{self.team.id}/alerts/{disabled.json()['id']}",+ {"enabled": True},+ )+ assert response.status_code == status.HTTP_400_BAD_REQUEST+ assert "limit of 1 real-time alerts" in str(response.json())+++class TestAlertRealTimeScheduling:+ def test_calculation_interval_to_order_ranks_real_time_first(self) -> None:+ assert calculation_interval_to_order(AlertCalculationInterval.REAL_TIME) < calculation_interval_to_order(+ AlertCalculationInterval.EVERY_15_MINUTES+ )++ def test_alert_calculation_interval_to_relativedelta_real_time(self) -> None:+ delta = alert_calculation_interval_to_relativedelta(AlertCalculationInterval.REAL_TIME)+ assert delta.minutes == 2++ def test_next_check_time_advances_by_2_minutes(self) -> None:+ alert = MagicMock(spec=AlertConfiguration)+ alert.calculation_interval = AlertCalculationInterval.REAL_TIME+ alert.next_check_at = datetime(2026, 4, 6, 14, 0, 0, tzinfo=UTC)+ alert.team = MagicMock()+ alert.team.timezone = "UTC"+ alert.schedule_restriction = None+ alert.skip_weekend = False++ with freeze_time("2026-04-06T14:00:00Z"):+ assert next_check_time(alert) == datetime(2026, 4, 6, 14, 2, 0, tzinfo=UTC)diff --git a/posthog/tasks/alerts/utils.py b/posthog/tasks/alerts/utils.pyindex 7a7cbe8d9810..d913dc2fd851 100644--- a/posthog/tasks/alerts/utils.py+++ b/posthog/tasks/alerts/utils.py@@ -48,16 +48,18 @@ def is_non_time_series_trend(query: TrendsQuery) -> bool:def calculation_interval_to_order(interval: AlertCalculationInterval | None) -> int:match interval:- case AlertCalculationInterval.EVERY_15_MINUTES:+ case AlertCalculationInterval.REAL_TIME:return 0- case AlertCalculationInterval.HOURLY:+ case AlertCalculationInterval.EVERY_15_MINUTES:return 1- case AlertCalculationInterval.DAILY:+ case AlertCalculationInterval.HOURLY:return 2- case AlertCalculationInterval.WEEKLY:+ case AlertCalculationInterval.DAILY:return 3+ case AlertCalculationInterval.WEEKLY:+ return 4case AlertCalculationInterval.MONTHLY:- return 3+ return 4case None:raise ValueError("Invalid alert calculation interval: None")case _ as unreachable:@@ -66,6 +68,8 @@ def calculation_interval_to_order(interval: AlertCalculationInterval | None) ->def alert_calculation_interval_to_relativedelta(alert_calculation_interval: AlertCalculationInterval) -> relativedelta:match alert_calculation_interval:+ case AlertCalculationInterval.REAL_TIME:+ return relativedelta(minutes=2)case AlertCalculationInterval.EVERY_15_MINUTES:return relativedelta(minutes=15)case AlertCalculationInterval.HOURLY:@@ -97,6 +101,8 @@ def _next_check_time_core(alert: AlertConfiguration) -> datetime:team_timezone = pytz.timezone(alert.team.timezone)match alert.calculation_interval:+ case AlertCalculationInterval.REAL_TIME:+ return (alert.next_check_at or now) + relativedelta(minutes=2)case AlertCalculationInterval.EVERY_15_MINUTES:return (alert.next_check_at or now) + relativedelta(minutes=15)case AlertCalculationInterval.HOURLY:diff --git a/posthog/temporal/alerts/activities.py b/posthog/temporal/alerts/activities.pyindex 8be4652b8a3b..5bbfb96dcc4f 100644--- a/posthog/temporal/alerts/activities.py+++ b/posthog/temporal/alerts/activities.py@@ -64,10 +64,11 @@ async def retrieve_due_alerts() -> list[AlertInfo]:# time-sensitive checks get workers first when the due batch is large.# Keep ordering in sync with calculation_interval_to_order in posthog/tasks/alerts/utils.py.calculation_interval_order = Case(- When(calculation_interval=AlertCalculationInterval.EVERY_15_MINUTES.value, then=Value(0)),- When(calculation_interval=AlertCalculationInterval.HOURLY.value, then=Value(1)),- When(calculation_interval=AlertCalculationInterval.DAILY.value, then=Value(2)),- default=Value(3),+ When(calculation_interval=AlertCalculationInterval.REAL_TIME.value, then=Value(0)),+ When(calculation_interval=AlertCalculationInterval.EVERY_15_MINUTES.value, then=Value(1)),+ When(calculation_interval=AlertCalculationInterval.HOURLY.value, then=Value(2)),+ When(calculation_interval=AlertCalculationInterval.DAILY.value, then=Value(3)),+ default=Value(4),output_field=IntegerField(),)diff --git a/products/alerts/backend/api/alert.py b/products/alerts/backend/api/alert.pyindex 73555e4102ee..9bf3e15b9848 100644--- a/products/alerts/backend/api/alert.py+++ b/products/alerts/backend/api/alert.py@@ -61,6 +61,18 @@ def _validate_every_15_minutes_interval(raise ValidationError({"calculation_interval": [error]})+def _validate_real_time_interval(+ *,+ calculation_interval: str | AlertCalculationInterval | None,+ organization,+) -> None:+ if error := AlertConfiguration.real_time_interval_validation_error(+ calculation_interval=calculation_interval,+ organization=organization,+ ):+ raise ValidationError({"calculation_interval": [error]})++def _require_insight_viewer_access(context: dict[str, Any], insight: Insight) -> None:# Team scoping alone doesn't gate per-object insight access controls, so require viewer access# explicitly — alert write/simulate access must not expose a restricted insight's results.@@ -258,7 +270,7 @@ class AlertSerializer(SearchMatchTypeSerializerMixin, serializers.ModelSerializecalculation_interval = serializers.ChoiceField(choices=AlertConfiguration.CALCULATION_INTERVAL_CHOICES,required=False,- help_text="How often the alert is checked: every 15 minutes (Boost+), hourly, daily, weekly, or monthly.",+ help_text="How often the alert is checked: real time (Scale+), every 15 minutes (Boost+), hourly, daily, weekly, or monthly.",)snoozed_until = RelativeDateTimeField(allow_null=True,@@ -642,6 +654,10 @@ class AlertSerializer(SearchMatchTypeSerializerMixin, serializers.ModelSerializecalculation_interval=calculation_interval,organization=organization,)+ _validate_real_time_interval(+ calculation_interval=calculation_interval,+ organization=organization,+ )# Investigation agent is only supported for detector-based alerts.investigation_enabled = attrs.get(@@ -678,12 +694,47 @@ class AlertSerializer(SearchMatchTypeSerializerMixin, serializers.ModelSerialize})- # only validate alert count when creating a new alert- if self.context["request"].method != "POST":- return attrs-- if msg := AlertConfiguration.check_alert_limit(self.context["team_id"], self.context["get_organization"]()):- raise ValidationError({"alert": [msg]})+ # Total alert count only checked on create.+ if self.context["request"].method == "POST":+ if msg := AlertConfiguration.check_alert_limit(self.context["team_id"], self.context["get_organization"]()):+ raise ValidationError({"alert": [msg]})++ # Real-time limit applies on create and on any update that would increase the active count:+ # switching an alert to real_time, or enabling an already-real_time alert.+ is_create = self.context["request"].method == "POST"+ existing_interval = self.instance.calculation_interval if self.instance else None+ existing_enabled = self.instance.enabled if self.instance else True+ becoming_real_time = (+ is_create+ and calculation_interval == AlertCalculationInterval.REAL_TIME+ and attrs.get("enabled", True) is True+ )+ switching_to_real_time = (+ not is_create+ and calculation_interval == AlertCalculationInterval.REAL_TIME+ and existing_interval != AlertCalculationInterval.REAL_TIME+ )+ enabling_real_time = (+ not is_create+ and calculation_interval == AlertCalculationInterval.REAL_TIME+ and attrs.get("enabled", existing_enabled) is True+ and not existing_enabled+ )+ if becoming_real_time or switching_to_real_time or enabling_real_time:+ exclude_id = str(self.instance.pk) if self.instance else None+ if msg := AlertConfiguration.check_real_time_alert_limit(+ self.context["team_id"], organization, exclude_id=exclude_id+ ):+ posthoganalytics.capture(+ distinct_id=str(self.context["request"].user.distinct_id),+ event="real time alert limit reached",+ properties={+ "team_id": self.context["team_id"],+ "organization_id": str(organization.id),+ },+ groups={"organization": str(organization.id)},+ )+ raise ValidationError({"calculation_interval": [msg]})return attrsdiff --git a/products/alerts/backend/migrations/0003_alter_alertconfiguration_calculation_interval.py b/products/alerts/backend/migrations/0003_alter_alertconfiguration_calculation_interval.pynew file mode 100644index 000000000000..018caf46ebca--- /dev/null+++ b/products/alerts/backend/migrations/0003_alter_alertconfiguration_calculation_interval.py@@ -0,0 +1,41 @@+# Generated by Django 5.2.14 on 2026-07-02 17:18++from django.db import migrations, models++import posthog.schema_enums+++class Migration(migrations.Migration):+ dependencies = [+ ("alerts", "0002_migrate_product_analytics_models"),+ ]++ operations = [+ migrations.AlterField(+ model_name="alertconfiguration",+ name="calculation_interval",+ field=models.CharField(+ blank=True,+ choices=[+ (+ posthog.schema_enums.AlertCalculationInterval["REAL_TIME"],+ "real_time",+ ),+ (+ posthog.schema_enums.AlertCalculationInterval["EVERY_15_MINUTES"],+ "every_15_minutes",+ ),+ (posthog.schema_enums.AlertCalculationInterval["HOURLY"], "hourly"),+ (posthog.schema_enums.AlertCalculationInterval["DAILY"], "daily"),+ (posthog.schema_enums.AlertCalculationInterval["WEEKLY"], "weekly"),+ (+ posthog.schema_enums.AlertCalculationInterval["MONTHLY"],+ "monthly",+ ),+ ],+ default=posthog.schema_enums.AlertCalculationInterval["DAILY"],+ max_length=20,+ null=True,+ ),+ ),+ ]diff --git a/products/alerts/backend/migrations/max_migration.txt b/products/alerts/backend/migrations/max_migration.txtindex 44181c85e953..5a717f07553e 100644--- a/products/alerts/backend/migrations/max_migration.txt+++ b/products/alerts/backend/migrations/max_migration.txt@@ -1 +1 @@-0002_migrate_product_analytics_models+0003_alter_alertconfiguration_calculation_intervaldiff --git a/products/alerts/backend/models/alert.py b/products/alerts/backend/models/alert.pyindex 5673dd9aa45b..1b930f25d0a4 100644--- a/products/alerts/backend/models/alert.py+++ b/products/alerts/backend/models/alert.py@@ -127,6 +127,7 @@ class AlertConfiguration(ModelActivityMixin, CreatedMetaFields, UUIDTModel):# how often to recalculate the alertCALCULATION_INTERVAL_CHOICES = [+ (AlertCalculationInterval.REAL_TIME, AlertCalculationInterval.REAL_TIME.value),(AlertCalculationInterval.EVERY_15_MINUTES, AlertCalculationInterval.EVERY_15_MINUTES.value),(AlertCalculationInterval.HOURLY, AlertCalculationInterval.HOURLY.value),(AlertCalculationInterval.DAILY, AlertCalculationInterval.DAILY.value),@@ -350,7 +351,9 @@ class AlertConfiguration(ModelActivityMixin, CreatedMetaFields, UUIDTModel):return None@classmethod- def check_real_time_alert_limit(cls, team_id: int, organization: Organization) -> str | None:+ def check_real_time_alert_limit(+ cls, team_id: int, organization: Organization, *, exclude_id: str | None = None+ ) -> str | None:"""Return an error message if the team has reached its real-time alert limit, else None.Unlike check_alert_limit (which counts every alert against the ALERTS feature), this@@ -366,9 +369,10 @@ class AlertConfiguration(ModelActivityMixin, CreatedMetaFields, UUIDTModel):if allowed is None:return None- existing_count = cls.objects.filter(- team_id=team_id, calculation_interval=AlertCalculationInterval.REAL_TIME, enabled=True- ).count()+ qs = cls.objects.filter(team_id=team_id, calculation_interval=AlertCalculationInterval.REAL_TIME, enabled=True)+ if exclude_id:+ qs = qs.exclude(pk=exclude_id)+ existing_count = qs.count()if existing_count >= allowed:return f"Your team has reached the limit of {allowed} real-time alerts on your plan."return Nonediff --git a/products/alerts/frontend/generated/api.schemas.ts b/products/alerts/frontend/generated/api.schemas.tsindex 77676b432b57..f6d7261abab7 100644--- a/products/alerts/frontend/generated/api.schemas.ts+++ b/products/alerts/frontend/generated/api.schemas.ts@@ -439,6 +439,7 @@ export type DetectorConfigApi =| PCADetectorConfigApi/**+ * * `real_time` - real_time* * `every_15_minutes` - every_15_minutes* * `hourly` - hourly* * `daily` - daily@@ -448,6 +449,7 @@ export type DetectorConfigApi =export type CalculationIntervalEnumApi = (typeof CalculationIntervalEnumApi)[keyof typeof CalculationIntervalEnumApi]export const CalculationIntervalEnumApi = {+ RealTime: 'real_time',Every15Minutes: 'every_15_minutes',Hourly: 'hourly',Daily: 'daily',@@ -520,8 +522,9 @@ export interface AlertApi {/** Per-insight-kind alert configuration, discriminated by `type`. TrendsAlertConfig: series_index (which series to monitor) and check_ongoing_interval (whether to check the current incomplete interval). HogQLAlertConfig (SQL insights): column (which result column to evaluate, defaults to the single numeric column), evaluation ('last_row' checks the latest value of an oldest->newest query, 'first_row' checks the first value of a newest->oldest query, 'any_row' fires if any row breaches), and label_column (names the evaluated row(s) in breach messages, in every evaluation mode). FunnelsAlertConfig (funnel insights): funnel_step (the step to monitor, null for the overall last step), metric ('conversion_from_start' or 'conversion_from_previous'), and check_ongoing_interval (historical-trend funnels: also evaluate the current in-progress period). Steps funnels support only absolute_value conditions; historical-trend funnels also support relative_increase/relative_decrease (compared against the prior period). */config?: AlertConfigUnionApi | nulldetector_config?: DetectorConfigApi | null- /** How often the alert is checked: every 15 minutes (Boost+), hourly, daily, weekly, or monthly.+ /** How often the alert is checked: real time (Scale+), every 15 minutes (Boost+), hourly, daily, weekly, or monthly.*+ * * `real_time` - real_time* * `every_15_minutes` - every_15_minutes* * `hourly` - hourly* * `daily` - daily@@ -601,8 +604,9 @@ export interface PatchedAlertApi {/** Per-insight-kind alert configuration, discriminated by `type`. TrendsAlertConfig: series_index (which series to monitor) and check_ongoing_interval (whether to check the current incomplete interval). HogQLAlertConfig (SQL insights): column (which result column to evaluate, defaults to the single numeric column), evaluation ('last_row' checks the latest value of an oldest->newest query, 'first_row' checks the first value of a newest->oldest query, 'any_row' fires if any row breaches), and label_column (names the evaluated row(s) in breach messages, in every evaluation mode). FunnelsAlertConfig (funnel insights): funnel_step (the step to monitor, null for the overall last step), metric ('conversion_from_start' or 'conversion_from_previous'), and check_ongoing_interval (historical-trend funnels: also evaluate the current in-progress period). Steps funnels support only absolute_value conditions; historical-trend funnels also support relative_increase/relative_decrease (compared against the prior period). */config?: AlertConfigUnionApi | nulldetector_config?: DetectorConfigApi | null- /** How often the alert is checked: every 15 minutes (Boost+), hourly, daily, weekly, or monthly.+ /** How often the alert is checked: real time (Scale+), every 15 minutes (Boost+), hourly, daily, weekly, or monthly.*+ * * `real_time` - real_time* * `every_15_minutes` - every_15_minutes* * `hourly` - hourly* * `daily` - dailydiff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 82baee899271..d33041c92e41 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -8935,6 +8935,7 @@ export namespace Schemas {export type DetectorConfig = EnsembleDetectorConfig | ZScoreDetectorConfig | MADDetectorConfig | IQRDetectorConfig | ThresholdDetectorConfig | ECODDetectorConfig | COPODDetectorConfig | IsolationForestDetectorConfig | KNNDetectorConfig | HBOSDetectorConfig | LOFDetectorConfig | OCSVMDetectorConfig | PCADetectorConfig;/**+ * * `real_time` - real_time* * `every_15_minutes` - every_15_minutes* * `hourly` - hourly* * `daily` - daily@@ -8945,6 +8946,7 @@ export namespace Schemas {export const CalculationIntervalEnum = {+ RealTime: 'real_time',Every15Minutes: 'every_15_minutes',Hourly: 'hourly',Daily: 'daily',@@ -9010,8 +9012,9 @@ export namespace Schemas {/** Per-insight-kind alert configuration, discriminated by `type`. TrendsAlertConfig: series_index (which series to monitor) and check_ongoing_interval (whether to check the current incomplete interval). HogQLAlertConfig (SQL insights): column (which result column to evaluate, defaults to the single numeric column), evaluation ('last_row' checks the latest value of an oldest->newest query, 'first_row' checks the first value of a newest->oldest query, 'any_row' fires if any row breaches), and label_column (names the evaluated row(s) in breach messages, in every evaluation mode). FunnelsAlertConfig (funnel insights): funnel_step (the step to monitor, null for the overall last step), metric ('conversion_from_start' or 'conversion_from_previous'), and check_ongoing_interval (historical-trend funnels: also evaluate the current in-progress period). Steps funnels support only absolute_value conditions; historical-trend funnels also support relative_increase/relative_decrease (compared against the prior period). */config?: AlertConfigUnion | null;detector_config?: DetectorConfig | null;- /** How often the alert is checked: every 15 minutes (Boost+), hourly, daily, weekly, or monthly.+ /** How often the alert is checked: real time (Scale+), every 15 minutes (Boost+), hourly, daily, weekly, or monthly.*+ * * `real_time` - real_time* * `every_15_minutes` - every_15_minutes* * `hourly` - hourly* * `daily` - daily@@ -36194,8 +36197,9 @@ export namespace Schemas {/** Per-insight-kind alert configuration, discriminated by `type`. TrendsAlertConfig: series_index (which series to monitor) and check_ongoing_interval (whether to check the current incomplete interval). HogQLAlertConfig (SQL insights): column (which result column to evaluate, defaults to the single numeric column), evaluation ('last_row' checks the latest value of an oldest->newest query, 'first_row' checks the first value of a newest->oldest query, 'any_row' fires if any row breaches), and label_column (names the evaluated row(s) in breach messages, in every evaluation mode). FunnelsAlertConfig (funnel insights): funnel_step (the step to monitor, null for the overall last step), metric ('conversion_from_start' or 'conversion_from_previous'), and check_ongoing_interval (historical-trend funnels: also evaluate the current in-progress period). Steps funnels support only absolute_value conditions; historical-trend funnels also support relative_increase/relative_decrease (compared against the prior period). */config?: AlertConfigUnion | null;detector_config?: DetectorConfig | null;- /** How often the alert is checked: every 15 minutes (Boost+), hourly, daily, weekly, or monthly.+ /** How often the alert is checked: real time (Scale+), every 15 minutes (Boost+), hourly, daily, weekly, or monthly.*+ * * `real_time` - real_time* * `every_15_minutes` - every_15_minutes* * `hourly` - hourly* * `daily` - dailydiff --git a/services/mcp/src/generated/alerts/api.ts b/services/mcp/src/generated/alerts/api.tsindex c8e3afd4d734..982b4bb8955f 100644--- a/services/mcp/src/generated/alerts/api.ts+++ b/services/mcp/src/generated/alerts/api.ts@@ -1220,13 +1220,13 @@ export const AlertsCreateBody = /* @__PURE__ */ zod.object({]).optional(),calculation_interval: zod- .enum(['every_15_minutes', 'hourly', 'daily', 'weekly', 'monthly'])+ .enum(['real_time', 'every_15_minutes', 'hourly', 'daily', 'weekly', 'monthly']).describe(- '* `every_15_minutes` - every_15_minutes\n* `hourly` - hourly\n* `daily` - daily\n* `weekly` - weekly\n* `monthly` - monthly'+ '* `real_time` - real_time\n* `every_15_minutes` - every_15_minutes\n* `hourly` - hourly\n* `daily` - daily\n* `weekly` - weekly\n* `monthly` - monthly').optional().describe(- 'How often the alert is checked: every 15 minutes (Boost+), hourly, daily, weekly, or monthly.\n\n* `every_15_minutes` - every_15_minutes\n* `hourly` - hourly\n* `daily` - daily\n* `weekly` - weekly\n* `monthly` - monthly'+ 'How often the alert is checked: real time (Scale+), every 15 minutes (Boost+), hourly, daily, weekly, or monthly.\n\n* `real_time` - real_time\n* `every_15_minutes` - every_15_minutes\n* `hourly` - hourly\n* `daily` - daily\n* `weekly` - weekly\n* `monthly` - monthly'),snoozed_until: zod.string()@@ -2531,13 +2531,13 @@ export const AlertsPartialUpdateBody = /* @__PURE__ */ zod.object({]).optional(),calculation_interval: zod- .enum(['every_15_minutes', 'hourly', 'daily', 'weekly', 'monthly'])+ .enum(['real_time', 'every_15_minutes', 'hourly', 'daily', 'weekly', 'monthly']).describe(- '* `every_15_minutes` - every_15_minutes\n* `hourly` - hourly\n* `daily` - daily\n* `weekly` - weekly\n* `monthly` - monthly'+ '* `real_time` - real_time\n* `every_15_minutes` - every_15_minutes\n* `hourly` - hourly\n* `daily` - daily\n* `weekly` - weekly\n* `monthly` - monthly').optional().describe(- 'How often the alert is checked: every 15 minutes (Boost+), hourly, daily, weekly, or monthly.\n\n* `every_15_minutes` - every_15_minutes\n* `hourly` - hourly\n* `daily` - daily\n* `weekly` - weekly\n* `monthly` - monthly'+ 'How often the alert is checked: real time (Scale+), every 15 minutes (Boost+), hourly, daily, weekly, or monthly.\n\n* `real_time` - real_time\n* `every_15_minutes` - every_15_minutes\n* `hourly` - hourly\n* `daily` - daily\n* `weekly` - weekly\n* `monthly` - monthly'),snoozed_until: zod.string()diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/alert-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/alert-create.jsonindex 0822671ce26d..1ece7bfa7097 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/alert-create.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/alert-create.json@@ -2,8 +2,8 @@"$schema": "https://json-schema.org/draft/2020-12/schema","properties": {"calculation_interval": {- "description": "How often the alert is checked: every 15 minutes (Boost+), hourly, daily, weekly, or monthly.\n\n* `every_15_minutes` - every_15_minutes\n* `hourly` - hourly\n* `daily` - daily\n* `weekly` - weekly\n* `monthly` - monthly",- "enum": ["every_15_minutes", "hourly", "daily", "weekly", "monthly"],+ "description": "How often the alert is checked: real time (Scale+), every 15 minutes (Boost+), hourly, daily, weekly, or monthly.\n\n* `real_time` - real_time\n* `every_15_minutes` - every_15_minutes\n* `hourly` - hourly\n* `daily` - daily\n* `weekly` - weekly\n* `monthly` - monthly",+ "enum": ["real_time", "every_15_minutes", "hourly", "daily", "weekly", "monthly"],"type": "string"},"condition": {diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/alert-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/alert-update.jsonindex 541cb04b73a2..570c28768471 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/alert-update.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/alert-update.json@@ -2,8 +2,8 @@"$schema": "https://json-schema.org/draft/2020-12/schema","properties": {"calculation_interval": {- "description": "How often the alert is checked: every 15 minutes (Boost+), hourly, daily, weekly, or monthly.\n\n* `every_15_minutes` - every_15_minutes\n* `hourly` - hourly\n* `daily` - daily\n* `weekly` - weekly\n* `monthly` - monthly",- "enum": ["every_15_minutes", "hourly", "daily", "weekly", "monthly"],+ "description": "How often the alert is checked: real time (Scale+), every 15 minutes (Boost+), hourly, daily, weekly, or monthly.\n\n* `real_time` - real_time\n* `every_15_minutes` - every_15_minutes\n* `hourly` - hourly\n* `daily` - daily\n* `weekly` - weekly\n* `monthly` - monthly",+ "enum": ["real_time", "every_15_minutes", "hourly", "daily", "weekly", "monthly"],"type": "string"},"condition": {