summary refs log tree commit diff
path: root/synapse/http/server.py
diff options
context:
space:
mode:
Diffstat (limited to 'synapse/http/server.py')
-rw-r--r--synapse/http/server.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/synapse/http/server.py b/synapse/http/server.py

index 051a1899a0..69e7147a2d 100644 --- a/synapse/http/server.py +++ b/synapse/http/server.py
@@ -61,14 +61,14 @@ from synapse.api.errors import ( from synapse.config.homeserver import HomeServerConfig from synapse.http.site import SynapseRequest from synapse.logging.context import defer_to_thread, preserve_fn, run_in_background -from synapse.logging.opentracing import active_span, start_active_span, trace_servlet +from synapse.logging.tracing import get_active_span, start_active_span, trace_servlet from synapse.util import json_encoder from synapse.util.caches import intern_dict from synapse.util.cancellation import is_function_cancellable from synapse.util.iterutils import chunk_seq if TYPE_CHECKING: - import opentracing + import opentelemetry from synapse.server import HomeServer @@ -268,7 +268,7 @@ class HttpServer(Protocol): subsequent arguments will be any matched groups from the regex. This should return either tuple of (code, response), or None. servlet_classname: The name of the handler to be used in prometheus - and opentracing logs. + and tracing logs. """ @@ -279,7 +279,7 @@ class _AsyncResource(resource.Resource, metaclass=abc.ABCMeta): requests by method, or override `_async_render` to handle all requests. Args: - extract_context: Whether to attempt to extract the opentracing + extract_context: Whether to attempt to extract the tracing context from the request the servlet is handling. """ @@ -449,7 +449,7 @@ class JsonResource(DirectServeJsonResource): callback: The handler for the request. Usually a Servlet servlet_classname: The name of the handler to be used in prometheus - and opentracing logs. + and tracing logs. """ method_bytes = method.encode("utf-8") @@ -817,19 +817,19 @@ async def _async_write_json_to_request_in_thread( expensive. """ - def encode(opentracing_span: "Optional[opentracing.Span]") -> bytes: + def encode(tracing_span: Optional["opentelemetry.trace.Span"]) -> bytes: # it might take a while for the threadpool to schedule us, so we write - # opentracing logs once we actually get scheduled, so that we can see how + # tracing logs once we actually get scheduled, so that we can see how # much that contributed. - if opentracing_span: - opentracing_span.log_kv({"event": "scheduled"}) + if tracing_span: + tracing_span.add_event("scheduled", attributes={"event": "scheduled"}) res = json_encoder(json_object) - if opentracing_span: - opentracing_span.log_kv({"event": "encoded"}) + if tracing_span: + tracing_span.add_event("scheduled", attributes={"event": "encoded"}) return res with start_active_span("encode_json_response"): - span = active_span() + span = get_active_span() json_str = await defer_to_thread(request.reactor, encode, span) _write_bytes_to_request(request, json_str)