Module io.prometheus.metrics.core
Class SummaryWithCallback
Object
Metric
MetricWithFixedMetadata
SummaryWithCallback
- All Implemented Interfaces:
Collector
Example:
double MILLISECONDS_PER_SECOND = 1E3;
SummaryWithCallback.builder()
.name("jvm_gc_collection_seconds")
.help("Time spent in a given JVM garbage collector in seconds.")
.unit(Unit.SECONDS)
.labelNames("gc")
.callback(callback -> {
for (GarbageCollectorMXBean gc : ManagementFactory.getGarbageCollectorMXBeans()) {
callback.call(
gc.getCollectionCount(),
gc.getCollectionTime() / MILLISECONDS_PER_SECOND,
Quantiles.EMPTY,
gc.getName()
);
}
})
.register();
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic interface -
Method Summary
Modifier and TypeMethodDescriptionstatic SummaryWithCallback.Builderbuilder()static SummaryWithCallback.Builderbuilder(PrometheusProperties properties) SummarySnapshotcollect()Methods inherited from class MetricWithFixedMetadata
getPrometheusNameMethods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Collector
collect, collect, collect