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.newBuilder()
.withName("jvm_gc_collection_seconds")
.withHelp("Time spent in a given JVM garbage collector in seconds.")
.withUnit(Unit.SECONDS)
.withLabelNames("gc")
.withCallback(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 class
static interface
-
Field Summary
Fields inherited from class io.prometheus.metrics.core.metrics.MetricWithFixedMetadata
labelNames
Fields inherited from class io.prometheus.metrics.core.metrics.Metric
constLabels
-
Method Summary
Modifier and TypeMethodDescriptionio.prometheus.metrics.model.snapshots.SummarySnapshot
collect()
protected io.prometheus.metrics.model.snapshots.Labels
makeLabels
(String... labelValues) static SummaryWithCallback.Builder
static SummaryWithCallback.Builder
newBuilder
(io.prometheus.metrics.config.PrometheusProperties properties) Methods inherited from class io.prometheus.metrics.core.metrics.MetricWithFixedMetadata
getMetadata
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.prometheus.metrics.model.registry.Collector
collect, getPrometheusName
-
Method Details
-
collect
-
newBuilder
-
newBuilder
public static SummaryWithCallback.Builder newBuilder(io.prometheus.metrics.config.PrometheusProperties properties) -
makeLabels
-