Skip to content

Commit 998e59c

Browse files
authored
Merge branch 'master' into langchain-2.0
2 parents 27afb81 + 8d21a84 commit 998e59c

File tree

17 files changed

+84
-38
lines changed

17 files changed

+84
-38
lines changed

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# Changelog
22

3+
## 2.0.1
4+
5+
### Various fixes & improvements
6+
7+
- Fix: Do not use convenience decorator (#3022) by @sentrivana
8+
- Refactoring propagation context (#2970) by @antonpirker
9+
- Use `pid` for test database name in Django tests (#2998) by @antonpirker
10+
- Remove outdated RC mention in docs (#3018) by @sentrivana
11+
- Delete inaccurate comment from docs (#3002) by @szokeasaurusrex
12+
- Add Lambda function that deletes test Lambda functions (#2960) by @antonpirker
13+
- Correct discarded transaction debug message (#3002) by @szokeasaurusrex
14+
- Add tests for discarded transaction debug messages (#3002) by @szokeasaurusrex
15+
- Fix comment typo in metrics (#2992) by @szokeasaurusrex
16+
- build(deps): bump actions/checkout from 4.1.1 to 4.1.4 (#3011) by @dependabot
17+
- build(deps): bump checkouts/data-schemas from `1e17eb5` to `4aa14a7` (#2997) by @dependabot
18+
319
## 2.0.0
420

521
This is the first major update in a *long* time!

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
copyright = "2019-{}, Sentry Team and Contributors".format(datetime.now().year)
2929
author = "Sentry Team and Contributors"
3030

31-
release = "2.0.0"
31+
release = "2.0.1"
3232
version = ".".join(release.split(".")[:2]) # The short X.Y version.
3333

3434

sentry_sdk/consts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,4 +429,4 @@ def _get_default_options():
429429
del _get_default_options
430430

431431

432-
VERSION = "2.0.0"
432+
VERSION = "2.0.1"

sentry_sdk/integrations/aiohttp.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
from sentry_sdk.utils import (
2222
capture_internal_exceptions,
2323
ensure_integration_enabled,
24-
ensure_integration_enabled_async,
2524
event_from_exception,
2625
logger,
2726
parse_url,
@@ -98,9 +97,11 @@ def setup_once():
9897

9998
old_handle = Application._handle
10099

101-
@ensure_integration_enabled_async(AioHttpIntegration, old_handle)
102100
async def sentry_app_handle(self, request, *args, **kwargs):
103101
# type: (Any, Request, *Any, **Any) -> Any
102+
if sentry_sdk.get_client().get_integration(AioHttpIntegration) is None:
103+
return await old_handle(self, request, *args, **kwargs)
104+
104105
weak_request = weakref.ref(request)
105106

106107
with sentry_sdk.isolation_scope() as scope:
@@ -190,9 +191,11 @@ def init(*args, **kwargs):
190191
def create_trace_config():
191192
# type: () -> TraceConfig
192193

193-
@ensure_integration_enabled_async(AioHttpIntegration)
194194
async def on_request_start(session, trace_config_ctx, params):
195195
# type: (ClientSession, SimpleNamespace, TraceRequestStartParams) -> None
196+
if sentry_sdk.get_client().get_integration(AioHttpIntegration) is None:
197+
return
198+
196199
method = params.method.upper()
197200

198201
parsed_url = None

sentry_sdk/integrations/arq.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
from sentry_sdk.utils import (
1111
capture_internal_exceptions,
1212
ensure_integration_enabled,
13-
ensure_integration_enabled_async,
1413
event_from_exception,
1514
SENSITIVE_DATA_SUBSTITUTE,
1615
parse_version,
@@ -71,9 +70,12 @@ def patch_enqueue_job():
7170
# type: () -> None
7271
old_enqueue_job = ArqRedis.enqueue_job
7372

74-
@ensure_integration_enabled_async(ArqIntegration, old_enqueue_job)
7573
async def _sentry_enqueue_job(self, function, *args, **kwargs):
7674
# type: (ArqRedis, str, *Any, **Any) -> Optional[Job]
75+
integration = sentry_sdk.get_client().get_integration(ArqIntegration)
76+
if integration is None:
77+
return await old_enqueue_job(self, function, *args, **kwargs)
78+
7779
with sentry_sdk.start_span(op=OP.QUEUE_SUBMIT_ARQ, description=function):
7880
return await old_enqueue_job(self, function, *args, **kwargs)
7981

@@ -84,9 +86,12 @@ def patch_run_job():
8486
# type: () -> None
8587
old_run_job = Worker.run_job
8688

87-
@ensure_integration_enabled_async(ArqIntegration, old_run_job)
8889
async def _sentry_run_job(self, job_id, score):
8990
# type: (Worker, str, int) -> None
91+
integration = sentry_sdk.get_client().get_integration(ArqIntegration)
92+
if integration is None:
93+
return await old_run_job(self, job_id, score)
94+
9095
with sentry_sdk.isolation_scope() as scope:
9196
scope._name = "arq"
9297
scope.clear_breadcrumbs()
@@ -157,9 +162,12 @@ def event_processor(event, hint):
157162
def _wrap_coroutine(name, coroutine):
158163
# type: (str, WorkerCoroutine) -> WorkerCoroutine
159164

160-
@ensure_integration_enabled_async(ArqIntegration, coroutine)
161165
async def _sentry_coroutine(ctx, *args, **kwargs):
162166
# type: (Dict[Any, Any], *Any, **Any) -> Any
167+
integration = sentry_sdk.get_client().get_integration(ArqIntegration)
168+
if integration is None:
169+
return await coroutine(ctx, *args, **kwargs)
170+
163171
Scope.get_isolation_scope().add_event_processor(
164172
_make_event_processor({**ctx, "job_name": name}, *args, **kwargs)
165173
)

sentry_sdk/integrations/asyncpg.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from sentry_sdk.tracing_utils import add_query_source, record_sql_queries
1010
from sentry_sdk.utils import (
1111
ensure_integration_enabled,
12-
ensure_integration_enabled_async,
1312
parse_version,
1413
capture_internal_exceptions,
1514
)
@@ -58,8 +57,10 @@ def setup_once() -> None:
5857

5958

6059
def _wrap_execute(f: Callable[..., Awaitable[T]]) -> Callable[..., Awaitable[T]]:
61-
@ensure_integration_enabled_async(AsyncPGIntegration, f)
6260
async def _inner(*args: Any, **kwargs: Any) -> T:
61+
if sentry_sdk.get_client().get_integration(AsyncPGIntegration) is None:
62+
return await f(*args, **kwargs)
63+
6364
# Avoid recording calls to _execute twice.
6465
# Calls to Connection.execute with args also call
6566
# Connection._execute, which is recorded separately
@@ -110,8 +111,9 @@ def _record(
110111
def _wrap_connection_method(
111112
f: Callable[..., Awaitable[T]], *, executemany: bool = False
112113
) -> Callable[..., Awaitable[T]]:
113-
@ensure_integration_enabled_async(AsyncPGIntegration, f)
114114
async def _inner(*args: Any, **kwargs: Any) -> T:
115+
if sentry_sdk.get_client().get_integration(AsyncPGIntegration) is None:
116+
return await f(*args, **kwargs)
115117
query = args[1]
116118
params_list = args[2] if len(args) > 2 else None
117119
with _record(None, query, params_list, executemany=executemany) as span:
@@ -145,8 +147,10 @@ def _inner(*args: Any, **kwargs: Any) -> T: # noqa: N807
145147

146148

147149
def _wrap_connect_addr(f: Callable[..., Awaitable[T]]) -> Callable[..., Awaitable[T]]:
148-
@ensure_integration_enabled_async(AsyncPGIntegration, f)
149150
async def _inner(*args: Any, **kwargs: Any) -> T:
151+
if sentry_sdk.get_client().get_integration(AsyncPGIntegration) is None:
152+
return await f(*args, **kwargs)
153+
150154
user = kwargs["params"].user
151155
database = kwargs["params"].database
152156

sentry_sdk/integrations/django/asgi.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
from sentry_sdk.utils import (
2222
capture_internal_exceptions,
2323
ensure_integration_enabled,
24-
ensure_integration_enabled_async,
2524
)
2625

2726

@@ -72,9 +71,11 @@ def patch_django_asgi_handler_impl(cls):
7271

7372
old_app = cls.__call__
7473

75-
@ensure_integration_enabled_async(DjangoIntegration, old_app)
7674
async def sentry_patched_asgi_handler(self, scope, receive, send):
7775
# type: (Any, Any, Any, Any) -> Any
76+
if sentry_sdk.get_client().get_integration(DjangoIntegration) is None:
77+
return await old_app(self, scope, receive, send)
78+
7879
middleware = SentryAsgiMiddleware(
7980
old_app.__get__(self, cls), unsafe_context_data=True
8081
)._run_asgi3
@@ -120,9 +121,11 @@ def patch_channels_asgi_handler_impl(cls):
120121
if channels.__version__ < "3.0.0":
121122
old_app = cls.__call__
122123

123-
@ensure_integration_enabled_async(DjangoIntegration, old_app)
124124
async def sentry_patched_asgi_handler(self, receive, send):
125125
# type: (Any, Any, Any) -> Any
126+
if sentry_sdk.get_client().get_integration(DjangoIntegration) is None:
127+
return await old_app(self, receive, send)
128+
126129
middleware = SentryAsgiMiddleware(
127130
lambda _scope: old_app.__get__(self, cls), unsafe_context_data=True
128131
)

sentry_sdk/integrations/fastapi.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
from sentry_sdk.utils import (
1111
transaction_from_function,
1212
logger,
13-
ensure_integration_enabled_async,
1413
)
1514

1615
if TYPE_CHECKING:
@@ -97,9 +96,11 @@ def _sentry_call(*args, **kwargs):
9796

9897
old_app = old_get_request_handler(*args, **kwargs)
9998

100-
@ensure_integration_enabled_async(FastApiIntegration, old_app)
10199
async def _sentry_app(*args, **kwargs):
102100
# type: (*Any, **Any) -> Any
101+
if sentry_sdk.get_client().get_integration(FastApiIntegration) is None:
102+
return await old_app(*args, **kwargs)
103+
103104
integration = sentry_sdk.get_client().get_integration(FastApiIntegration)
104105
request = args[0]
105106

sentry_sdk/integrations/graphene.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from sentry_sdk.utils import (
55
capture_internal_exceptions,
66
ensure_integration_enabled,
7-
ensure_integration_enabled_async,
87
event_from_exception,
98
package_version,
109
)
@@ -69,9 +68,11 @@ def _sentry_patched_graphql_sync(schema, source, *args, **kwargs):
6968

7069
return result
7170

72-
@ensure_integration_enabled_async(GrapheneIntegration, old_graphql_async)
7371
async def _sentry_patched_graphql_async(schema, source, *args, **kwargs):
7472
# type: (GraphQLSchema, Union[str, Source], Any, Any) -> ExecutionResult
73+
if sentry_sdk.get_client().get_integration(GrapheneIntegration) is None:
74+
return await old_graphql_async(schema, source, *args, **kwargs)
75+
7576
scope = Scope.get_isolation_scope()
7677
scope.add_event_processor(_event_processor)
7778

sentry_sdk/integrations/httpx.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
SENSITIVE_DATA_SUBSTITUTE,
99
capture_internal_exceptions,
1010
ensure_integration_enabled,
11-
ensure_integration_enabled_async,
1211
logger,
1312
parse_url,
1413
)
@@ -98,9 +97,11 @@ def _install_httpx_async_client():
9897
# type: () -> None
9998
real_send = AsyncClient.send
10099

101-
@ensure_integration_enabled_async(HttpxIntegration, real_send)
102100
async def send(self, request, **kwargs):
103101
# type: (AsyncClient, Request, **Any) -> Response
102+
if sentry_sdk.get_client().get_integration(HttpxIntegration) is None:
103+
return await real_send(self, request, **kwargs)
104+
104105
parsed_url = None
105106
with capture_internal_exceptions():
106107
parsed_url = parse_url(str(request.url), sanitize=False)

0 commit comments

Comments
 (0)