Module io.prometheus.metrics.core
Class SummaryWithCallback
java.lang.Object
io.prometheus.metrics.core.metrics.Metric
io.prometheus.metrics.core.metrics.MetricWithFixedMetadata
io.prometheus.metrics.core.metrics.SummaryWithCallback
- All Implemented Interfaces:
io.prometheus.metrics.model.registry.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 -
Field Summary
Fields inherited from class io.prometheus.metrics.core.metrics.MetricWithFixedMetadata
labelNamesFields inherited from class io.prometheus.metrics.core.metrics.Metric
constLabels -
Method Summary
Modifier and TypeMethodDescriptionstatic SummaryWithCallback.Builderbuilder()static SummaryWithCallback.Builderbuilder(io.prometheus.metrics.config.PrometheusProperties properties) io.prometheus.metrics.model.snapshots.SummarySnapshotcollect()protected io.prometheus.metrics.model.snapshots.LabelsmakeLabels(String... labelValues) Methods inherited from class io.prometheus.metrics.core.metrics.MetricWithFixedMetadata
getMetadata, getPrometheusNameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.prometheus.metrics.model.registry.Collector
collect, collect, collect
-
Method Details
-
collect
public io.prometheus.metrics.model.snapshots.SummarySnapshot collect() -
builder
-
builder
public static SummaryWithCallback.Builder builder(io.prometheus.metrics.config.PrometheusProperties properties) -
makeLabels
-