Skip to content
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

[Task] Add support for new event type jdk.ObjectAllocationSample #62

Closed
Tracked by #11
gunnarmorling opened this issue Feb 10, 2021 · 14 comments · Fixed by #135
Closed
Tracked by #11

[Task] Add support for new event type jdk.ObjectAllocationSample #62

gunnarmorling opened this issue Feb 10, 2021 · 14 comments · Fixed by #135
Labels
feat New feature or request question Further information is requested

Comments

@gunnarmorling
Copy link

JDK 16 adds this (see https://bugs.openjdk.java.net/browse/JDK-8257602), essentially superseding the earlier TLAB event types. Would be great to have support for it here.

@andrewazores andrewazores added the feat New feature or request label May 17, 2022
@andrewazores andrewazores moved this to Todo in 2.2.0 Release May 17, 2022
@andrewazores andrewazores changed the title Add support for new event type jdk.ObjectAllocationSample [Task] Add support for new event type jdk.ObjectAllocationSample May 17, 2022
@andrewazores andrewazores added the question Further information is requested label Jun 15, 2022
@andrewazores
Copy link
Member

@maxcao13 or @tthvo would you like to take a look at this?

@tthvo
Copy link
Member

tthvo commented Sep 16, 2022

Great sure! I will look into it. Any guide on where to start?

@andrewazores
Copy link
Member

You'll need a sample application running JDK16+. [0] Collect a JFR file from that application and load it into jfr-datasource, and then see if the ObjectAllocationSample event shows up in query results. You can also use JMC or the jfr command-line tool to verify the recording contains the event. If the recording contains the events but jfr-datasource doesn't return it in queries/searches then you'll need to do some work in https://github.com/cryostatio/jfr-datasource/blob/main/src/main/java/io/cryostat/jfr/datasource/events/RecordingService.java , I think.

[0] https://github.com/andrewazores/vertx-fib-demo/blob/678d12362f1c2867f526813c7f491134bb532d61/build.gradle#L17

@tthvo
Copy link
Member

tthvo commented Sep 16, 2022

Great I will check it out and start on this.

@tthvo
Copy link
Member

tthvo commented Sep 19, 2022

I did a check on a jfr for vertx-fib-demo:0.8.0 and found:

Jfr Summary

[...hiddden]

jdk.ObjectAllocationSample {
  startTime = 22:01:25.094
  objectClass = java.util.TreeMap (classLoader = bootstrap)
  weight = 99.5 kB
  eventThread = "RMI TCP Connection(97)-10.0.2.100" (javaThreadId = 86)
  stackTrace = [
    javax.management.openmbean.CompositeDataSupport.makeMap(String[], Object[]) line: 136
    javax.management.openmbean.CompositeDataSupport.<init>(CompositeType, String[], Object[]) line: 119
    com.sun.jmx.mbeanserver.DefaultMXBeanMappingFactory$TabularMapping.toNonNullOpenValue(Object) line: 768
    com.sun.jmx.mbeanserver.DefaultMXBeanMappingFactory$NonNullMXBeanMapping.toOpenValue(Object) line: 142
    com.sun.jmx.mbeanserver.DefaultMXBeanMappingFactory$CompositeMapping.toNonNullOpenValue(Object) line: 841
    ...
  ]
}

[...hiddden]

Source: summary.txt

Load Jfr and query/search

$ http GET :8080/search | jq  -c '.[] | select(contains("jdk.ObjectAllocationSample"))'
"jdk.ObjectAllocationSample.eventThread"
"jdk.ObjectAllocationSample.stackTrace"
"jdk.ObjectAllocationSample.objectClass"
"jdk.ObjectAllocationSample.weight"

Looks like Datasource supports this type event. Any further work on this issue or maybe I miss anything?

@andrewazores
Copy link
Member

Great, thanks for checking.

The next step would be to add it to the Grafana dashboard - at the time this issue was filed, the dashboard definition was in this project and only later was it moved to our customized Grafana image.

@tthvo
Copy link
Member

tthvo commented Sep 20, 2022

Great thanks! I will look into how to do that and reference this issue :D

@tthvo
Copy link
Member

tthvo commented Sep 20, 2022

Among the 4 fields above, I think we add "jdk.ObjectAllocationSample.weight" to Grafana Dashboard?

Just not sure how to visualize the rest :\

@andrewazores
Copy link
Member

The thread name and stack trace definitely don't seem like they will map well to the timeseries charts on the dashboard.

Though, I don't think charting the weights alone as a single data set is useful. I think we would either want one big chart with multiple series on it - time on the X, weight on the Y, and each series labelled by its objectClass. Or else a whole separate dashboard with dynamic charts, one for each objectClass, each with weight vs time. I'm not sure if either of these is well-supported by the dashboard definition JSON.

@tthvo
Copy link
Member

tthvo commented Sep 20, 2022

Good idea :D I will see if we could how to define the graph as such. The first one probably sounds better.

@andrewazores
Copy link
Member

It sounds better, but it might be extremely difficult or impossible to read if there are very many different objectClass samples...

@tthvo
Copy link
Member

tthvo commented Sep 20, 2022

Right...How about...since Grafana allows a closer/bigger view when clicking on the panel, I guess we could follow the first option and somehow add a filter (not sure if supported)?

@andrewazores
Copy link
Member

If that can be done then sure, that sounds like it could be good.

@andrewazores andrewazores moved this from Todo to In Progress in 2.2.0 Release Sep 21, 2022
@tthvo
Copy link
Member

tthvo commented Sep 22, 2022

Unfortunately, per-panel-filter is not possible at the moment: grafana/grafana#8408

My idea now is:

  • Create a panel in main dashboard with jdk.ObjectAllocationSample.weight using multiple series (need to modify jfr-datasource to support categorizing/fitlers).
  • Create another dashboard with each panel for each class type with ad-hoc filter for entire dashboard based on object type.
  • Create a dashboard link on top-left corner of the original panel (total weight) that links to this new dashboard: https://grafana.com/docs/grafana/latest/dashboards/manage-dashboard-links/

Until above grafana feature is compeleted, not sure we can go with option 1 completely. Any thoughts @andrewazores?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature or request question Further information is requested
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants