diff --git a/synapse/api/auth.py b/synapse/api/auth.py
index 4a75eb6b21..26ed41a654 100644
--- a/synapse/api/auth.py
+++ b/synapse/api/auth.py
@@ -31,10 +31,10 @@ from synapse.api.errors import (
from synapse.appservice import ApplicationService
from synapse.http import get_request_user_agent
from synapse.http.site import SynapseRequest
-from synapse.logging.opentracing import (
+from synapse.logging.tracing import (
SynapseTags,
- active_span,
force_tracing,
+ get_active_span,
start_active_span,
trace,
)
@@ -144,7 +144,7 @@ class Auth:
is invalid.
AuthError if access is denied for the user in the access token
"""
- parent_span = active_span()
+ parent_span = get_active_span()
with start_active_span("get_user_by_req"):
requester = await self._wrapped_get_user_by_req(
request, allow_guest, allow_expired
@@ -154,25 +154,25 @@ class Auth:
if requester.authenticated_entity in self._force_tracing_for_users:
# request tracing is enabled for this user, so we need to force it
# tracing on for the parent span (which will be the servlet span).
- #
+ force_tracing(parent_span)
# It's too late for the get_user_by_req span to inherit the setting,
# so we also force it on for that.
force_tracing()
- force_tracing(parent_span)
- parent_span.set_tag(
+ parent_span.set_attribute(
"authenticated_entity", requester.authenticated_entity
)
+
# We tag the Synapse instance name so that it's an easy jumping
# off point into the logs. Can also be used to filter for an
# instance that is under load.
- parent_span.set_tag(
+ parent_span.set_attribute(
SynapseTags.INSTANCE_NAME, self.hs.get_instance_name()
)
- parent_span.set_tag("user_id", requester.user.to_string())
+ parent_span.set_attribute("user_id", requester.user.to_string())
if requester.device_id is not None:
- parent_span.set_tag("device_id", requester.device_id)
+ parent_span.set_attribute("device_id", requester.device_id)
if requester.app_service is not None:
- parent_span.set_tag("appservice_id", requester.app_service.id)
+ parent_span.set_attribute("appservice_id", requester.app_service.id)
return requester
@cancellable
@@ -184,7 +184,7 @@ class Auth:
) -> Requester:
"""Helper for get_user_by_req
- Once get_user_by_req has set up the opentracing span, this does the actual work.
+ Once get_user_by_req has set up the tracing span, this does the actual work.
"""
try:
ip_addr = request.getClientAddress().host
|