-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[APM] Service map new API #212550
base: main
Are you sure you want to change the base?
[APM] Service map new API #212550
Conversation
a7df664
to
5fa4ec0
Compare
2f2be9a
to
b648b47
Compare
simplified DSL for service map change aggregation Improvements
87ef10e
to
b58aaaa
Compare
return [childSpan.destination(next.serviceInstance.fields['service.name']!)]; | ||
return [ | ||
childSpan.destination(next.serviceInstance.fields['service.name']!).children( | ||
next.serviceInstance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exit spans are followed by a transaction. This makes the synthtrace scenario adhere to the real data
524f34f
to
ffe63c9
Compare
4bc9dd8
to
8afc9a8
Compare
if (reversedConnection) { | ||
reversedConnection.bidirectional = true; | ||
return prev.concat({ | ||
...connection, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this have to be a new object with different property set? Just trying to understand some of the perf impact of some of these operations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, considering that reverseConnection
is mutated, I would say that we don't really need to create a new object here either. I doubt that there will be any noticeable performance improvement though. I'll change it anyways.
Pinging @elastic/obs-ux-infra_services-team (Team:obs-ux-infra_services) |
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]Module Count
Async chunks
History
|
|
||
// List of nodes that are services | ||
const serviceNodes = new Map( | ||
[...Array.from(allNodes.values()), ...connectionFromDiscoveredServices] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.values()
returns an iterator, so with spreading into an array, Array.from
is redundant and adds an extra allocation that can be avoided.
[...Array.from(allNodes.values()), ...connectionFromDiscoveredServices] | |
[...allNodes.values(), ...connectionFromDiscoveredServices] |
|
||
const uniqueNodes = mappedEdges | ||
.flatMap((connection) => [connection.sourceData, connection.targetData]) | ||
.concat(Array.from(allServices.values())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.concat(Array.from(allServices.values())) | |
.concat(...allServices.values()) |
We can just spread instead of doing an additional array allocation
closes #212252
Summary
This PR replaces the
scripted_metric
aggregation used to retrieve the data for the service map.The new solution relies on samples of exit spans - each representing a unique combination of
service.name
andspan.destination.service.resource
- along with their child transactions. The Service Map is now built entirely on the client side to reduce server-side load and prevent excessive event loop utilization.Note
transform_service_map_responses.ts
was refactored to improve readability and performance, The file was renamed toget_service_map_nodes.ts
group_resource_nodes.ts
was refactored to improve readability and performanceConsequences
span.destination.service.resource
field populated — with the exception of messaging systems, which may rely onspan.links
(not addressed in this PR)span.destination.sevice.resource
#212638span.destination.service.resource
. This could lead to incomplete paths in the map, as the path is built for the firstservice.name
+span.destination.service.resource
pair returned processed.Analysis
The performance analysis below uses data from the edge cluster and the service_map_oom synthtrace scenario, simulating long traces. The selected date range was 24h.
Current solution
numeric_labels.event_loop_active
: 4085.601743numeric_labels.event_loop_utilization
: 0.28716New solution
numeric_labels.event_loop_active
: 887.149512numeric_labels.event_loop_utilization
: 0.123929On the client side, the most CPU-intensive operation is performed by cytoscape. The creation of service connections performs efficiently.
How to test
xpack.apm.serviceMapV2Enabled: true
tokibana.dev.yml