Describe the feature
We would like to expose a Dictionary javaThreadIds that maps eventIds to javaThreadIds in JfrReader.
Use Case
In order to implement profiling for the sentry-java sdk we had to vendor-in the JfrReader.java in order to get the JavaThread Ids, which we need to map them to running transactions.
If this feature would be implemented we could depend on the jfr-converter as-is without vendoring and customizing.
We can also supply a PR for this, if you'd like.
Proposed Solution
As part of the readThread method in JfrReader (
|
private void readThreads(int fieldCount) { |
|
int count = threads.preallocate(getVarint()); |
|
for (int i = 0; i < count; i++) { |
|
long id = getVarlong(); |
|
String osName = getString(); |
|
int osThreadId = getVarint(); |
|
String javaName = getString(); |
|
long javaThreadId = getVarlong(); |
|
readFields(fieldCount - 4); |
|
threads.put(id, javaName != null ? javaName : osName); |
|
} |
|
} |
).
We would propose to track the javaThreads in a Dictionary just like the threads are tracked by their name, so we can map them from the event id.
Here's our version of the JfrReader for reference: https://github.com/getsentry/sentry-java/blob/main/sentry-async-profiler/src/main/java/io/sentry/asyncprofiler/vendor/asyncprofiler/jfr/JfrReader.java
Acknowledgements
Describe the feature
We would like to expose a Dictionary
javaThreadIdsthat maps eventIds to javaThreadIds inJfrReader.Use Case
In order to implement profiling for the sentry-java sdk we had to vendor-in the
JfrReader.javain order to get the JavaThread Ids, which we need to map them to running transactions.If this feature would be implemented we could depend on the jfr-converter as-is without vendoring and customizing.
We can also supply a PR for this, if you'd like.
Proposed Solution
As part of the
readThreadmethod inJfrReader(async-profiler/src/converter/one/jfr/JfrReader.java
Lines 453 to 464 in ea09546
We would propose to track the
javaThreadsin a Dictionary just like thethreadsare tracked by their name, so we can map them from the event id.Here's our version of the
JfrReaderfor reference: https://github.com/getsentry/sentry-java/blob/main/sentry-async-profiler/src/main/java/io/sentry/asyncprofiler/vendor/asyncprofiler/jfr/JfrReader.javaAcknowledgements