Search in sources :

Example 1 with StepTimer

use of io.micrometer.core.instrument.step.StepTimer in project micrometer by micrometer-metrics.

the class SimpleMeterRegistry method newTimer.

@Override
protected Timer newTimer(Meter.Id id, DistributionStatisticConfig distributionStatisticConfig, PauseDetector pauseDetector) {
    DistributionStatisticConfig merged = distributionStatisticConfig.merge(DistributionStatisticConfig.builder().expiry(config.step()).build());
    Timer timer;
    switch(config.mode()) {
        case CUMULATIVE:
            timer = new CumulativeTimer(id, clock, merged, pauseDetector, getBaseTimeUnit(), false);
            break;
        case STEP:
        default:
            timer = new StepTimer(id, clock, merged, pauseDetector, getBaseTimeUnit(), false);
            break;
    }
    HistogramGauges.registerWithCommonFormat(timer, this);
    return timer;
}
Also used : StepTimer(io.micrometer.core.instrument.step.StepTimer) DefaultLongTaskTimer(io.micrometer.core.instrument.internal.DefaultLongTaskTimer) StepTimer(io.micrometer.core.instrument.step.StepTimer) DistributionStatisticConfig(io.micrometer.core.instrument.distribution.DistributionStatisticConfig)

Aggregations

DistributionStatisticConfig (io.micrometer.core.instrument.distribution.DistributionStatisticConfig)1 DefaultLongTaskTimer (io.micrometer.core.instrument.internal.DefaultLongTaskTimer)1 StepTimer (io.micrometer.core.instrument.step.StepTimer)1