summary refs log tree commit diff
path: root/synapse/logging
diff options
context:
space:
mode:
authorEric Eastwood <erice@element.io>2022-09-09 11:31:37 -0500
committerGitHub <noreply@github.com>2022-09-09 11:31:37 -0500
commita911ffb42cc88adc8084a04acf6fd651efba278f (patch)
tree387414519bb8702bf2208803bb45a09638b2857e /synapse/logging
parentStrip number suffix from instance name to consolidate services that traces ar... (diff)
downloadsynapse-a911ffb42cc88adc8084a04acf6fd651efba278f.tar.xz
Tag trace with instance name (#13761)
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.

As suggested by @clokep and @reivilibre in,

 - https://github.com/matrix-org/synapse/pull/13729#discussion_r964719258
 - https://github.com/matrix-org/synapse/pull/13729#discussion_r964733578
Diffstat (limited to 'synapse/logging')
-rw-r--r--synapse/logging/opentracing.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/synapse/logging/opentracing.py b/synapse/logging/opentracing.py
index adf3f54770..ca2735dd6d 100644
--- a/synapse/logging/opentracing.py
+++ b/synapse/logging/opentracing.py
@@ -298,6 +298,8 @@ class SynapseTags:
     # Whether the sync response has new data to be returned to the client.
     SYNC_RESULT = "sync.new_data"
 
+    INSTANCE_NAME = "instance_name"
+
     # incoming HTTP request ID  (as written in the logs)
     REQUEST_ID = "request_id"
 
@@ -1043,11 +1045,11 @@ def trace_servlet(
             # with JsonResource).
             scope.span.set_operation_name(request.request_metrics.name)
 
-            # set the tags *after* the servlet completes, in case it decided to
-            # prioritise the span (tags will get dropped on unprioritised spans)
             request_tags[
                 SynapseTags.REQUEST_TAG
             ] = request.request_metrics.start_context.tag
 
+            # set the tags *after* the servlet completes, in case it decided to
+            # prioritise the span (tags will get dropped on unprioritised spans)
             for k, v in request_tags.items():
                 scope.span.set_tag(k, v)