Module io.prometheus.metrics.core
Class GaugeWithCallback
java.lang.Object
io.prometheus.metrics.core.metrics.Metric
io.prometheus.metrics.core.metrics.MetricWithFixedMetadata
io.prometheus.metrics.core.metrics.GaugeWithCallback
- All Implemented Interfaces:
io.prometheus.metrics.model.registry.Collector
Example:
MemoryMXBean memoryBean = ManagementFactory.getMemoryMXBean();
GaugeWithCallback.builder()
.name("jvm_memory_bytes_used")
.help("Used bytes of a given JVM memory area.")
.unit(Unit.BYTES)
.labelNames("area")
.callback(callback -> {
callback.call(memoryBean.getHeapMemoryUsage().getUsed(), "heap");
callback.call(memoryBean.getNonHeapMemoryUsage().getUsed(), "nonheap");
})
.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 GaugeWithCallback.Builderbuilder()static GaugeWithCallback.Builderbuilder(io.prometheus.metrics.config.PrometheusProperties properties) io.prometheus.metrics.model.snapshots.GaugeSnapshotcollect()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.GaugeSnapshot collect() -
builder
-
builder
public static GaugeWithCallback.Builder builder(io.prometheus.metrics.config.PrometheusProperties properties) -
makeLabels
-