1
0

Better handling

This commit is contained in:
Eric Eastwood
2022-09-12 18:11:10 -05:00
parent e244ee513b
commit b52f921902
2 changed files with 12 additions and 5 deletions
+1 -1
View File
@@ -182,7 +182,7 @@ class Auth:
# find the trace.
for header_key in self.hs.config.tracing.request_headers_to_tag:
headers = request.requestHeaders.getRawHeaders(header_key)
if len(headers):
if headers is not None:
parent_span.set_tag(
SynapseTags.REQUEST_HEADER_PREFIX + header_key, headers[0]
)
+11 -4
View File
@@ -42,10 +42,7 @@ class TracerConfig(Config):
# reverse proxy service like Cloudflare to protect your Synapse instance
# in order to correlate and match up requests that timed out at the
# Cloudflare layer to the Synapse traces.
self.request_headers_to_tag = opentracing_config.get(
"request_headers_to_tag",
[],
)
self.request_headers_to_tag = []
if not self.opentracer_enabled:
return
@@ -72,3 +69,13 @@ class TracerConfig(Config):
("opentracing", "force_tracing_for_users", f"index {i}"),
)
self.force_tracing_for_users.add(u)
request_headers_to_tag = opentracing_config.get(
"request_headers_to_tag",
[],
)
if not isinstance(request_headers_to_tag, list):
raise ConfigError(
"Expected a list", ("opentracing", "request_headers_to_tag")
)
self.request_headers_to_tag = request_headers_to_tag