From 7123e8ddf86d22ec52d94a3afc8568762e96ae66 Mon Sep 17 00:00:00 2001 From: Alexander Alderman Webb Date: Fri, 31 Oct 2025 13:04:02 +0100 Subject: [PATCH 1/5] feat(python): Metrics in open beta --- docs/platforms/python/metrics/index.mdx | 6 +----- platform-includes/metrics/options/python.mdx | 1 - platform-includes/metrics/requirements/python.mdx | 2 +- platform-includes/metrics/setup/python.mdx | 10 ---------- 4 files changed, 2 insertions(+), 17 deletions(-) delete mode 100644 platform-includes/metrics/setup/python.mdx diff --git a/docs/platforms/python/metrics/index.mdx b/docs/platforms/python/metrics/index.mdx index f363173e3ea51f..dee9d349e62a22 100644 --- a/docs/platforms/python/metrics/index.mdx +++ b/docs/platforms/python/metrics/index.mdx @@ -7,7 +7,7 @@ sidebar_order: 5755 -This feature is currently in limited beta. Please reach out on [GitHub](https://github.com/getsentry/sentry-python/discussions/5042) if you have feedback or questions. Features in beta are still in-progress and may have bugs. We recognize the irony. +This feature is currently in open beta. Please reach out on [GitHub](https://github.com/getsentry/sentry-python/discussions/5042) if you have feedback or questions. Features in beta are still in-progress and may have bugs. We recognize the irony. @@ -17,10 +17,6 @@ With Sentry Metrics, you can send counters, gauges and distributions from your a -## Setup - - - ## Usage diff --git a/platform-includes/metrics/options/python.mdx b/platform-includes/metrics/options/python.mdx index c4b1065a903cee..aff97d74795254 100644 --- a/platform-includes/metrics/options/python.mdx +++ b/platform-includes/metrics/options/python.mdx @@ -17,7 +17,6 @@ def before_metric(metric: Metric, _hint: Hint) -> Optional[Metric]: sentry_sdk.init( dsn="___PUBLIC_DSN___", _experiments={ - "enable_metrics": True, "before_send_metric": before_metric, }, ) diff --git a/platform-includes/metrics/requirements/python.mdx b/platform-includes/metrics/requirements/python.mdx index 2761e66ebf0a04..d5a535c7dbd39d 100644 --- a/platform-includes/metrics/requirements/python.mdx +++ b/platform-includes/metrics/requirements/python.mdx @@ -1,4 +1,4 @@ -Metrics for Python are supported in Sentry Python SDK version `2.43.0` and above. +Metrics for Python are supported in Sentry Python SDK version `2.44.0` and above. ```bash {tabTitle:pip} pip install "sentry-sdk" diff --git a/platform-includes/metrics/setup/python.mdx b/platform-includes/metrics/setup/python.mdx deleted file mode 100644 index 2f6c90d04b9a9a..00000000000000 --- a/platform-includes/metrics/setup/python.mdx +++ /dev/null @@ -1,10 +0,0 @@ -To enable metrics, you need to initialize the SDK with the `enable_metrics` option set to `True`. - -```python -sentry_sdk.init( - dsn="___PUBLIC_DSN___", - _experiments={ - enable_metrics: True, - }, -) -``` From 99d50b70f201c0c75d3572e9df1f6920050d1258 Mon Sep 17 00:00:00 2001 From: Alexander Alderman Webb Date: Mon, 10 Nov 2025 17:05:16 +0100 Subject: [PATCH 2/5] move before_send_metric out of experiments --- platform-includes/metrics/options/python.mdx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/platform-includes/metrics/options/python.mdx b/platform-includes/metrics/options/python.mdx index aff97d74795254..f07f5a0b035ec7 100644 --- a/platform-includes/metrics/options/python.mdx +++ b/platform-includes/metrics/options/python.mdx @@ -16,9 +16,7 @@ def before_metric(metric: Metric, _hint: Hint) -> Optional[Metric]: sentry_sdk.init( dsn="___PUBLIC_DSN___", - _experiments={ - "before_send_metric": before_metric, - }, + before_send_metric=before_metric, ) ``` From 717f9d3bab105ef763b4603bb001b8e9845909b9 Mon Sep 17 00:00:00 2001 From: Alexander Alderman Webb Date: Tue, 11 Nov 2025 10:41:27 +0100 Subject: [PATCH 3/5] update unit type --- platform-includes/metrics/options/python.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform-includes/metrics/options/python.mdx b/platform-includes/metrics/options/python.mdx index f07f5a0b035ec7..5e2463ff774a1e 100644 --- a/platform-includes/metrics/options/python.mdx +++ b/platform-includes/metrics/options/python.mdx @@ -27,7 +27,7 @@ The metric dict has the following keys: - `name`: (`str`) The name of the metric. - `type`: (`str` - one of `counter`, `gauge`, `distribution`) The type of metric. - `value`: (`float`) The numeric value of the metric. -- `unit`: (`int`) The unit of measurement for the metric value. +- `unit`: (`str`) The unit of measurement for the metric value. - `attributes`: (`dict[str, str | bool | float | int]`) Additional attributes to be sent with the metric. - `timestamp`: (`float`) Timestamp in seconds (epoch time) indicating when the metric was recorded. - `trace_id`: (`Optional[str]`) The trace ID of the trace this metric belongs to. From e065f5c19ec58014739abeeda9b7ef126b568f67 Mon Sep 17 00:00:00 2001 From: Alexander Alderman Webb Date: Tue, 11 Nov 2025 10:46:54 +0100 Subject: [PATCH 4/5] correct metric dict --- platform-includes/metrics/options/python.mdx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platform-includes/metrics/options/python.mdx b/platform-includes/metrics/options/python.mdx index 5e2463ff774a1e..bb6fd7b0b230ad 100644 --- a/platform-includes/metrics/options/python.mdx +++ b/platform-includes/metrics/options/python.mdx @@ -27,7 +27,8 @@ The metric dict has the following keys: - `name`: (`str`) The name of the metric. - `type`: (`str` - one of `counter`, `gauge`, `distribution`) The type of metric. - `value`: (`float`) The numeric value of the metric. -- `unit`: (`str`) The unit of measurement for the metric value. +- `unit`: (`Optional[str]`) The unit of measurement for the metric value. - `attributes`: (`dict[str, str | bool | float | int]`) Additional attributes to be sent with the metric. - `timestamp`: (`float`) Timestamp in seconds (epoch time) indicating when the metric was recorded. - `trace_id`: (`Optional[str]`) The trace ID of the trace this metric belongs to. +- `span_id`: (`Optional[str]`) The span id of the span that was active when the metric was emitted. From be45993cec6e84ba88d69c50e17aaddb81a71c65 Mon Sep 17 00:00:00 2001 From: Alexander Alderman Webb Date: Tue, 11 Nov 2025 11:01:18 +0100 Subject: [PATCH 5/5] keep limited beta --- docs/platforms/python/metrics/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/platforms/python/metrics/index.mdx b/docs/platforms/python/metrics/index.mdx index dee9d349e62a22..eb28c28fb6d3e4 100644 --- a/docs/platforms/python/metrics/index.mdx +++ b/docs/platforms/python/metrics/index.mdx @@ -7,7 +7,7 @@ sidebar_order: 5755 -This feature is currently in open beta. Please reach out on [GitHub](https://github.com/getsentry/sentry-python/discussions/5042) if you have feedback or questions. Features in beta are still in-progress and may have bugs. We recognize the irony. +This feature is currently in limited beta. Please reach out on [GitHub](https://github.com/getsentry/sentry-python/discussions/5042) if you have feedback or questions. Features in beta are still in-progress and may have bugs. We recognize the irony.