Skip to content

ref(metrics): Deprecate sentry_sdk.metrics #3512

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions sentry_sdk/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import sys
import threading
import time
import warnings
import zlib
from abc import ABC, abstractmethod
from contextlib import contextmanager
Expand Down Expand Up @@ -54,6 +55,14 @@
from sentry_sdk._types import MetricValue


warnings.warn(
"The sentry_sdk.metrics module is deprecated and will be removed in the next major release. "
"Sentry will reject all metrics sent after October 7, 2024. "
"Learn more: https://sentry.zendesk.com/hc/en-us/articles/26369339769883-Upcoming-API-Changes-to-Metrics",
DeprecationWarning,
stacklevel=2,
)

_in_metrics = ContextVar("in_metrics", default=False)
_set = set # set is shadowed below

Expand Down
6 changes: 5 additions & 1 deletion sentry_sdk/tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1298,4 +1298,8 @@ async def my_async_function():
has_tracing_enabled,
maybe_create_breadcrumbs_from_span,
)
from sentry_sdk.metrics import LocalAggregator

with warnings.catch_warnings():
# The code in this file which uses `LocalAggregator` is only called from the deprecated `metrics` module.
warnings.simplefilter("ignore", DeprecationWarning)
from sentry_sdk.metrics import LocalAggregator
Loading