File tree 2 files changed +14
-1
lines changed
2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 5
5
import sys
6
6
import threading
7
7
import time
8
+ import warnings
8
9
import zlib
9
10
from abc import ABC , abstractmethod
10
11
from contextlib import contextmanager
54
55
from sentry_sdk ._types import MetricValue
55
56
56
57
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
+
57
66
_in_metrics = ContextVar ("in_metrics" , default = False )
58
67
_set = set # set is shadowed below
59
68
Original file line number Diff line number Diff line change @@ -1298,4 +1298,8 @@ async def my_async_function():
1298
1298
has_tracing_enabled ,
1299
1299
maybe_create_breadcrumbs_from_span ,
1300
1300
)
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