-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add counter for total loaded classes #3561
Comments
I see that jvm.classes.loaded metric is the number of classes that are loaded currently and this being a gauge makes sense. jvm.classes.unloaded - is the total number of classes unloaded since the JVM has started, so this should not be a gauge but rather a counter. Will it be informational to also expose "the total number of classes loaded" by the JVM? |
Upvoting this |
Some questions:
So is this issue about adding the "the total number of classes loaded" ? Are you upvoting this @patpatpat123 ? |
Hello @marcingrzejszczak , Thank you for your input. First of all, you are correct about the two metrics:
And yes, it would be great to have metrics unifying those, to allow building visuals such as a loaded vs. unloaded counter. |
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed. |
I am voting for the below 2 things,
|
Thanks for the update. Are you willing to file a PR for this @lenin-jaganathan ? |
I think there is an open question on how we handle the names,
Today, we already have a metric named Also see what OTEL does in this space. |
We could do sth like this
Now if someone wants to be OTel compliant they can create a WDYT @shakuzen @jonatan-ivanov ? |
I think if the names for classes loaded and unloaded don't match, it will cause a bit of confusion. However, since both of them are counters, I am not opposed to having a |
I am proposing the below changes for the class loading metrics,
@marcingrzejszczak / @shakuzen / @jonatan-ivanov Let me know what you guys think. Apart from the breaking change, there is no problem with the above. This is similar to what was proposed in but just that we add One another option would be to emit, I would call this metric name change out in release notes and move with option 1. Let me know what you guys think. |
The description before could have been confusing for step-based registries where the number would be the classes unloaded since the previous step rather than the cumulative count since the JVM started. See micrometer-metricsgh-3561
I've opened #5745 to address the description part of the issue, as I think that's a more straightforward change without open questions (though feel free to leave feedback there if there is any). As for the new metric and naming, I'm not sure what is best. A breaking change is rather undesirable, but so is naming inconsistency. We'll discuss. I've relabeled the issue and updated the title since the description issue is being taken care of separately in the PR. |
The description before could have been confusing for step-based registries where the number would be the classes unloaded since the previous step rather than the cumulative count since the JVM started. See micrometer-metricsgh-3561
Describe the bug
Currently, the JVM class unloading metric is being registered as a Function counter. The description says "The total number of classes unloaded since the Java virtual machine has started execution" which will not be true when this metric is used in a Step Meter Registry.
Environment
To Reproduce
How to reproduce the bug:
Start the java application with the micrometer JVM binder enabled. Use any step registry to register these metrics. After one step is completed, the unloaded class becomes zero.
Expected behavior
jvm.classes.unloaded - should represent the total number of classes unloaded since the Java virtual machine has started execution
The text was updated successfully, but these errors were encountered: