From db10eeb26708d44d6fe20c6013743dfe4fe598ad Mon Sep 17 00:00:00 2001 From: Jorik Schellekens Date: Tue, 25 Jun 2019 10:28:46 +0100 Subject: [PATCH] Code style --- synapse/config/tracer.py | 2 +- synapse/http/site.py | 2 +- synapse/util/scopecontextmanager.py | 10 +++++----- synapse/util/tracerutils.py | 4 +--- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/synapse/config/tracer.py b/synapse/config/tracer.py index dbcc691d69..84253d5d89 100644 --- a/synapse/config/tracer.py +++ b/synapse/config/tracer.py @@ -54,7 +54,7 @@ class TracerConfig(Config): # The list is a list of regex which is matched against the user_id user_whitelist: - "*" - # The list of homeservers we wish to trace across + # The list of homeservers we wish to trace across # The list is a list of regex which is matched against the homeserver name homeserver_whitelist: - "*" diff --git a/synapse/http/site.py b/synapse/http/site.py index 7ed8ca819c..887b7701ad 100644 --- a/synapse/http/site.py +++ b/synapse/http/site.py @@ -239,7 +239,7 @@ class SynapseRequest(Request): # Start a span span_context = extract_span_context(self.requestHeaders) - span = opentracing.tracer.start_active_span( + opentracing.tracer.start_active_span( "incoming-federation-request", tags={ "request_id": self.get_request_id(), diff --git a/synapse/util/scopecontextmanager.py b/synapse/util/scopecontextmanager.py index 177eda2046..905a1b319b 100644 --- a/synapse/util/scopecontextmanager.py +++ b/synapse/util/scopecontextmanager.py @@ -15,8 +15,8 @@ class LogContextScopeManager(ScopeManager): def __init__(self, config): # Set the whitelists logger.info(config.tracer_config) - _homeserver_whitelist = config.tracer_config["homeserver_whitelist"] - _user_whitelist = config.tracer_config["user_whitelist"] + self._homeserver_whitelist = config.tracer_config["homeserver_whitelist"] + self._user_whitelist = config.tracer_config["user_whitelist"] @property def active(self): @@ -27,7 +27,7 @@ class LogContextScopeManager(ScopeManager): becomes an implicit parent of any newly-created Span at Tracer.start_active_span() time. - Return: + Return: (Scope) : the Scope that is active, or None if not available. """ @@ -44,8 +44,8 @@ class LogContextScopeManager(ScopeManager): span (Span): the span that should become active. finish_on_close (Boolean): whether Span should be automatically finished when Scope.close() is called. - - Return: + + Return: Scope to control the end of the active period for *span*. It is a programming error to neglect to call Scope.close() on the returned instance. diff --git a/synapse/util/tracerutils.py b/synapse/util/tracerutils.py index 93f305e13e..f4fc96b445 100644 --- a/synapse/util/tracerutils.py +++ b/synapse/util/tracerutils.py @@ -1,8 +1,6 @@ import opentracing from opentracing.propagation import Format -from .logcontext import LoggingContext - def extract_span_context(headers): """ @@ -30,7 +28,7 @@ def inject_span_context(headers, span): The headers set by the tracer are custom to the tracer implementation which should be unique enough that they don't interfere with any headers set by synapse or twisted. If we're still using jaeger these headers would be those - here: + here: https://github.com/jaegertracing/jaeger-client-python/blob/master/jaeger_client/constants.py """ carrier = {}