use of io.micrometer.core.instrument.cumulative.CumulativeFunctionCounter in project micrometer by micrometer-metrics.
the class PrometheusMeterRegistry method newFunctionCounter.
@Override
protected <T> FunctionCounter newFunctionCounter(Meter.Id id, T obj, ToDoubleFunction<T> countFunction) {
MicrometerCollector collector = collectorByName(id);
FunctionCounter fc = new CumulativeFunctionCounter<>(id, obj, countFunction);
List<String> tagValues = tagValues(id);
collector.add((conventionName, tagKeys) -> Stream.of(new MicrometerCollector.Family(Collector.Type.COUNTER, conventionName, Stream.of(new Collector.MetricFamilySamples.Sample(conventionName, tagKeys, tagValues, fc.count())))));
return fc;
}
Aggregations