Skip to content

Commit 70414fe

Browse files
committed
fix(boto3): make logic clearer
1 parent 39ee4ea commit 70414fe

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

‎sentry_sdk/integrations/boto3/_client.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,11 @@ def sentry_patched_make_api_call(
108108
service_ext: "Optional[_ServiceExtension]" = None
109109
with capture_internal_exceptions():
110110
# resolve service extension for service-specific enrichment.
111-
service_ext = _resolve_service(ctx.service_name)
111+
service_ext = (
112+
_resolve_service(ctx.service_name)
113+
if ctx.service_name is not None
114+
else None
115+
)
112116

113117
span: "Optional[Union[Span, StreamedSpan]]" = None
114118
with capture_internal_exceptions():

‎sentry_sdk/integrations/boto3/_services/registry.py‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,12 @@
88

99
# when py 3.15 drops, we might want to take a look at using
1010
# a lazy-loading approach using the new `lazy` keyword.
11-
# e.g. {"s3": _S3Extension}
11+
# e.g. {"s3": _S3Extension()}
1212
_SERVICE_EXTENSIONS: "Dict[str, _ServiceExtension]" = {}
1313

1414

1515
def _resolve_service(
1616
service_name: "str",
1717
) -> "Optional[_ServiceExtension]":
18-
if service_name in _SERVICE_EXTENSIONS:
19-
return _SERVICE_EXTENSIONS[service_name]
2018
# preserve generic instrumentation when lookup fails.
21-
return None
19+
return _SERVICE_EXTENSIONS.get(service_name)

0 commit comments

Comments
 (0)