File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 55import sys
66import threading
77import time
8+ import warnings
89import zlib
910from abc import ABC , abstractmethod
1011from contextlib import contextmanager
5455 from sentry_sdk ._types import MetricValue
5556
5657
58+ warnings .warn (
59+ "The sentry_sdk.metrics module is deprecated and will be removed in the next major release. "
60+ "Sentry will reject all metrics sent after October 7, 2024. "
61+ "Learn more: https://sentry.zendesk.com/hc/en-us/articles/26369339769883-Upcoming-API-Changes-to-Metrics" ,
62+ DeprecationWarning ,
63+ stacklevel = 2 ,
64+ )
65+
5766_in_metrics = ContextVar ("in_metrics" , default = False )
5867_set = set # set is shadowed below
5968
Original file line number Diff line number Diff line change @@ -1298,4 +1298,8 @@ async def my_async_function():
12981298 has_tracing_enabled ,
12991299 maybe_create_breadcrumbs_from_span ,
13001300)
1301- from sentry_sdk .metrics import LocalAggregator
1301+
1302+ with warnings .catch_warnings ():
1303+ # The code in this file which uses `LocalAggregator` is only called from the deprecated `metrics` module.
1304+ warnings .simplefilter ("ignore" , DeprecationWarning )
1305+ from sentry_sdk .metrics import LocalAggregator
You can’t perform that action at this time.
0 commit comments