Fix jvm classes semantic conventions #2549
Labels
area:semantic-conventions
Related to semantic conventions
spec:metrics
Related to the specification/metrics directory
What are you trying to achieve?
The jvm classes semantic conventions aren't quite right:
process.runtime.jvm.classes.loaded
- up down counter: number of currently loaded classes. equal to total loaded + total unloaded since application start.process.runtime.jvm.classes.unloaded
- up down counter: number of total classes unloaded since application start.The metrics are asymmetric in that one reflects the current while the other reflects the total. The current is necessarily an up down counter. The total is monotonically increasing and can thus be a counter, but is marked as an up down counter so it can be consistent with the current metric.
What did you expect to see?
More consistency and better adherence to recommended instrument types. Let's do the following instead:
process.runtime.jvm.classes.loaded
- counter: number of total classes loaded since application start.process.runtime.jvm.classes.unloaded
- counter: number of total classes unloaded since application start.process.runtime.jvm.classes.current_loaded
- up down counter: number of classes currently loaded. Under stable conditions, this is equal toloaded - unloaded
. However, we can't atomically collect loaded and unloaded so most accurate to report this separately. Also, since up down counters always export as cumulative, users will always have a cumulative "current" count of classes loaded in the JVM, regardless of whether their backend is cumulative or delta. Nice.Additional context.
We discussed and agreed on this solution in the Java JVM runtime working group.
The text was updated successfully, but these errors were encountered: