From 1110e33fc1b84b666d328859c69a80f9fbcfb994 Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Wed, 14 Jan 2026 15:46:22 +0100 Subject: [PATCH 1/2] chore: Add type for metric units --- sentry_sdk/_types.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sentry_sdk/_types.py b/sentry_sdk/_types.py index a39e27d884..672232d781 100644 --- a/sentry_sdk/_types.py +++ b/sentry_sdk/_types.py @@ -256,6 +256,7 @@ class SDKInfo(TypedDict): ) MetricType = Literal["counter", "gauge", "distribution"] + MetricUnit = Union[DurationUnit, InformationUnit] Metric = TypedDict( "Metric", @@ -266,7 +267,7 @@ class SDKInfo(TypedDict): "name": str, "type": MetricType, "value": float, - "unit": Optional[str], + "unit": Optional[MetricUnit], "attributes": Attributes, }, ) From 7fc46c4f9ceff87d48743471e44e5eac360b291b Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Wed, 14 Jan 2026 15:52:51 +0100 Subject: [PATCH 2/2] . --- sentry_sdk/_types.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sentry_sdk/_types.py b/sentry_sdk/_types.py index 672232d781..0ae3e653a7 100644 --- a/sentry_sdk/_types.py +++ b/sentry_sdk/_types.py @@ -256,7 +256,7 @@ class SDKInfo(TypedDict): ) MetricType = Literal["counter", "gauge", "distribution"] - MetricUnit = Union[DurationUnit, InformationUnit] + MetricUnit = Union[DurationUnit, InformationUnit, str] Metric = TypedDict( "Metric",