Skip to content

Commit 0d2da2c

Browse files
authored
feat(integrations): Send SLO lifecycle metrics to Sentry via SDK (#112839)
## Summary - Adds a direct `sentry_sdk.metrics.count()` call in `EventLifecycle.record_event()` so SLO metrics (`started`, `success`, `halted`, `failure`) are sent to Sentry's metrics product at 100% with `integration_id` included as a tag. - The existing `metrics.incr()` call (Datadog) is untouched. - This bypasses the `DualWriteMetricsBackend` experimental backend which only samples at 5%, giving us full-fidelity SLO data in Sentry without the cardinality cost on Datadog. Companion PR in seer: https://github.com/getsentry/seer/pull/new/telkins/slo-sentry-metrics ## Test plan - [ ] Verify metric appears in Sentry Metrics explorer as `sentry.integrations.slo.started` with `integration_id` tag - [ ] Confirm existing Datadog metrics are unaffected
1 parent f572c9b commit 0d2da2c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/sentry/integrations/utils/metrics.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from typing import Any, Self
99

1010
import sentry_sdk
11+
from django.conf import settings
1112

1213
from sentry import options
1314
from sentry.exceptions import RestrictedIPAddress
@@ -167,6 +168,7 @@ def record_event(
167168

168169
sample_rate = 1.0
169170
metrics.incr(key, tags=tags, sample_rate=sample_rate)
171+
sentry_sdk.metrics.count(f"{settings.SENTRY_METRICS_PREFIX}{key}", 1, attributes=dict(tags))
170172

171173
sentry_sdk.set_tags(tags)
172174

0 commit comments

Comments
 (0)