use of io.micrometer.core.instrument.internal.DefaultGauge in project micrometer by micrometer-metrics.
the class PrometheusMeterRegistry method newGauge.
@SuppressWarnings("unchecked")
@Override
protected <T> io.micrometer.core.instrument.Gauge newGauge(Meter.Id id, @Nullable T obj, ToDoubleFunction<T> valueFunction) {
MicrometerCollector collector = collectorByName(id);
Gauge gauge = new DefaultGauge(id, obj, valueFunction);
List<String> tagValues = tagValues(id);
collector.add((conventionName, tagKeys) -> Stream.of(new MicrometerCollector.Family(Collector.Type.GAUGE, conventionName, Stream.of(new Collector.MetricFamilySamples.Sample(conventionName, tagKeys, tagValues, gauge.value())))));
return gauge;
}
Aggregations