mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-21 21:35:14 -05:00
Tag federation request spans with the worker name (#15042)
* Systematically include worker name as process info * Changelog * don't bother with inner setdefault
This commit is contained in:
parent
03bccd542b
commit
a5a799722d
1
changelog.d/15042.feature
Normal file
1
changelog.d/15042.feature
Normal file
@ -0,0 +1 @@
|
|||||||
|
Tag opentracing spans for federation requests with the name of the worker serving the request.
|
@ -32,7 +32,6 @@ from synapse.appservice import ApplicationService
|
|||||||
from synapse.http import get_request_user_agent
|
from synapse.http import get_request_user_agent
|
||||||
from synapse.http.site import SynapseRequest
|
from synapse.http.site import SynapseRequest
|
||||||
from synapse.logging.opentracing import (
|
from synapse.logging.opentracing import (
|
||||||
SynapseTags,
|
|
||||||
active_span,
|
active_span,
|
||||||
force_tracing,
|
force_tracing,
|
||||||
start_active_span,
|
start_active_span,
|
||||||
@ -162,12 +161,6 @@ class Auth:
|
|||||||
parent_span.set_tag(
|
parent_span.set_tag(
|
||||||
"authenticated_entity", requester.authenticated_entity
|
"authenticated_entity", requester.authenticated_entity
|
||||||
)
|
)
|
||||||
# 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.
|
|
||||||
parent_span.set_tag(
|
|
||||||
SynapseTags.INSTANCE_NAME, self.hs.get_instance_name()
|
|
||||||
)
|
|
||||||
parent_span.set_tag("user_id", requester.user.to_string())
|
parent_span.set_tag("user_id", requester.user.to_string())
|
||||||
if requester.device_id is not None:
|
if requester.device_id is not None:
|
||||||
parent_span.set_tag("device_id", requester.device_id)
|
parent_span.set_tag("device_id", requester.device_id)
|
||||||
|
@ -466,8 +466,16 @@ def init_tracer(hs: "HomeServer") -> None:
|
|||||||
STRIP_INSTANCE_NUMBER_SUFFIX_REGEX, "", hs.get_instance_name()
|
STRIP_INSTANCE_NUMBER_SUFFIX_REGEX, "", hs.get_instance_name()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
jaeger_config = hs.config.tracing.jaeger_config
|
||||||
|
tags = jaeger_config.setdefault("tags", {})
|
||||||
|
|
||||||
|
# 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.
|
||||||
|
tags[SynapseTags.INSTANCE_NAME] = hs.get_instance_name()
|
||||||
|
|
||||||
config = JaegerConfig(
|
config = JaegerConfig(
|
||||||
config=hs.config.tracing.jaeger_config,
|
config=jaeger_config,
|
||||||
service_name=f"{hs.config.server.server_name} {instance_name_by_type}",
|
service_name=f"{hs.config.server.server_name} {instance_name_by_type}",
|
||||||
scope_manager=LogContextScopeManager(),
|
scope_manager=LogContextScopeManager(),
|
||||||
metrics_factory=PrometheusMetricsFactory(),
|
metrics_factory=PrometheusMetricsFactory(),
|
||||||
|
Loading…
Reference in New Issue
Block a user