From e22abb636fcb06f0723191e977da767e9e07ccb9 Mon Sep 17 00:00:00 2001 From: Michi Hoffmann Date: Wed, 10 Apr 2024 14:27:26 +0200 Subject: [PATCH] fix(metrics): Change `data_category` from `statsd` to `metric_bucket` (#2954) The event category for emitted metrics is metric_bucket and not statsd. --------- Co-authored-by: Anton Pirker --- sentry_sdk/_types.py | 2 +- sentry_sdk/envelope.py | 2 +- sentry_sdk/transport.py | 5 ----- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/sentry_sdk/_types.py b/sentry_sdk/_types.py index 91208e51d4..368db17138 100644 --- a/sentry_sdk/_types.py +++ b/sentry_sdk/_types.py @@ -113,7 +113,7 @@ "session", "internal", "profile", - "statsd", + "metric_bucket", "monitor", ] SessionStatus = Literal["ok", "exited", "crashed", "abnormal"] diff --git a/sentry_sdk/envelope.py b/sentry_sdk/envelope.py index 8f89bda238..fb214a45f4 100644 --- a/sentry_sdk/envelope.py +++ b/sentry_sdk/envelope.py @@ -261,7 +261,7 @@ def data_category(self): elif ty == "profile": return "profile" elif ty == "statsd": - return "statsd" + return "metric_bucket" elif ty == "check_in": return "monitor" else: diff --git a/sentry_sdk/transport.py b/sentry_sdk/transport.py index 6388667ceb..d2fc734f7c 100644 --- a/sentry_sdk/transport.py +++ b/sentry_sdk/transport.py @@ -222,11 +222,6 @@ def record_lost_event( # quantity of 0 is actually 1 as we do not want to count # empty attachments as actually empty. quantity = len(item.get_bytes()) or 1 - if data_category == "statsd": - # The envelope item type used for metrics is statsd - # whereas the client report category for discarded events - # is metric_bucket - data_category = "metric_bucket" elif data_category is None: raise TypeError("data category not provided")