I am interested in tracking two metrics within JVM - Number of GCs per minute and Time Spent in GC per minute. I have metrics jvm_gc_collection_seconds.count and jvm_gc_collection_seconds.sum available with me on the dashboard but I am a little confused about their meaning.
The first metric jvm_gc_collection_seconds.count seems like it has something to do with measuring time but reading up on it I believe it is the number of times GC was invoked from the start of time (when application started).
- Is this right?
- If so why is there the word "seconds" in the metric name?
- Would
jvm_gc_collection_seconds.count/1 minutegive me the number of GC invocation per minute?
The second metric jvm_gc_collection_seconds.sum I believe is the total time spent doing GC activity in seconds from the start of time.
- Is that right?
- Would
jvm_gc_collection_seconds.sum/1 minutegive me the time spent in seconds doing GC activity in a 1 minute time window?
jvm_gc_collection_secondsis a summary metric.So
jvm_gc_collection_seconds_counthas as a total value number of GC events that took place since application start. Andjvm_gc_collection_seconds_sum- total number of seconds taken by all those events.To get the number of GC invocation per minute you can use
increase(jvm_gc_collection_seconds_count [1m]). And similarly for time spent:increase(jvm_gc_collection_seconds_sum [1m]).Additionally, you might find some helpful tips regarding JVM metrics regarding garbage collection in this post by Brian Brazil.