-
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
Open
rockdaboot
wants to merge
26
commits into
elastic:main
Choose a base branch
from
rockdaboot:flamegraph-executable-name
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+320
−277
Open
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
4d35b22
Add field process.executable.name to profiling-events
rockdaboot a4aea04
Amend query to aggregate events by executable name
rockdaboot adae211
Send flamegraph row with grouping by executable name
rockdaboot 29fa515
Flamegraph sub-aggregation by thread name
rockdaboot ea63b21
Rework internal data model
rockdaboot 823579c
Cleanups
rockdaboot 72254fb
Fix building tests
rockdaboot 1d2b984
Fix GetStackTracesResponseTests
rockdaboot 535d30d
Fix unit tests
rockdaboot b651317
Fix remaining unit tests
rockdaboot 398fc60
[CI] Auto commit changes from spotless
elasticsearchmachine 0a33c7e
Fix flamegraph yaml tests
rockdaboot 8046c83
Fix yaml REST tests
rockdaboot 9cf66c8
Increase INDEX_TEMPLATE_VERSION for profiling.executable.name
rockdaboot cf4d652
Fix yamlRestCompatTest
rockdaboot e514874
Rename executable name to process name
rockdaboot 28c990c
Merge branch 'main' into flamegraph-executable-name
rockdaboot 4fdd4d8
Merge branch 'main' into flamegraph-executable-name
rockdaboot f3ca80c
Merge branch 'main' into flamegraph-executable-name
rockdaboot fbb669b
Remove warnings meant for testing
rockdaboot 659a4fd
Replace ChunkedToXContentHelper.wrapWithObject() with .object()
rockdaboot f9ef6be
Fix comment in ProfilingIndexTemplateRegistry.java
rockdaboot 62117b4
Simplify sorting of unique stacktrace and host IDs
rockdaboot 57d3ad4
Merge branch 'main' into flamegraph-executable-name
rockdaboot c118150
[CI] Auto commit changes from spotless
elasticsearchmachine 7cd497c
Merge branch 'main' into flamegraph-executable-name
rockdaboot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,7 @@ public class GetStackTracesResponse extends ActionResponse implements ChunkedToX | |
private final Map<String, String> executables; | ||
@UpdateForV9(owner = UpdateForV9.Owner.PROFILING) // remove this field - it is unused in Kibana | ||
@Nullable | ||
private final Map<String, TraceEvent> stackTraceEvents; | ||
private final Map<TraceEventID, TraceEvent> stackTraceEvents; | ||
@UpdateForV9(owner = UpdateForV9.Owner.PROFILING) // remove this field - it is unused in Kibana | ||
private final int totalFrames; | ||
private final double samplingRate; | ||
|
@@ -42,7 +42,7 @@ public GetStackTracesResponse( | |
Map<String, StackTrace> stackTraces, | ||
Map<String, StackFrame> stackFrames, | ||
Map<String, String> executables, | ||
Map<String, TraceEvent> stackTraceEvents, | ||
Map<TraceEventID, TraceEvent> stackTraceEvents, | ||
int totalFrames, | ||
double samplingRate, | ||
long totalSamples | ||
|
@@ -73,7 +73,7 @@ public Map<String, String> getExecutables() { | |
return executables; | ||
} | ||
|
||
public Map<String, TraceEvent> getStackTraceEvents() { | ||
public Map<TraceEventID, TraceEvent> getStackTraceEvents() { | ||
return stackTraceEvents; | ||
} | ||
|
||
|
@@ -100,23 +100,24 @@ public Iterator<? extends ToXContent> toXContentChunked(ToXContent.Params params | |
optional( | ||
"stack_trace_events", | ||
stackTraceEvents, | ||
(n, v) -> ChunkedToXContentHelper.object(n, v, entry -> (b, p) -> b.field(entry.getKey(), entry.getValue().count)) | ||
(n, v) -> ChunkedToXContentHelper.object( | ||
n, | ||
Iterators.map(v.entrySet().iterator(), e -> (b, p) -> b.field(e.getKey().stacktraceID(), e.getValue().count)) | ||
) | ||
), | ||
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 commentThe 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 commentThe 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 |
||
// the following fields are intentionally not written to the XContent representation (only needed on the transport layer): | ||
// | ||
// * start | ||
// * end | ||
// * totalSamples | ||
ChunkedToXContentHelper.endObject() | ||
); | ||
} | ||
|
||
private static <T> Iterator<? extends ToXContent> optional( | ||
private static <K, T> Iterator<? extends ToXContent> optional( | ||
String name, | ||
Map<String, T> values, | ||
BiFunction<String, Map<String, T>, Iterator<? extends ToXContent>> supplier | ||
Map<K, T> values, | ||
BiFunction<String, Map<K, T>, Iterator<? extends ToXContent>> supplier | ||
) { | ||
return (values != null) ? supplier.apply(name, values) : Collections.emptyIterator(); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
...plugin/profiling/src/main/java/org/elasticsearch/xpack/profiling/action/TraceEventID.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.profiling.action; | ||
|
||
record TraceEventID(String processName, String threadName, String hostID, String stacktraceID) {} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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