This repository was archived by the owner on Apr 26, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 32
32
from synapse .http import get_request_user_agent
33
33
from synapse .http .site import SynapseRequest
34
34
from synapse .logging .opentracing import (
35
+ SynapseTags ,
35
36
active_span ,
36
37
force_tracing ,
37
38
start_active_span ,
@@ -161,6 +162,12 @@ async def get_user_by_req(
161
162
parent_span .set_tag (
162
163
"authenticated_entity" , requester .authenticated_entity
163
164
)
165
+ # We tag the Synapse instance name so that it's an easy jumping
166
+ # off point into the logs. Can also be used to filter for an
167
+ # instance that is under load.
168
+ parent_span .set_tag (
169
+ SynapseTags .INSTANCE_NAME , self .hs .get_instance_name ()
170
+ )
164
171
parent_span .set_tag ("user_id" , requester .user .to_string ())
165
172
if requester .device_id is not None :
166
173
parent_span .set_tag ("device_id" , requester .device_id )
Original file line number Diff line number Diff line change @@ -295,6 +295,8 @@ class SynapseTags:
295
295
# Whether the sync response has new data to be returned to the client.
296
296
SYNC_RESULT = "sync.new_data"
297
297
298
+ INSTANCE_NAME = "instance_name"
299
+
298
300
# incoming HTTP request ID (as written in the logs)
299
301
REQUEST_ID = "request_id"
300
302
@@ -1032,11 +1034,11 @@ def trace_servlet(
1032
1034
# with JsonResource).
1033
1035
scope .span .set_operation_name (request .request_metrics .name )
1034
1036
1035
- # set the tags *after* the servlet completes, in case it decided to
1036
- # prioritise the span (tags will get dropped on unprioritised spans)
1037
1037
request_tags [
1038
1038
SynapseTags .REQUEST_TAG
1039
1039
] = request .request_metrics .start_context .tag
1040
1040
1041
+ # set the tags *after* the servlet completes, in case it decided to
1042
+ # prioritise the span (tags will get dropped on unprioritised spans)
1041
1043
for k , v in request_tags .items ():
1042
1044
scope .span .set_tag (k , v )
You can’t perform that action at this time.
0 commit comments