Skip to content

Commit 47e1b00

Browse files
authored
mypy tracing (Azure#31527)
1 parent 5e85ef5 commit 47e1b00

File tree

1 file changed

+4
-4
lines changed
  • sdk/servicebus/azure-servicebus/azure/servicebus/_common

1 file changed

+4
-4
lines changed

sdk/servicebus/azure-servicebus/azure/servicebus/_common/tracing.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def send_trace_context_manager(
105105
links: Optional[List[Link]] = None
106106
) -> Iterator[None]:
107107
"""Tracing for sending messages."""
108-
span_impl_type: Type[AbstractSpan] = settings.tracing_implementation()
108+
span_impl_type: Optional[Type[AbstractSpan]] = settings.tracing_implementation()
109109

110110
if span_impl_type is not None:
111111
links = links or []
@@ -124,7 +124,7 @@ def receive_trace_context_manager(
124124
start_time: Optional[int] = None
125125
) -> Iterator[None]:
126126
"""Tracing for receiving messages."""
127-
span_impl_type: Type[AbstractSpan] = settings.tracing_implementation()
127+
span_impl_type: Optional[Type[AbstractSpan]] = settings.tracing_implementation()
128128
if span_impl_type is not None:
129129
links = links or []
130130
with span_impl_type(name=span_name, kind=SpanKind.CLIENT, links=links, start_time=start_time) as span:
@@ -141,7 +141,7 @@ def settle_trace_context_manager(
141141
links: Optional[List[Link]] = None
142142
):
143143
"""Tracing for settling messages."""
144-
span_impl_type = settings.tracing_implementation()
144+
span_impl_type: Optional[Type[AbstractSpan]] = settings.tracing_implementation()
145145
if span_impl_type is not None:
146146
links = links or []
147147
with span_impl_type(name=f"ServiceBus.{operation}", kind=SpanKind.CLIENT, links=links) as span:
@@ -161,7 +161,7 @@ def trace_message(
161161
Will open and close a message span, and add tracing context to the app properties of the message.
162162
"""
163163
try:
164-
span_impl_type: Type[AbstractSpan] = settings.tracing_implementation()
164+
span_impl_type: Optional[Type[AbstractSpan]] = settings.tracing_implementation()
165165
if span_impl_type is not None:
166166
with span_impl_type(name=SPAN_NAME_MESSAGE, kind=SpanKind.PRODUCER) as message_span:
167167
headers = message_span.to_header()

0 commit comments

Comments
 (0)