: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): store labels and annotations on platform alert rules (#123326)
Jon McCallum70fb408c4e31
diff --git a/products/alerts_platform/backend/facade/contracts.py b/products/alerts_platform/backend/facade/contracts.pyindex 63d4a0901d81..c801b022e942 100644--- a/products/alerts_platform/backend/facade/contracts.py+++ b/products/alerts_platform/backend/facade/contracts.py@@ -963,6 +963,8 @@ class PlatformAlertConfigurationView:created_at: datetimeupdated_at: datetimealerts: tuple[PlatformAlertSnapshot, ...]+ labels: dict[str, str] = field(default_factory=dict)+ annotations: dict[str, str] = field(default_factory=dict)@propertydef destination_alert_id(self) -> UUID:@@ -987,6 +989,8 @@ class PlatformAlertConfigurationEdit:evaluation_periods: intdatapoints_to_alarm: intcooldown_minutes: int+ labels: dict[str, str] = field(default_factory=dict)+ annotations: dict[str, str] = field(default_factory=dict)class InvalidPlatformAlertEdit(ValueError):diff --git a/products/alerts_platform/backend/facade/grouping.py b/products/alerts_platform/backend/facade/grouping.pyindex 385128156768..aa7cf17f81b8 100644--- a/products/alerts_platform/backend/facade/grouping.py+++ b/products/alerts_platform/backend/facade/grouping.py@@ -49,8 +49,8 @@ def is_hashed_grouping_key(key: str) -> bool:# PostgreSQL text and JSONB reject NUL, and UTF-8 cannot encode a surrogate. Either one aborts the-# transaction that records the whole batch.-_UNSTORABLE: Final = re.compile("[\x00\ud800-\udfff]")+# transaction that records the whole batch. Stdlib `re`, because re2 cannot see a lone surrogate.+UNSTORABLE: Final = re.compile("[\x00\ud800-\udfff]")def bounded_grouping_key(key: str) -> str:@@ -60,7 +60,7 @@ def bounded_grouping_key(key: str) -> str:Every other key is hashed. A literal key in the hash namespace is hashed too, because otherwiseit would share a row with the long key whose digest it spells."""- if len(key) <= MAX_GROUPING_KEY_LENGTH and not is_hashed_grouping_key(key) and not _UNSTORABLE.search(key):+ if len(key) <= MAX_GROUPING_KEY_LENGTH and not is_hashed_grouping_key(key) and not UNSTORABLE.search(key):return keyreturn f"{_HASHED_PREFIX}{hashlib.sha256(key.encode('utf-8', 'surrogatepass')).hexdigest()}"@@ -76,20 +76,20 @@ _TRUNCATED: Final = "…"def _bounded_label(value: str) -> str:# A label is display only, so a character the database cannot store shows as a replacement.- value = _UNSTORABLE.sub("\ufffd", value)- if _encoded_length(value) <= MAX_LABEL_BYTES:+ value = UNSTORABLE.sub("\ufffd", value)+ if encoded_length(value) <= MAX_LABEL_BYTES:return value- budget = MAX_LABEL_BYTES - _encoded_length(_TRUNCATED)+ budget = MAX_LABEL_BYTES - encoded_length(_TRUNCATED)kept: list[str] = []for char in value:- budget -= _encoded_length(char)+ budget -= encoded_length(char)if budget < 0:breakkept.append(char)return "".join(kept) + _TRUNCATED-def _encoded_length(value: str) -> int:+def encoded_length(value: str) -> int:return len(json.dumps(value)) - 2diff --git a/products/alerts_platform/backend/logic/platform_lifecycle.py b/products/alerts_platform/backend/logic/platform_lifecycle.pyindex ee6e7cc71802..366d88675554 100644--- a/products/alerts_platform/backend/logic/platform_lifecycle.py+++ b/products/alerts_platform/backend/logic/platform_lifecycle.py@@ -229,9 +229,13 @@ def suppressed() -> Q:return Q(check_status=PlatformAlertConfiguration.CheckStatus.BROKEN)+RULE_METADATA_FIELDS: Final = ("labels", "annotations")++def _due(team_id: int, source_kind: str, cutoff: datetime) -> QuerySet[PlatformAlertConfiguration]:return (PlatformAlertConfiguration.objects.for_team(team_id)+ .defer(*RULE_METADATA_FIELDS).filter(enabled=True, source_kind=source_kind).filter(due_q(cutoff)).exclude(suppressed())@@ -540,6 +544,7 @@ def record_outcomes(team_id: int, outcomes: Sequence[PlatformAlertOutcome], now:configurations = list(PlatformAlertConfiguration.objects.for_team(team_id).select_for_update()+ .defer(*RULE_METADATA_FIELDS).filter(id__in=by_id).filter(due_q(now)).order_by("id")@@ -799,6 +804,8 @@ def write_edit("evaluation_periods","datapoints_to_alarm","cooldown_minutes",+ "labels",+ "annotations","updated_at",]reenabled = edit.enabled and not configuration.enabled@@ -846,6 +853,8 @@ def _assign_edit(configuration: PlatformAlertConfiguration, edit: PlatformAlertCconfiguration.evaluation_periods = edit.evaluation_periodsconfiguration.datapoints_to_alarm = edit.datapoints_to_alarmconfiguration.cooldown_minutes = edit.cooldown_minutes+ configuration.labels = edit.labels+ configuration.annotations = edit.annotationsdef end_firing_instances(configuration: PlatformAlertConfiguration, *, now: datetime) -> list[PlatformAlert]:diff --git a/products/alerts_platform/backend/logic/platform_reads.py b/products/alerts_platform/backend/logic/platform_reads.pyindex 043e6d419ff2..f6a366fd7c67 100644--- a/products/alerts_platform/backend/logic/platform_reads.py+++ b/products/alerts_platform/backend/logic/platform_reads.py@@ -79,6 +79,8 @@ def _configuration_view(configuration: PlatformAlertConfiguration) -> PlatformAlcreated_at=configuration.created_at,updated_at=configuration.updated_at,alerts=tuple(instance_view(alert, configuration) for alert in configuration.alerts.all()),+ labels=configuration.labels,+ annotations=configuration.annotations,)diff --git a/products/alerts_platform/backend/logic/platform_writes.py b/products/alerts_platform/backend/logic/platform_writes.pyindex b5c957229d66..f5c1d410cee3 100644--- a/products/alerts_platform/backend/logic/platform_writes.py+++ b/products/alerts_platform/backend/logic/platform_writes.py@@ -37,7 +37,13 @@ from products.alerts_platform.backend.facade.contracts import ()from products.alerts_platform.backend.facade.enums import PlatformAlertOwnerfrom products.alerts_platform.backend.facade.scheduling import validate_and_normalize_schedule_restriction-from products.alerts_platform.backend.logic import control_plane, platform_lifecycle, platform_reads, source_configs+from products.alerts_platform.backend.logic import (+ control_plane,+ platform_lifecycle,+ platform_reads,+ rule_metadata,+ source_configs,+)from products.alerts_platform.backend.models import PlatformAlert, PlatformAlertConfiguration@@ -55,6 +61,8 @@ def edit_of(configuration: PlatformAlertConfiguration) -> PlatformAlertConfiguraevaluation_periods=configuration.evaluation_periods,datapoints_to_alarm=configuration.datapoints_to_alarm,cooldown_minutes=configuration.cooldown_minutes,+ labels=configuration.labels,+ annotations=configuration.annotations,)@@ -82,6 +90,14 @@ def _validated(schedule_restriction = validate_and_normalize_schedule_restriction(edit.schedule_restriction)except ValueError as error:raise InvalidPlatformAlertEdit("schedule_restriction", str(error)) from error+ try:+ rule_metadata.validate_labels(edit.labels)+ except rule_metadata.InvalidRuleMetadata as error:+ raise InvalidPlatformAlertEdit("labels", str(error)) from error+ try:+ rule_metadata.validate_annotations(edit.annotations, {*edit.grouping.keys, *edit.labels})+ except rule_metadata.InvalidRuleMetadata as error:+ raise InvalidPlatformAlertEdit("annotations", str(error)) from errorsource_config = edit.source_config# Settings the edit leaves alone may predate the schema, or name rows deleted since, and must not# block an unrelated change.diff --git a/products/alerts_platform/backend/logic/rule_metadata.py b/products/alerts_platform/backend/logic/rule_metadata.pynew file mode 100644index 000000000000..9036f13ee170--- /dev/null+++ b/products/alerts_platform/backend/logic/rule_metadata.py@@ -0,0 +1,120 @@+"""Labels and annotations an alert's author sets on the rule, in the Prometheus sense.++Labels say who owns the alert and how urgent it is, such as `team` and `severity`, so a receiver can+route on them. Annotations carry context for the responder, such as `runbook_url`. Only annotations+take templates, because a label that changed with each check would make each check a new alert in+a receiver that keys on labels.+"""++from collections.abc import Collection, Mapping+from typing import Final++import re2++from products.alerts_platform.backend.facade.grouping import UNSTORABLE, encoded_length++MAX_RULE_LABELS: Final = 20+_MAX_RULE_ANNOTATIONS: Final = 20+_MAX_NAME_LENGTH: Final = 128+_MAX_LABEL_VALUE_BYTES: Final = 256+_MAX_ANNOTATION_VALUE_BYTES: Final = 4096++# Prometheus's own pattern, so a label survives a hop through Alertmanager unchanged.+_NAME_PATTERN: Final = r"[a-zA-Z_][a-zA-Z0-9_]*"+_NAME: Final = re2.compile(_NAME_PATTERN)+_RESERVED_PREFIX: Final = "posthog_"+_RESERVED_LABELS: Final = frozenset({"alertname"})++_LABEL_REFERENCE: Final = re2.compile(rf"\s*\$labels\.({_NAME_PATTERN})\s*")+_VALUE_REFERENCE: Final = re2.compile(r"\s*\$value\s*")+_LINK_HOST: Final = re2.compile(r"[a-zA-Z0-9.-]+(:[0-9]+)?")+++class InvalidRuleMetadata(ValueError):+ pass+++def validate_labels(labels: Mapping[str, str]) -> None:+ if len(labels) > MAX_RULE_LABELS:+ raise InvalidRuleMetadata(f"An alert can have at most {MAX_RULE_LABELS} labels.")+ for name, value in labels.items():+ _check_name(name, "label")+ if name in _RESERVED_LABELS:+ raise InvalidRuleMetadata(f"`{name}` is set by PostHog and cannot be a label.")+ _check_value(name, value, _MAX_LABEL_VALUE_BYTES)+ if "{{" in value:+ raise InvalidRuleMetadata(f"Label `{name}` cannot use a template. Only annotations can.")+++def validate_annotations(annotations: Mapping[str, str], known_labels: Collection[str]) -> None:+ """`known_labels` are the names a template may reference: the grouping keys and the rule's labels."""+ if len(annotations) > _MAX_RULE_ANNOTATIONS:+ raise InvalidRuleMetadata(f"An alert can have at most {_MAX_RULE_ANNOTATIONS} annotations.")+ for name, value in annotations.items():+ _check_name(name, "annotation")+ _check_value(name, value, _MAX_ANNOTATION_VALUE_BYTES)+ for reference in _referenced_labels(name, value):+ if reference not in known_labels:+ raise InvalidRuleMetadata(+ f"Annotation `{name}` uses `$labels.{reference}`, which is not a grouping key or a label of this alert."+ )+ if name.endswith("_url"):+ _check_link(name, value)+++def _check_link(name: str, value: str) -> None:+ # A label value comes from query results, so it may change which page a link opens, never which site.+ if not value.startswith("https://"):+ raise InvalidRuleMetadata(f"Annotation `{name}` must start with https://.")+ host = re2.split(r"[/?#]", value.removeprefix("https://"), maxsplit=1)[0]+ if not _LINK_HOST.fullmatch(host):+ raise InvalidRuleMetadata(f"Annotation `{name}` must name its host without a template.")+++def _referenced_labels(name: str, value: str) -> list[str]:+ """The label names a template references. Raises for anything but `$labels.<name>` and `$value`."""+ references: list[str] = []+ for body in _template_bodies(name, value):+ if label := _LABEL_REFERENCE.fullmatch(body):+ references.append(label.group(1))+ elif not _VALUE_REFERENCE.fullmatch(body):+ raise InvalidRuleMetadata(+ f"Annotation `{name}` has an unsupported template `{{{{{body}}}}}`. "+ "Use {{ $labels.<name> }} or {{ $value }}."+ )+ return references+++def _template_bodies(name: str, value: str) -> list[str]:+ # A pattern needing both delimiters would skip an unclosed `{{` and every check after it.+ bodies: list[str] = []+ position = 0+ while (start := value.find("{{", position)) != -1:+ end = value.find("}}", start + 2)+ if end == -1:+ raise InvalidRuleMetadata(f"Annotation `{name}` has a `{{{{` with no closing `}}}}`.")+ bodies.append(value[start + 2 : end])+ position = end + 2+ return bodies+++def _check_name(name: str, kind: str) -> None:+ # Before re2 and without the name, because neither re2 nor the JSON response can encode a lone surrogate.+ if UNSTORABLE.search(name):+ raise InvalidRuleMetadata(f"A {kind} name has a character that cannot be stored.")+ if len(name) > _MAX_NAME_LENGTH or not _NAME.fullmatch(name):+ raise InvalidRuleMetadata(+ f"`{name}` is not a valid {kind} name. Use letters, digits and underscores, "+ f"start with a letter or underscore, and use at most {_MAX_NAME_LENGTH} characters."+ )+ if name.startswith(_RESERVED_PREFIX):+ raise InvalidRuleMetadata(f"`{name}` uses the `{_RESERVED_PREFIX}` prefix, which PostHog reserves.")+++def _check_value(name: str, value: str, max_bytes: int) -> None:+ if not value.strip():+ raise InvalidRuleMetadata(f"`{name}` needs a value.")+ if UNSTORABLE.search(value):+ raise InvalidRuleMetadata(f"The value of `{name}` has a character that cannot be stored.")+ if encoded_length(value) > max_bytes:+ raise InvalidRuleMetadata(f"The value of `{name}` is too long.")diff --git a/products/alerts_platform/backend/migrations/0021_rule_labels_and_annotations.py b/products/alerts_platform/backend/migrations/0021_rule_labels_and_annotations.pynew file mode 100644index 000000000000..350b3cbee989--- /dev/null+++ b/products/alerts_platform/backend/migrations/0021_rule_labels_and_annotations.py@@ -0,0 +1,20 @@+from django.db import migrations, models+++class Migration(migrations.Migration):+ dependencies = [+ ("alerts_platform", "0020_delivery_hold"),+ ]++ operations = [+ migrations.AddField(+ model_name="platformalertconfiguration",+ name="annotations",+ field=models.JSONField(db_default={}, default=dict),+ ),+ migrations.AddField(+ model_name="platformalertconfiguration",+ name="labels",+ field=models.JSONField(db_default={}, default=dict),+ ),+ ]diff --git a/products/alerts_platform/backend/migrations/max_migration.txt b/products/alerts_platform/backend/migrations/max_migration.txtindex cb00bee8cb2f..26e6c2512499 100644--- a/products/alerts_platform/backend/migrations/max_migration.txt+++ b/products/alerts_platform/backend/migrations/max_migration.txt@@ -1 +1 @@-0020_delivery_hold+0021_rule_labels_and_annotationsdiff --git a/products/alerts_platform/backend/models/platform_alert.py b/products/alerts_platform/backend/models/platform_alert.pyindex 6c655c28283e..2f7e1a79cd7b 100644--- a/products/alerts_platform/backend/models/platform_alert.py+++ b/products/alerts_platform/backend/models/platform_alert.py@@ -118,6 +118,8 @@ class PlatformAlertConfiguration(ModelActivityMixin, TeamScopedRootMixin, UUIDMomax_length=16, choices=Owner.choices, default=Owner.SOURCE.value, db_default=Owner.SOURCE.value)owner_changed_at = models.DateTimeField(null=True, blank=True)+ labels = models.JSONField(default=dict, db_default={})+ annotations = models.JSONField(default=dict, db_default={})# Which rows an alert's destinations live in: the source's HogFunctions, or `AlertDestination`.# Separate from `owner`, because an alert moves its evaluation first and its destinations later.destinations_owner = models.CharField(diff --git a/products/alerts_platform/backend/presentation/views/platform_alert.py b/products/alerts_platform/backend/presentation/views/platform_alert.pyindex de1de6fc0288..c6295550444f 100644--- a/products/alerts_platform/backend/presentation/views/platform_alert.py+++ b/products/alerts_platform/backend/presentation/views/platform_alert.py@@ -54,6 +54,17 @@ from products.alerts_platform.backend.facade.enums import (from products.alerts_platform.backend.facade.source_configs import editable_source_configsfrom products.alerts_platform.backend.presentation.views.schedule_restriction import ScheduleRestrictionField+RULE_LABELS_HELP = (+ 'Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. '+ "Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. "+ "Values cannot use templates."+)+RULE_ANNOTATIONS_HELP = (+ 'Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use '+ "{{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation "+ "whose name ends in _url must start with https://."+)+class PlatformAlertSerializer(serializers.Serializer):id = serializers.UUIDField(read_only=True, help_text="Unique identifier of this alert instance.")@@ -219,6 +230,16 @@ class PlatformAlertConfigurationSerializer(serializers.Serializer):read_only=True,help_text="Runtime state for each result group of this configuration.",)+ labels = serializers.DictField(+ child=serializers.CharField(),+ read_only=True,+ help_text=RULE_LABELS_HELP,+ )+ annotations = serializers.DictField(+ child=serializers.CharField(),+ read_only=True,+ help_text=RULE_ANNOTATIONS_HELP,+ )class PlatformAlertConfigurationListQuerySerializer(serializers.Serializer):@@ -274,6 +295,17 @@ class PlatformAlertConfigurationEditSerializer(serializers.Serializer):max_value=MAX_STORED_INTEGER,help_text="Minimum minutes between notifications for the same alert.",)+ # Optional, so a full update that leaves them out keeps what is stored.+ labels = serializers.DictField(+ child=serializers.CharField(),+ required=False,+ help_text=RULE_LABELS_HELP,+ )+ annotations = serializers.DictField(+ child=serializers.CharField(trim_whitespace=False),+ required=False,+ help_text=RULE_ANNOTATIONS_HELP,+ )def _typed_edit_serializer(diff --git a/products/alerts_platform/backend/tests/api/test_platform_alert.py b/products/alerts_platform/backend/tests/api/test_platform_alert.pyindex de9d75b21411..6cca7a1c3dc9 100644--- a/products/alerts_platform/backend/tests/api/test_platform_alert.py+++ b/products/alerts_platform/backend/tests/api/test_platform_alert.py@@ -1,3 +1,4 @@+import jsonfrom datetime import UTC, datetimefrom typing import Anyfrom uuid import UUID, uuid4@@ -361,18 +362,69 @@ class TestPlatformAlertAPI(APIBaseTest):("grouping_without_mode", {"grouping": {"keys": ["service_name"]}}, "grouping__mode"),("enabled_without_filters", {"source_config": {"filters": {}, "condition": CONDITION}}, "source_config"),("grouped_by_an_attribute", {"grouping": {"mode": "by_result_labels", "keys": ["http.route"]}}, "grouping"),+ ("reserved_label", {"labels": {"alertname": "Checkout"}}, "labels"),+ ("unencodable_label_name", {"labels": {"te\ud800am": "checkout"}}, "labels"),+ (+ "annotation_on_an_unknown_label",+ {"annotations": {"summary": "{{ $labels.service_name }} errors"}},+ "annotations",+ ),])def test_an_invalid_edit_names_the_field_and_changes_nothing(self, _name: str, body: dict, field: str) -> None:self._set_flag(True)configuration = self._create_configuration(self.team, "API errors", owner="platform")- response = self.client.patch(self._edit_url(configuration), body, format="json")+ # `json.dumps` escapes a lone surrogate as a client does. The test client's encoder cannot send one.+ response = self.client.patch(self._edit_url(configuration), json.dumps(body), content_type="application/json")assert response.status_code == status.HTTP_400_BAD_REQUEST, response.json()assert response.json()["attr"] == fieldconfiguration.refresh_from_db()assert (configuration.source_config["condition"], configuration.grouping["mode"]) == (CONDITION, "single")+ assert (configuration.labels, configuration.annotations) == ({}, {})++ def test_labels_and_annotations_are_stored_and_read_back(self) -> None:+ self._set_flag(True)+ configuration = self._create_configuration(self.team, "API errors", owner="platform")+ labels = {"team": "checkout", "severity": "critical"}+ annotations = {+ "summary": "Checkout errors for {{ $labels.service_name }} at {{ $value }}",+ "runbook_url": "https://runbooks.example.com/{{ $labels.team }}",+ }++ response = self.client.patch(+ self._edit_url(configuration),+ {+ "grouping": {"mode": "by_result_labels", "keys": ["service_name"]},+ "labels": labels,+ "annotations": annotations,+ },+ format="json",+ )++ assert response.status_code == status.HTTP_200_OK, response.json()+ read = self.client.get(self._edit_url(configuration)).json()+ assert (read["labels"], read["annotations"]) == (labels, annotations)++ full_update = {+ key: read[key]+ for key in (+ "source_kind",+ "name",+ "enabled",+ "source_config",+ "grouping",+ "schedule_restriction",+ "evaluation_periods",+ "datapoints_to_alarm",+ "cooldown_minutes",+ )+ }+ response = self.client.put(self._edit_url(configuration), {**full_update, "name": "Renamed"}, format="json")++ assert response.status_code == status.HTTP_200_OK, response.json()+ assert (response.json()["labels"], response.json()["annotations"]) == (labels, annotations)@parameterized.expand([diff --git a/products/alerts_platform/backend/tests/test_rule_metadata.py b/products/alerts_platform/backend/tests/test_rule_metadata.pynew file mode 100644index 000000000000..3b69a2a77316--- /dev/null+++ b/products/alerts_platform/backend/tests/test_rule_metadata.py@@ -0,0 +1,71 @@+import pytest++from parameterized import parameterized++from products.alerts_platform.backend.logic.rule_metadata import (+ MAX_RULE_LABELS,+ InvalidRuleMetadata,+ validate_annotations,+ validate_labels,+)+++ [+ ("one_label", "{{ $labels.service_name }} is down", ["service_name"]),+ ("tight_spacing", "{{$labels.team}}", ["team"]),+ ("two_labels", "{{ $labels.team }}/{{ $labels.env }}", ["team", "env"]),+ ]+)+def test_a_template_needs_every_label_it_references(_name: str, value: str, referenced: list[str]) -> None:+ validate_annotations({"summary": value}, referenced)+ with pytest.raises(InvalidRuleMetadata):+ validate_annotations({"summary": value}, referenced[1:])+++ [+ ("function", "{{ humanize $value }}"),+ ("control_flow", '{{ if eq $labels.team "a" }}a{{ end }}'),+ ("index_syntax", '{{ index $labels "team" }}'),+ ("unclosed", "{{ $labels.team is down"),+ ("unclosed_after_a_valid_one", "{{ $value }} then {{ humanize $value"),+ ]+)+def test_a_template_beyond_substitution_is_refused(_name: str, value: str) -> None:+ with pytest.raises(InvalidRuleMetadata):+ validate_annotations({"summary": value}, {"team"})+++ [+ ("dotted_name", {"service.name": "api"}),+ ("leading_digit", {"1team": "api"}),+ ("reserved_prefix", {"posthog_team": "api"}),+ ("blank_value", {"team": " "}),+ ("unstorable_value", {"team": "a\x00b"}),+ ("unencodable_name", {"te\ud800am": "api"}),+ ("too_many", {f"label_{index}": "x" for index in range(MAX_RULE_LABELS + 1)}),+ ]+)+def test_an_invalid_label_is_refused(_name: str, labels: dict[str, str]) -> None:+ with pytest.raises(InvalidRuleMetadata):+ validate_labels(labels)+++def test_a_link_may_template_its_path() -> None:+ validate_annotations({"runbook_url": "https://runbooks.example.com/{{ $labels.team }}"}, {"team"})+++ [+ ("templated_scheme", "{{ $labels.team }}"),+ ("templated_host", "https://{{ $labels.team }}/runbook"),+ ("templated_subdomain", "https://{{ $labels.team }}.example.com/runbook"),+ ("backslash_for_a_host", "https://\\/{{ $labels.team }}"),+ ("credentials_before_the_host", "https://user@{{ $labels.team }}/runbook"),+ ]+)+def test_a_link_may_not_template_its_site(_name: str, value: str) -> None:+ with pytest.raises(InvalidRuleMetadata):+ validate_annotations({"runbook_url": value}, {"team"})diff --git a/products/alerts_platform/frontend/PlatformAlerts.stories.tsx b/products/alerts_platform/frontend/PlatformAlerts.stories.tsxindex 41b538607043..2b5e63bccf44 100644--- a/products/alerts_platform/frontend/PlatformAlerts.stories.tsx+++ b/products/alerts_platform/frontend/PlatformAlerts.stories.tsx@@ -12,6 +12,8 @@ const CONFIGURATION: PlatformAlertConfigurationApi = {id: '0192a5b0-0000-7000-8000-000000000001',name: 'Checkout errors above 100',enabled: true,+ labels: {},+ annotations: {},source_kind: 'logs',source_config: {filters: { serviceNames: ['checkout'], severityLevels: ['error'] },diff --git a/products/alerts_platform/frontend/generated/api.schemas.ts b/products/alerts_platform/frontend/generated/api.schemas.tsindex 38f128d9df5d..7cfa9274c127 100644--- a/products/alerts_platform/frontend/generated/api.schemas.ts+++ b/products/alerts_platform/frontend/generated/api.schemas.ts@@ -173,6 +173,16 @@ export interface PlatformAlertApi {*/export type PlatformAlertConfigurationApiSourceConfig = { [key: string]: unknown }+/**+ * Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates.+ */+export type PlatformAlertConfigurationApiLabels = { [key: string]: string }++/**+ * Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://.+ */+export type PlatformAlertConfigurationApiAnnotations = { [key: string]: string }+export interface PlatformAlertConfigurationApi {/** Unique identifier of the alert configuration. */readonly id: string@@ -250,6 +260,10 @@ export interface PlatformAlertConfigurationApi {readonly updated_at: string/** Runtime state for each result group of this configuration. */readonly alerts: readonly PlatformAlertApi[]+ /** Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates. */+ readonly labels: PlatformAlertConfigurationApiLabels+ /** Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://. */+ readonly annotations: PlatformAlertConfigurationApiAnnotations}export interface PaginatedPlatformAlertConfigurationListApi {@@ -698,6 +712,16 @@ export interface LogsPlatformAlertSourceConfigApi {condition: LogsPlatformAlertConditionApi}+/**+ * Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates.+ */+export type LogsPlatformAlertConfigurationCreateApiLabels = { [key: string]: string }++/**+ * Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://.+ */+export type LogsPlatformAlertConfigurationCreateApiAnnotations = { [key: string]: string }+/*** The settings of a new alert. Every one but source_config has a default, which is stored.*/@@ -735,6 +759,10 @@ export interface LogsPlatformAlertConfigurationCreateApi {* @maximum 2147483647*/cooldown_minutes?: number+ /** Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates. */+ labels?: LogsPlatformAlertConfigurationCreateApiLabels+ /** Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://. */+ annotations?: LogsPlatformAlertConfigurationCreateApiAnnotations}/**@@ -757,6 +785,16 @@ export interface WarehouseDestinationAlertConfigApi {email_project_members?: boolean}+/**+ * Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates.+ */+export type WarehouseDestinationPlatformAlertConfigurationCreateApiLabels = { [key: string]: string }++/**+ * Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://.+ */+export type WarehouseDestinationPlatformAlertConfigurationCreateApiAnnotations = { [key: string]: string }+/*** The settings of a new alert. Every one but source_config has a default, which is stored.*/@@ -794,6 +832,10 @@ export interface WarehouseDestinationPlatformAlertConfigurationCreateApi {* @maximum 2147483647*/cooldown_minutes?: number+ /** Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates. */+ labels?: WarehouseDestinationPlatformAlertConfigurationCreateApiLabels+ /** Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://. */+ annotations?: WarehouseDestinationPlatformAlertConfigurationCreateApiAnnotations}/**@@ -828,6 +870,16 @@ export interface WarehouseSourceAlertConfigApi {email_project_members?: boolean}+/**+ * Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates.+ */+export type WarehouseSourcePlatformAlertConfigurationCreateApiLabels = { [key: string]: string }++/**+ * Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://.+ */+export type WarehouseSourcePlatformAlertConfigurationCreateApiAnnotations = { [key: string]: string }+/*** The settings of a new alert. Every one but source_config has a default, which is stored.*/@@ -865,6 +917,10 @@ export interface WarehouseSourcePlatformAlertConfigurationCreateApi {* @maximum 2147483647*/cooldown_minutes?: number+ /** Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates. */+ labels?: WarehouseSourcePlatformAlertConfigurationCreateApiLabels+ /** Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://. */+ annotations?: WarehouseSourcePlatformAlertConfigurationCreateApiAnnotations}export type PlatformAlertConfigurationCreateApi =@@ -935,6 +991,16 @@ export interface InsightPlatformAlertSourceConfigApi {condition: InsightPlatformAlertConditionApi}+/**+ * Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates.+ */+export type InsightPlatformAlertConfigurationEditApiLabels = { [key: string]: string }++/**+ * Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://.+ */+export type InsightPlatformAlertConfigurationEditApiAnnotations = { [key: string]: string }+/*** The settings an edit can change. Each source kind subclasses it with a typed `source_config`.*/@@ -972,6 +1038,10 @@ export interface InsightPlatformAlertConfigurationEditApi {* @maximum 2147483647*/cooldown_minutes: number+ /** Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates. */+ labels?: InsightPlatformAlertConfigurationEditApiLabels+ /** Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://. */+ annotations?: InsightPlatformAlertConfigurationEditApiAnnotations}/**@@ -984,6 +1054,16 @@ export const LogsPlatformAlertConfigurationEditApiSourceKind = {Logs: 'logs',} as const+/**+ * Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates.+ */+export type LogsPlatformAlertConfigurationEditApiLabels = { [key: string]: string }++/**+ * Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://.+ */+export type LogsPlatformAlertConfigurationEditApiAnnotations = { [key: string]: string }+/*** The settings an edit can change. Each source kind subclasses it with a typed `source_config`.*/@@ -1021,6 +1101,10 @@ export interface LogsPlatformAlertConfigurationEditApi {* @maximum 2147483647*/cooldown_minutes: number+ /** Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates. */+ labels?: LogsPlatformAlertConfigurationEditApiLabels+ /** Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://. */+ annotations?: LogsPlatformAlertConfigurationEditApiAnnotations}/**@@ -1033,6 +1117,16 @@ export const WarehouseDestinationPlatformAlertConfigurationEditApiSourceKind = {WarehouseDestination: 'warehouse_destination',} as const+/**+ * Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates.+ */+export type WarehouseDestinationPlatformAlertConfigurationEditApiLabels = { [key: string]: string }++/**+ * Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://.+ */+export type WarehouseDestinationPlatformAlertConfigurationEditApiAnnotations = { [key: string]: string }+/*** The settings an edit can change. Each source kind subclasses it with a typed `source_config`.*/@@ -1070,6 +1164,10 @@ export interface WarehouseDestinationPlatformAlertConfigurationEditApi {* @maximum 2147483647*/cooldown_minutes: number+ /** Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates. */+ labels?: WarehouseDestinationPlatformAlertConfigurationEditApiLabels+ /** Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://. */+ annotations?: WarehouseDestinationPlatformAlertConfigurationEditApiAnnotations}/**@@ -1082,6 +1180,16 @@ export const WarehouseSourcePlatformAlertConfigurationEditApiSourceKind = {WarehouseSource: 'warehouse_source',} as const+/**+ * Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates.+ */+export type WarehouseSourcePlatformAlertConfigurationEditApiLabels = { [key: string]: string }++/**+ * Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://.+ */+export type WarehouseSourcePlatformAlertConfigurationEditApiAnnotations = { [key: string]: string }+/*** The settings an edit can change. Each source kind subclasses it with a typed `source_config`.*/@@ -1119,6 +1227,10 @@ export interface WarehouseSourcePlatformAlertConfigurationEditApi {* @maximum 2147483647*/cooldown_minutes: number+ /** Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates. */+ labels?: WarehouseSourcePlatformAlertConfigurationEditApiLabels+ /** Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://. */+ annotations?: WarehouseSourcePlatformAlertConfigurationEditApiAnnotations}export type PlatformAlertConfigurationEditApi =@@ -1137,6 +1249,16 @@ export const PatchedInsightPlatformAlertConfigurationEditApiSourceKind = {Insight: 'insight',} as const+/**+ * Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates.+ */+export type PatchedInsightPlatformAlertConfigurationEditApiLabels = { [key: string]: string }++/**+ * Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://.+ */+export type PatchedInsightPlatformAlertConfigurationEditApiAnnotations = { [key: string]: string }+/*** The settings an edit can change. Each source kind subclasses it with a typed `source_config`.*/@@ -1174,6 +1296,10 @@ export interface PatchedInsightPlatformAlertConfigurationEditApi {* @maximum 2147483647*/cooldown_minutes?: number+ /** Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates. */+ labels?: PatchedInsightPlatformAlertConfigurationEditApiLabels+ /** Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://. */+ annotations?: PatchedInsightPlatformAlertConfigurationEditApiAnnotations}/**@@ -1186,6 +1312,16 @@ export const PatchedLogsPlatformAlertConfigurationEditApiSourceKind = {Logs: 'logs',} as const+/**+ * Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates.+ */+export type PatchedLogsPlatformAlertConfigurationEditApiLabels = { [key: string]: string }++/**+ * Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://.+ */+export type PatchedLogsPlatformAlertConfigurationEditApiAnnotations = { [key: string]: string }+/*** The settings an edit can change. Each source kind subclasses it with a typed `source_config`.*/@@ -1223,6 +1359,10 @@ export interface PatchedLogsPlatformAlertConfigurationEditApi {* @maximum 2147483647*/cooldown_minutes?: number+ /** Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates. */+ labels?: PatchedLogsPlatformAlertConfigurationEditApiLabels+ /** Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://. */+ annotations?: PatchedLogsPlatformAlertConfigurationEditApiAnnotations}/**@@ -1235,6 +1375,16 @@ export const PatchedWarehouseDestinationPlatformAlertConfigurationEditApiSourceKWarehouseDestination: 'warehouse_destination',} as const+/**+ * Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates.+ */+export type PatchedWarehouseDestinationPlatformAlertConfigurationEditApiLabels = { [key: string]: string }++/**+ * Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://.+ */+export type PatchedWarehouseDestinationPlatformAlertConfigurationEditApiAnnotations = { [key: string]: string }+/*** The settings an edit can change. Each source kind subclasses it with a typed `source_config`.*/@@ -1272,6 +1422,10 @@ export interface PatchedWarehouseDestinationPlatformAlertConfigurationEditApi {* @maximum 2147483647*/cooldown_minutes?: number+ /** Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates. */+ labels?: PatchedWarehouseDestinationPlatformAlertConfigurationEditApiLabels+ /** Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://. */+ annotations?: PatchedWarehouseDestinationPlatformAlertConfigurationEditApiAnnotations}/**@@ -1284,6 +1438,16 @@ export const PatchedWarehouseSourcePlatformAlertConfigurationEditApiSourceKind =WarehouseSource: 'warehouse_source',} as const+/**+ * Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates.+ */+export type PatchedWarehouseSourcePlatformAlertConfigurationEditApiLabels = { [key: string]: string }++/**+ * Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://.+ */+export type PatchedWarehouseSourcePlatformAlertConfigurationEditApiAnnotations = { [key: string]: string }+/*** The settings an edit can change. Each source kind subclasses it with a typed `source_config`.*/@@ -1321,6 +1485,10 @@ export interface PatchedWarehouseSourcePlatformAlertConfigurationEditApi {* @maximum 2147483647*/cooldown_minutes?: number+ /** Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates. */+ labels?: PatchedWarehouseSourcePlatformAlertConfigurationEditApiLabels+ /** Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://. */+ annotations?: PatchedWarehouseSourcePlatformAlertConfigurationEditApiAnnotations}export type PatchedPlatformAlertConfigurationEditApi =diff --git a/products/alerts_platform/frontend/generated/api.zod.ts b/products/alerts_platform/frontend/generated/api.zod.tsindex 42dd19c9519a..ce0d27a6e898 100644--- a/products/alerts_platform/frontend/generated/api.zod.ts+++ b/products/alerts_platform/frontend/generated/api.zod.ts@@ -224,6 +224,18 @@ export const PlatformAlertsCreateBody = /* @__PURE__ */ zod.union([.max(platformAlertsCreateBodyOneCooldownMinutesMax).default(platformAlertsCreateBodyOneCooldownMinutesDefault).describe('Minimum minutes between notifications for the same alert. Defaults to 0.'),+ labels: zod+ .record(zod.string(), zod.string())+ .optional()+ .describe(+ 'Labels that say who owns the alert and how urgent it is, such as {\"team\": \"checkout\", \"severity\": \"critical\"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates.'+ ),+ annotations: zod+ .record(zod.string(), zod.string())+ .optional()+ .describe(+ 'Context for whoever responds, such as {\"runbook_url\": \"https:\/\/...\"}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https:\/\/.'+ ),}).describe('The settings of a new alert. Every one but source_config has a default, which is stored.'),zod@@ -339,6 +351,18 @@ export const PlatformAlertsCreateBody = /* @__PURE__ */ zod.union([.max(platformAlertsCreateBodyTwoCooldownMinutesMax).default(platformAlertsCreateBodyTwoCooldownMinutesDefault).describe('Minimum minutes between notifications for the same alert. Defaults to 0.'),+ labels: zod+ .record(zod.string(), zod.string())+ .optional()+ .describe(+ 'Labels that say who owns the alert and how urgent it is, such as {\"team\": \"checkout\", \"severity\": \"critical\"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates.'+ ),+ annotations: zod+ .record(zod.string(), zod.string())+ .optional()+ .describe(+ 'Context for whoever responds, such as {\"runbook_url\": \"https:\/\/...\"}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https:\/\/.'+ ),}).describe('The settings of a new alert. Every one but source_config has a default, which is stored.'),zod@@ -466,6 +490,18 @@ export const PlatformAlertsCreateBody = /* @__PURE__ */ zod.union([.max(platformAlertsCreateBodyThreeCooldownMinutesMax).default(platformAlertsCreateBodyThreeCooldownMinutesDefault).describe('Minimum minutes between notifications for the same alert. Defaults to 0.'),+ labels: zod+ .record(zod.string(), zod.string())+ .optional()+ .describe(+ 'Labels that say who owns the alert and how urgent it is, such as {\"team\": \"checkout\", \"severity\": \"critical\"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates.'+ ),+ annotations: zod+ .record(zod.string(), zod.string())+ .optional()+ .describe(+ 'Context for whoever responds, such as {\"runbook_url\": \"https:\/\/...\"}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https:\/\/.'+ ),}).describe('The settings of a new alert. Every one but source_config has a default, which is stored.'),])@@ -673,6 +709,18 @@ export const PlatformAlertsUpdateBody = /* @__PURE__ */ zod.union([.min(platformAlertsUpdateBodyOneCooldownMinutesMin).max(platformAlertsUpdateBodyOneCooldownMinutesMax).describe('Minimum minutes between notifications for the same alert.'),+ labels: zod+ .record(zod.string(), zod.string())+ .optional()+ .describe(+ 'Labels that say who owns the alert and how urgent it is, such as {\"team\": \"checkout\", \"severity\": \"critical\"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates.'+ ),+ annotations: zod+ .record(zod.string(), zod.string())+ .optional()+ .describe(+ 'Context for whoever responds, such as {\"runbook_url\": \"https:\/\/...\"}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https:\/\/.'+ ),}).describe('The settings an edit can change. Each source kind subclasses it with a typed `source_config`.'),zod@@ -814,6 +862,18 @@ export const PlatformAlertsUpdateBody = /* @__PURE__ */ zod.union([.min(platformAlertsUpdateBodyTwoCooldownMinutesMin).max(platformAlertsUpdateBodyTwoCooldownMinutesMax).describe('Minimum minutes between notifications for the same alert.'),+ labels: zod+ .record(zod.string(), zod.string())+ .optional()+ .describe(+ 'Labels that say who owns the alert and how urgent it is, such as {\"team\": \"checkout\", \"severity\": \"critical\"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates.'+ ),+ annotations: zod+ .record(zod.string(), zod.string())+ .optional()+ .describe(+ 'Context for whoever responds, such as {\"runbook_url\": \"https:\/\/...\"}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https:\/\/.'+ ),}).describe('The settings an edit can change. Each source kind subclasses it with a typed `source_config`.'),zod@@ -919,6 +979,18 @@ export const PlatformAlertsUpdateBody = /* @__PURE__ */ zod.union([.min(platformAlertsUpdateBodyThreeCooldownMinutesMin).max(platformAlertsUpdateBodyThreeCooldownMinutesMax).describe('Minimum minutes between notifications for the same alert.'),+ labels: zod+ .record(zod.string(), zod.string())+ .optional()+ .describe(+ 'Labels that say who owns the alert and how urgent it is, such as {\"team\": \"checkout\", \"severity\": \"critical\"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates.'+ ),+ annotations: zod+ .record(zod.string(), zod.string())+ .optional()+ .describe(+ 'Context for whoever responds, such as {\"runbook_url\": \"https:\/\/...\"}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https:\/\/.'+ ),}).describe('The settings an edit can change. Each source kind subclasses it with a typed `source_config`.'),zod@@ -1036,6 +1108,18 @@ export const PlatformAlertsUpdateBody = /* @__PURE__ */ zod.union([.min(platformAlertsUpdateBodyFourCooldownMinutesMin).max(platformAlertsUpdateBodyFourCooldownMinutesMax).describe('Minimum minutes between notifications for the same alert.'),+ labels: zod+ .record(zod.string(), zod.string())+ .optional()+ .describe(+ 'Labels that say who owns the alert and how urgent it is, such as {\"team\": \"checkout\", \"severity\": \"critical\"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates.'+ ),+ annotations: zod+ .record(zod.string(), zod.string())+ .optional()+ .describe(+ 'Context for whoever responds, such as {\"runbook_url\": \"https:\/\/...\"}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https:\/\/.'+ ),}).describe('The settings an edit can change. Each source kind subclasses it with a typed `source_config`.'),])@@ -1253,6 +1337,18 @@ export const PlatformAlertsPartialUpdateBody = /* @__PURE__ */ zod.union([.max(platformAlertsPartialUpdateBodyOneCooldownMinutesMax).optional().describe('Minimum minutes between notifications for the same alert.'),+ labels: zod+ .record(zod.string(), zod.string())+ .optional()+ .describe(+ 'Labels that say who owns the alert and how urgent it is, such as {\"team\": \"checkout\", \"severity\": \"critical\"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates.'+ ),+ annotations: zod+ .record(zod.string(), zod.string())+ .optional()+ .describe(+ 'Context for whoever responds, such as {\"runbook_url\": \"https:\/\/...\"}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https:\/\/.'+ ),}).describe('The settings an edit can change. Each source kind subclasses it with a typed `source_config`.'),zod@@ -1404,6 +1500,18 @@ export const PlatformAlertsPartialUpdateBody = /* @__PURE__ */ zod.union([.max(platformAlertsPartialUpdateBodyTwoCooldownMinutesMax).optional().describe('Minimum minutes between notifications for the same alert.'),+ labels: zod+ .record(zod.string(), zod.string())+ .optional()+ .describe(+ 'Labels that say who owns the alert and how urgent it is, such as {\"team\": \"checkout\", \"severity\": \"critical\"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates.'+ ),+ annotations: zod+ .record(zod.string(), zod.string())+ .optional()+ .describe(+ 'Context for whoever responds, such as {\"runbook_url\": \"https:\/\/...\"}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https:\/\/.'+ ),}).describe('The settings an edit can change. Each source kind subclasses it with a typed `source_config`.'),zod@@ -1519,6 +1627,18 @@ export const PlatformAlertsPartialUpdateBody = /* @__PURE__ */ zod.union([.max(platformAlertsPartialUpdateBodyThreeCooldownMinutesMax).optional().describe('Minimum minutes between notifications for the same alert.'),+ labels: zod+ .record(zod.string(), zod.string())+ .optional()+ .describe(+ 'Labels that say who owns the alert and how urgent it is, such as {\"team\": \"checkout\", \"severity\": \"critical\"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates.'+ ),+ annotations: zod+ .record(zod.string(), zod.string())+ .optional()+ .describe(+ 'Context for whoever responds, such as {\"runbook_url\": \"https:\/\/...\"}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https:\/\/.'+ ),}).describe('The settings an edit can change. Each source kind subclasses it with a typed `source_config`.'),zod@@ -1646,6 +1766,18 @@ export const PlatformAlertsPartialUpdateBody = /* @__PURE__ */ zod.union([.max(platformAlertsPartialUpdateBodyFourCooldownMinutesMax).optional().describe('Minimum minutes between notifications for the same alert.'),+ labels: zod+ .record(zod.string(), zod.string())+ .optional()+ .describe(+ 'Labels that say who owns the alert and how urgent it is, such as {\"team\": \"checkout\", \"severity\": \"critical\"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates.'+ ),+ annotations: zod+ .record(zod.string(), zod.string())+ .optional()+ .describe(+ 'Context for whoever responds, such as {\"runbook_url\": \"https:\/\/...\"}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https:\/\/.'+ ),}).describe('The settings an edit can change. Each source kind subclasses it with a typed `source_config`.'),])diff --git a/products/alerts_platform/frontend/platformAlertFormat.test.ts b/products/alerts_platform/frontend/platformAlertFormat.test.tsindex 7482dc301b45..17be1c96ce18 100644--- a/products/alerts_platform/frontend/platformAlertFormat.test.ts+++ b/products/alerts_platform/frontend/platformAlertFormat.test.ts@@ -16,6 +16,8 @@ function makeConfiguration(overrides: Partial<PlatformAlertConfigurationApi> = {id: 'configuration-id',name: 'Error spike',enabled: true,+ labels: {},+ annotations: {},source_kind: 'logs',source_config: {},check_interval_minutes: 1,diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex fbac4483ea12..fccaf380c037 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -64684,6 +64684,16 @@ export namespace Schemas {Insight: 'insight',} as const;+ /**+ * Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates.+ */+ export type InsightPlatformAlertConfigurationEditLabels = {[key: string]: string};++ /**+ * Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://.+ */+ export type InsightPlatformAlertConfigurationEditAnnotations = {[key: string]: string};+export interface InsightPlatformAlertSourceConfig {/** The insight the alert checks. It cannot change through this API. */insight_id: number;@@ -64728,6 +64738,10 @@ export namespace Schemas {* @maximum 2147483647*/cooldown_minutes: number;+ /** Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates. */+ labels?: InsightPlatformAlertConfigurationEditLabels;+ /** Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://. */+ annotations?: InsightPlatformAlertConfigurationEditAnnotations;}/**@@ -68713,6 +68727,16 @@ export namespace Schemas {Logs: 'logs',} as const;+ /**+ * Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates.+ */+ export type LogsPlatformAlertConfigurationCreateLabels = {[key: string]: string};++ /**+ * Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://.+ */+ export type LogsPlatformAlertConfigurationCreateAnnotations = {[key: string]: string};+export interface LogsPlatformAlertSourceConfig {/** The logs the alert counts: severityLevels, serviceNames, or a filterGroup of property filters. An enabled alert needs at least one. */filters: LogsAlertFilters;@@ -68757,6 +68781,10 @@ export namespace Schemas {* @maximum 2147483647*/cooldown_minutes?: number;+ /** Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates. */+ labels?: LogsPlatformAlertConfigurationCreateLabels;+ /** Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://. */+ annotations?: LogsPlatformAlertConfigurationCreateAnnotations;}/**@@ -68769,6 +68797,16 @@ export namespace Schemas {Logs: 'logs',} as const;+ /**+ * Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates.+ */+ export type LogsPlatformAlertConfigurationEditLabels = {[key: string]: string};++ /**+ * Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://.+ */+ export type LogsPlatformAlertConfigurationEditAnnotations = {[key: string]: string};+/*** The settings an edit can change. Each source kind subclasses it with a typed `source_config`.*/@@ -68806,6 +68844,10 @@ export namespace Schemas {* @maximum 2147483647*/cooldown_minutes: number;+ /** Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates. */+ labels?: LogsPlatformAlertConfigurationEditLabels;+ /** Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://. */+ annotations?: LogsPlatformAlertConfigurationEditAnnotations;}export interface LogsRetentionRule {@@ -77415,6 +77457,16 @@ export namespace Schemas {*/export type PlatformAlertConfigurationSourceConfig = { [key: string]: unknown };+ /**+ * Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates.+ */+ export type PlatformAlertConfigurationLabels = {[key: string]: string};++ /**+ * Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://.+ */+ export type PlatformAlertConfigurationAnnotations = {[key: string]: string};+export interface PlatformAlertConfiguration {/** Unique identifier of the alert configuration. */readonly id: string;@@ -77492,6 +77544,10 @@ export namespace Schemas {readonly updated_at: string;/** Runtime state for each result group of this configuration. */readonly alerts: readonly PlatformAlert[];+ /** Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates. */+ readonly labels: PlatformAlertConfigurationLabels;+ /** Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://. */+ readonly annotations: PlatformAlertConfigurationAnnotations;}export interface PaginatedPlatformAlertConfigurationList {@@ -87957,6 +88013,16 @@ export namespace Schemas {Insight: 'insight',} as const;+ /**+ * Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates.+ */+ export type PatchedInsightPlatformAlertConfigurationEditLabels = {[key: string]: string};++ /**+ * Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://.+ */+ export type PatchedInsightPlatformAlertConfigurationEditAnnotations = {[key: string]: string};+/*** The settings an edit can change. Each source kind subclasses it with a typed `source_config`.*/@@ -87994,6 +88060,10 @@ export namespace Schemas {* @maximum 2147483647*/cooldown_minutes?: number;+ /** Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates. */+ labels?: PatchedInsightPlatformAlertConfigurationEditLabels;+ /** Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://. */+ annotations?: PatchedInsightPlatformAlertConfigurationEditAnnotations;}export interface PatchedInsightVariable {@@ -88369,6 +88439,16 @@ export namespace Schemas {Logs: 'logs',} as const;+ /**+ * Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates.+ */+ export type PatchedLogsPlatformAlertConfigurationEditLabels = {[key: string]: string};++ /**+ * Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://.+ */+ export type PatchedLogsPlatformAlertConfigurationEditAnnotations = {[key: string]: string};+/*** The settings an edit can change. Each source kind subclasses it with a typed `source_config`.*/@@ -88406,6 +88486,10 @@ export namespace Schemas {* @maximum 2147483647*/cooldown_minutes?: number;+ /** Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates. */+ labels?: PatchedLogsPlatformAlertConfigurationEditLabels;+ /** Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://. */+ annotations?: PatchedLogsPlatformAlertConfigurationEditAnnotations;}export interface PatchedLogsRetentionRule {@@ -89157,6 +89241,16 @@ export namespace Schemas {email_project_members?: boolean;}+ /**+ * Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates.+ */+ export type PatchedWarehouseDestinationPlatformAlertConfigurationEditLabels = {[key: string]: string};++ /**+ * Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://.+ */+ export type PatchedWarehouseDestinationPlatformAlertConfigurationEditAnnotations = {[key: string]: string};+/*** The settings an edit can change. Each source kind subclasses it with a typed `source_config`.*/@@ -89194,6 +89288,10 @@ export namespace Schemas {* @maximum 2147483647*/cooldown_minutes?: number;+ /** Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates. */+ labels?: PatchedWarehouseDestinationPlatformAlertConfigurationEditLabels;+ /** Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://. */+ annotations?: PatchedWarehouseDestinationPlatformAlertConfigurationEditAnnotations;}/**@@ -89228,6 +89326,16 @@ export namespace Schemas {email_project_members?: boolean;}+ /**+ * Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates.+ */+ export type PatchedWarehouseSourcePlatformAlertConfigurationEditLabels = {[key: string]: string};++ /**+ * Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://.+ */+ export type PatchedWarehouseSourcePlatformAlertConfigurationEditAnnotations = {[key: string]: string};+/*** The settings an edit can change. Each source kind subclasses it with a typed `source_config`.*/@@ -89265,6 +89373,10 @@ export namespace Schemas {* @maximum 2147483647*/cooldown_minutes?: number;+ /** Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates. */+ labels?: PatchedWarehouseSourcePlatformAlertConfigurationEditLabels;+ /** Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://. */+ annotations?: PatchedWarehouseSourcePlatformAlertConfigurationEditAnnotations;}export type PatchedPlatformAlertConfigurationEdit = PatchedInsightPlatformAlertConfigurationEdit | PatchedLogsPlatformAlertConfigurationEdit | PatchedWarehouseDestinationPlatformAlertConfigurationEdit | PatchedWarehouseSourcePlatformAlertConfigurationEdit;@@ -94394,6 +94506,16 @@ export namespace Schemas {WarehouseDestination: 'warehouse_destination',} as const;+ /**+ * Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates.+ */+ export type WarehouseDestinationPlatformAlertConfigurationCreateLabels = {[key: string]: string};++ /**+ * Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://.+ */+ export type WarehouseDestinationPlatformAlertConfigurationCreateAnnotations = {[key: string]: string};+/*** The settings of a new alert. Every one but source_config has a default, which is stored.*/@@ -94431,6 +94553,10 @@ export namespace Schemas {* @maximum 2147483647*/cooldown_minutes?: number;+ /** Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates. */+ labels?: WarehouseDestinationPlatformAlertConfigurationCreateLabels;+ /** Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://. */+ annotations?: WarehouseDestinationPlatformAlertConfigurationCreateAnnotations;}/**@@ -94443,6 +94569,16 @@ export namespace Schemas {WarehouseSource: 'warehouse_source',} as const;+ /**+ * Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates.+ */+ export type WarehouseSourcePlatformAlertConfigurationCreateLabels = {[key: string]: string};++ /**+ * Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://.+ */+ export type WarehouseSourcePlatformAlertConfigurationCreateAnnotations = {[key: string]: string};+/*** The settings of a new alert. Every one but source_config has a default, which is stored.*/@@ -94480,6 +94616,10 @@ export namespace Schemas {* @maximum 2147483647*/cooldown_minutes?: number;+ /** Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates. */+ labels?: WarehouseSourcePlatformAlertConfigurationCreateLabels;+ /** Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://. */+ annotations?: WarehouseSourcePlatformAlertConfigurationCreateAnnotations;}export type PlatformAlertConfigurationCreate = LogsPlatformAlertConfigurationCreate | WarehouseDestinationPlatformAlertConfigurationCreate | WarehouseSourcePlatformAlertConfigurationCreate;@@ -94494,6 +94634,16 @@ export namespace Schemas {WarehouseDestination: 'warehouse_destination',} as const;+ /**+ * Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates.+ */+ export type WarehouseDestinationPlatformAlertConfigurationEditLabels = {[key: string]: string};++ /**+ * Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://.+ */+ export type WarehouseDestinationPlatformAlertConfigurationEditAnnotations = {[key: string]: string};+/*** The settings an edit can change. Each source kind subclasses it with a typed `source_config`.*/@@ -94531,6 +94681,10 @@ export namespace Schemas {* @maximum 2147483647*/cooldown_minutes: number;+ /** Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates. */+ labels?: WarehouseDestinationPlatformAlertConfigurationEditLabels;+ /** Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://. */+ annotations?: WarehouseDestinationPlatformAlertConfigurationEditAnnotations;}/**@@ -94543,6 +94697,16 @@ export namespace Schemas {WarehouseSource: 'warehouse_source',} as const;+ /**+ * Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates.+ */+ export type WarehouseSourcePlatformAlertConfigurationEditLabels = {[key: string]: string};++ /**+ * Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://.+ */+ export type WarehouseSourcePlatformAlertConfigurationEditAnnotations = {[key: string]: string};+/*** The settings an edit can change. Each source kind subclasses it with a typed `source_config`.*/@@ -94580,6 +94744,10 @@ export namespace Schemas {* @maximum 2147483647*/cooldown_minutes: number;+ /** Labels that say who owns the alert and how urgent it is, such as {"team": "checkout", "severity": "critical"}. Names use letters, digits and underscores. alertname and names that start with posthog_ are reserved. Values cannot use templates. */+ labels?: WarehouseSourcePlatformAlertConfigurationEditLabels;+ /** Context for whoever responds, such as {"runbook_url": "https://..."}. Values can use {{ $labels.<name> }} for a grouping key or label of the alert, and {{ $value }}. An annotation whose name ends in _url must start with https://. */+ annotations?: WarehouseSourcePlatformAlertConfigurationEditAnnotations;}export type PlatformAlertConfigurationEdit = InsightPlatformAlertConfigurationEdit | LogsPlatformAlertConfigurationEdit | WarehouseDestinationPlatformAlertConfigurationEdit | WarehouseSourcePlatformAlertConfigurationEdit;