Search in sources :

Example 1 with DefaultLongTaskTimer

use of io.micrometer.core.instrument.internal.DefaultLongTaskTimer in project micrometer by micrometer-metrics.

the class PrometheusMeterRegistry method newLongTaskTimer.

@Override
protected LongTaskTimer newLongTaskTimer(Meter.Id id) {
    MicrometerCollector collector = collectorByName(id);
    LongTaskTimer ltt = new DefaultLongTaskTimer(id, clock);
    List<String> tagValues = tagValues(id);
    collector.add((conventionName, tagKeys) -> Stream.of(new MicrometerCollector.Family(Collector.Type.UNTYPED, conventionName, Stream.of(new Collector.MetricFamilySamples.Sample(conventionName + "_active_count", tagKeys, tagValues, ltt.activeTasks()), new Collector.MetricFamilySamples.Sample(conventionName + "_duration_sum", tagKeys, tagValues, ltt.duration(TimeUnit.SECONDS))))));
    return ltt;
}
Also used : DefaultLongTaskTimer(io.micrometer.core.instrument.internal.DefaultLongTaskTimer) Collector(io.prometheus.client.Collector) DefaultLongTaskTimer(io.micrometer.core.instrument.internal.DefaultLongTaskTimer)

Example 2 with DefaultLongTaskTimer

use of io.micrometer.core.instrument.internal.DefaultLongTaskTimer in project micrometer by micrometer-metrics.

the class DropwizardMeterRegistry method newLongTaskTimer.

@Override
protected LongTaskTimer newLongTaskTimer(Meter.Id id) {
    LongTaskTimer ltt = new DefaultLongTaskTimer(id, clock);
    registry.register(hierarchicalName(id.withTag(Statistic.ACTIVE_TASKS)), (Gauge<Integer>) ltt::activeTasks);
    registry.register(hierarchicalName(id.withTag(Statistic.DURATION)), (Gauge<Double>) () -> ltt.duration(TimeUnit.NANOSECONDS));
    return ltt;
}
Also used : DefaultLongTaskTimer(io.micrometer.core.instrument.internal.DefaultLongTaskTimer) DefaultLongTaskTimer(io.micrometer.core.instrument.internal.DefaultLongTaskTimer)

Aggregations

DefaultLongTaskTimer (io.micrometer.core.instrument.internal.DefaultLongTaskTimer)2 Collector (io.prometheus.client.Collector)1