-
Notifications
You must be signed in to change notification settings - Fork 37
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
Use jfr parser from jdk mission control #1229
Conversation
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.
Looks good overall, had a few thoughts/questions sprinkled throughout. Nothing too interesting....
I have a few hangups on this that I think we should discuss.
- I was a little surprised at the net increase in LOC. I kinda would have expected a reduction, but ok, it's approximately the same. Is the addition of the jmc dependency and all its
I
prefixed classnames worth it? It's certainly less readable.... - I know performance was likely to be a motivation behind this change, specifically reducing allocations which ultimately result in GC. Are there test numbers to back up this change as an improvement? Can those be shared?
- Does going this route prevent us from adopting the upstream/collab
jfr-connection
? - Are we ok with this divergence from the community collab code? Do we think this ultimately makes things more compatible or less compatible in the mid/long term?
}, | ||
{ | ||
"bundleName": "UPL-BSD-3-Clause", | ||
// org.openjdk.jmc:flightrecorder gets detected as UPL, it is really UPL+BSD dual license" |
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.
sadly, json doesn't support comments like this. An alternative would be to put it as a string in some other key that hopefully gets ignored.
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.
Whatever parses this seems to be able to cope with such comments. Also tried adding comment as a field, but that failed because the parser tried to bind this to a class field that doesn't exist.
profiler/src/main/java/com/splunk/opentelemetry/profiler/EventReader.java
Outdated
Show resolved
Hide resolved
profiler/src/main/java/org/openjdk/jmc/flightrecorder/internal/parser/v1/ThreadUtil.java
Show resolved
Hide resolved
profiler/src/main/java/com/splunk/opentelemetry/profiler/JfrPathHandler.java
Show resolved
Hide resolved
buffer = chunkLoader.call(); | ||
IItemCollection items = EventCollectionUtil.build(context.buildEventArrays()); | ||
items.stream().flatMap(iItems -> iItems.stream()).forEach(eventProcessingChain::accept); | ||
eventProcessingChain.flushBuffer(); |
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 is a behavior change. It used to flush after each file, now it's flushing after each chunk. Should this go back outside the loop?
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.
In previous parser chunks were hidden so we used our own chunk tracker that called flushBuffer
on chunk change. The behavior didn't change, just the flushBuffer
call moved.
...c/main/java/com/splunk/opentelemetry/profiler/allocation/sampler/AllocationEventSampler.java
Show resolved
Hide resolved
String methodName = method.getMethodName(); | ||
Integer lineNumber = frame.getFrameLineNumber(); | ||
if (lineNumber == null) { | ||
lineNumber = -1; |
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.
GDI spec says 0 when unknown.
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.
Thanks, will change. Note that previous parser returned -1
when line number was not available
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.
Replaced all occurrences of -1
, please review.
@@ -88,108 +89,25 @@ void testLifecycle() { | |||
inOrder.verifyNoMoreInteractions(); | |||
} | |||
|
|||
@Test | |||
void testFlushOnChunkChange() { |
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 guess this is less interesting now that the chunk tracker exists elsewhere? Should we still verify that flush is called somewhere though?
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 this is covered with other tests, if flushBuffer
is not called nothing will get exported with pprof.
I think if you exclude the added license files then there is no change in loc. It is true that the api of the previous parser is nicer, but considering that we need the profiling code to have minimal overhead everything that improves the situation is worth it, even if it comes at the cost of code readability.
I'll put together some stuff and paste it to slack.
It doesn't. |
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.
Looks promising.
I'm a little bit worried about all the internal JMC classes that we use; but the JFR based implementation also depends on internal behavior (chunks) so it's not exactly a new thing.
No description provided.