Skip to content

Commit a2ff75c

Browse files
committed
fixes, more tests
1 parent f33e407 commit a2ff75c

File tree

3 files changed

+241
-71
lines changed

3 files changed

+241
-71
lines changed

sentry_sdk/integrations/wsgi.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from sentry_sdk.scope import should_send_default_pii, use_isolation_scope
1616
from sentry_sdk.sessions import track_session
1717
from sentry_sdk.traces import StreamedSpan, SegmentSource
18-
from sentry_sdk.tracing import Transaction, TransactionSource
18+
from sentry_sdk.tracing import Span, TransactionSource
1919
from sentry_sdk.tracing_utils import has_span_streaming_enabled
2020
from sentry_sdk.utils import (
2121
ContextVar,
@@ -127,13 +127,13 @@ def __call__(
127127

128128
method = environ.get("REQUEST_METHOD", "").upper()
129129

130-
span_ctx: "ContextManager[Union[Transaction, StreamedSpan, None]]" = None
130+
span_ctx: "Optional[ContextManager[Union[Span, StreamedSpan, None]]]" = None
131131
if method in self.http_methods_to_capture:
132132
if span_streaming:
133133
sentry_sdk.traces.continue_trace(
134134
dict(_get_headers(environ))
135135
)
136-
scope.set_custom_sampling_context({"wsgi_environ": scope})
136+
scope.set_custom_sampling_context({"wsgi_environ": environ})
137137

138138
span_ctx = sentry_sdk.traces.start_span(
139139
name=_DEFAULT_TRANSACTION_NAME,
@@ -222,7 +222,7 @@ def __call__(
222222

223223
def _sentry_start_response(
224224
old_start_response: "StartResponse",
225-
span: "Optional[Union[Transaction, StreamedSpan]]",
225+
span: "Optional[Union[Span, StreamedSpan]]",
226226
status: str,
227227
response_headers: "WsgiResponseHeaders",
228228
exc_info: "Optional[WsgiExcInfo]" = None,

sentry_sdk/scope.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ def get_active_propagation_context(self) -> "PropagationContext":
714714
def set_custom_sampling_context(
715715
self, custom_sampling_context: "dict[str, Any]"
716716
) -> None:
717-
self.get_active_propagation_context()._set_custom_sampling_context(
717+
self.get_current_scope().get_active_propagation_context()._set_custom_sampling_context(
718718
custom_sampling_context
719719
)
720720

0 commit comments

Comments
 (0)