-
Notifications
You must be signed in to change notification settings - Fork 25k
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
[Profiling] Aggregate flamegraph by process name and thread name #119115
base: main
Are you sure you want to change the base?
Conversation
Pinging @elastic/obs-knowledge-team (Team:obs-knowledge) |
Pinging @elastic/obs-ux-infra_services-team (Team:obs-ux-infra_services) |
f9ecda3
to
df54aca
Compare
...ore/template-resources/src/main/resources/profiling/component-template/profiling-events.json
Show resolved
Hide resolved
df81709
to
52d909b
Compare
36f1696
to
9cf66c8
Compare
Co-authored-by: Jake Landis <[email protected]>
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.
Added some suggestions to avoid confusion if/when someone revisits source code later in time. LGTM otherwise (though I don't really have knowledge of the internals here, so another review from a domain expert would be nice)
...ing/src/main/java/org/elasticsearch/xpack/profiling/action/TransportGetFlamegraphAction.java
Outdated
Show resolved
Hide resolved
...ing/src/main/java/org/elasticsearch/xpack/profiling/action/TransportGetFlamegraphAction.java
Outdated
Show resolved
Hide resolved
...ng/src/main/java/org/elasticsearch/xpack/profiling/action/TransportGetStackTracesAction.java
Outdated
Show resolved
Hide resolved
…, root) (#204977) ## Summary This PR is a pre-requisite for adding aggregation by process name and by thread name to the Universal Profiling flamegraph view. It adds three artificial node types to the flamegraph including color codes. As a side-effect, the root node now has its own color code. Previously, it (accidentally) used the color code of "unknown" type frames. The PR is backwards compatible, so it doesn't change anything in the UI when connecting with current Elasticsearch. As soon as [the PR for ES](elastic/elasticsearch#119115) is merged, the new aggregations show up.
…, root) (elastic#204977) ## Summary This PR is a pre-requisite for adding aggregation by process name and by thread name to the Universal Profiling flamegraph view. It adds three artificial node types to the flamegraph including color codes. As a side-effect, the root node now has its own color code. Previously, it (accidentally) used the color code of "unknown" type frames. The PR is backwards compatible, so it doesn't change anything in the UI when connecting with current Elasticsearch. As soon as [the PR for ES](elastic/elasticsearch#119115) is merged, the new aggregations show up.
@@ -96,5 +96,7 @@ tasks.named("yamlRestCompatTestTransform").configure({ task -> | |||
task.skipTest("esql/180_match_operator/match with non text field", "Match operator can now be used on non-text fields") | |||
task.skipTest("esql/180_match_operator/match with functions", "Error message changed") | |||
task.skipTest("esql/40_unsupported_types/semantic_text declared in mapping", "The semantic text field format changed") | |||
task.replaceValueInMatch("Size", 49, "Test flamegraph from profiling-events") |
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.
Why is this instruction needed here?
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.
I think it is because comment
...ore/template-resources/src/main/resources/profiling/component-template/profiling-events.json
Show resolved
Hide resolved
), | ||
Iterators.single((b, p) -> b.field("total_frames", totalFrames)), | ||
Iterators.single((b, p) -> b.field("sampling_rate", samplingRate)), | ||
Iterators.single((b, p) -> b.field("total_frames", totalFrames).field("sampling_rate", samplingRate).endObject()) |
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.
This looks like an unrelated cleanup / optimization?
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.
Yes, it is an unrelated change. It has been suggested by Armin Braun in a chat. See comment
@@ -100,23 +100,24 @@ public Iterator<? extends ToXContent> toXContentChunked(ToXContent.Params params | |||
optional( | |||
"stack_trace_events", | |||
stackTraceEvents, | |||
(n, v) -> ChunkedToXContentHelper.map(n, v, entry -> (b, p) -> b.field(entry.getKey(), entry.getValue().count)) | |||
(n, v) -> ChunkedToXContentHelper.wrapWithObject( |
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.
Doesn't this change the structure of the output (backwards-compatibility)?
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.
Do you see any issues with this in Kibana (I didn't find any issue so far). BWC tests seem to run fine as well.
...ing/src/main/java/org/elasticsearch/xpack/profiling/action/TransportGetFlamegraphAction.java
Outdated
Show resolved
Hide resolved
|
||
// aggregation | ||
Map<String, TraceEvent> stackTraceEvents = new TreeMap<>(); | ||
Map<TraceEventID, TraceEvent> stackTraceEvents = new HashMap<>(); |
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.
Changing this might have a performance impact in the K/V lookups. Is there a reason that you've changed this? It is possible to implement Comparable
for TraceEventID
to keep using TreeMap
.
Update: I see that you sort in place below when extracting the ids so that should be fine.
...ng/src/main/java/org/elasticsearch/xpack/profiling/action/TransportGetStackTracesAction.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/elasticsearch/xpack/profiling/action/TransportGetTopNFunctionsAction.java
Outdated
Show resolved
Hide resolved
…, root) (elastic#204977) ## Summary This PR is a pre-requisite for adding aggregation by process name and by thread name to the Universal Profiling flamegraph view. It adds three artificial node types to the flamegraph including color codes. As a side-effect, the root node now has its own color code. Previously, it (accidentally) used the color code of "unknown" type frames. The PR is backwards compatible, so it doesn't change anything in the UI when connecting with current Elasticsearch. As soon as [the PR for ES](elastic/elasticsearch#119115) is merged, the new aggregations show up.
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.
We had an offline conversation about the open questions, which are all resolved now. LGTM
…, root) (elastic#204977) ## Summary This PR is a pre-requisite for adding aggregation by process name and by thread name to the Universal Profiling flamegraph view. It adds three artificial node types to the flamegraph including color codes. As a side-effect, the root node now has its own color code. Previously, it (accidentally) used the color code of "unknown" type frames. The PR is backwards compatible, so it doesn't change anything in the UI when connecting with current Elasticsearch. As soon as [the PR for ES](elastic/elasticsearch#119115) is merged, the new aggregations show up.
This PR adds aggregation by process name and by thread name to the Universal Profiling flamegraph view.
The profiling data model has been updated to fit for the new task, so some non-trivial amount of code had to be changed.
TBD: fix and improve tests
This PR works best together with this Kibana PR.
Before
After