Repository navigation
Strip number suffix from instance name to consolidate services that traces are spread over #13729
Changes from all commits
39aec64
0f023f3
341e7c9
3418e86
8b5579b
7a2ab11
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Strip number suffix from instance name to consolidate services that traces are spread over. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -203,6 +203,9 @@ def set_fates(clotho, lachesis, atropos, father="Zues", mother="Themis"): | |
|
|
||
| # Helper class | ||
|
|
||
| # Matches the number suffix in an instance name like "matrix.org client_reader-8" | ||
| STRIP_INSTANCE_NUMBER_SUFFIX_REGEX = re.compile(r"[_-]?\d+$") | ||
|
|
||
|
|
||
| class _DummyTagNames: | ||
| """wrapper of opentracings tags. We need to have them if we | ||
|
|
@@ -441,9 +444,17 @@ def init_tracer(hs: "HomeServer") -> None: | |
|
|
||
| from jaeger_client.metrics.prometheus import PrometheusMetricsFactory | ||
|
|
||
| # Instance names are opaque strings but by stripping off the number suffix, | ||
| # we can get something that looks like a "worker type", e.g. | ||
| # "client_reader-1" -> "client_reader" so we don't spread the traces across | ||
| # so many services. | ||
| instance_name_by_type = re.sub( | ||
| STRIP_INSTANCE_NUMBER_SUFFIX_REGEX, "", hs.get_instance_name() | ||
| ) | ||
|
|
||
| config = JaegerConfig( | ||
| config=hs.config.tracing.jaeger_config, | ||
| service_name=f"{hs.config.server.server_name} {hs.get_instance_name()}", | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did we get any benefit from splitting up the traces by instance or instance type before?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The only reason I've been holding off from doing this is that we lose the "colouring" of the traces, i.e. it becomes much harder to tell when processing moves to a different process. Not sure if there's another way of achieving the same effect?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm afraid I would second Erik's sort-of objection here; although having to find the right service is a minor pain, I really find the colouring useful because it helps to spot the points where the processing moves over replication. Perhaps something else to consider: I wonder if e.g. Grafana's interface for viewing traces is better for finding traces regardless of service?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could also do something like change the service name to the worker type? I.e. the instance name without the index. That way it'd be easier to find stuff (as you don't have to figure out the instance), and for the most part instances don't talk to the same type?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This was going to be my suggestion! We could also add a tag which is the entire instance name if you did want to filter by that. I think the only time that is useful is if you want to see what happens when an instance is under load or something, but...I don't think this is the right interface for that.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Ahhh, makes sense. I have been mostly looking at the For reference, an example that spans multiple processes is
Any tips for how to accomplish because this is what I also saw looking at this yesterday and just went with We could strip number suffixes from the opaque worker name. Can we consider that a safe-enough convention?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wouldn't be too offended if we took an educated guess and stripped
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could make it configurable?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've updated to the sensible default of stripping off the number suffix. Our
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Split that out to #13761 |
||
| service_name=f"{hs.config.server.server_name} {instance_name_by_type}", | ||
| scope_manager=LogContextScopeManager(), | ||
| metrics_factory=PrometheusMetricsFactory(), | ||
| ) | ||
|
|
||

Uh oh!
There was an error while loading. Please reload this page.