Search in sources :

Example 1 with DefaultMeter

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

the class AtlasMeterRegistry method newMeter.

@Override
protected Meter newMeter(Meter.Id id, Meter.Type type, Iterable<io.micrometer.core.instrument.Measurement> measurements) {
    Id spectatorId = spectatorId(id);
    com.netflix.spectator.api.AbstractMeter<Id> spectatorMeter = new com.netflix.spectator.api.AbstractMeter<Id>(registry.clock(), spectatorId, spectatorId) {

        @Override
        public Iterable<com.netflix.spectator.api.Measurement> measure() {
            return stream(measurements.spliterator(), false).map(m -> {
                com.netflix.spectator.api.Statistic stat = AtlasUtils.toSpectatorStatistic(m.getStatistic());
                Id idWithStat = stat == null ? id : id.withTag("statistic", stat.toString());
                return new com.netflix.spectator.api.Measurement(idWithStat, clock.wallTime(), m.getValue());
            }).collect(toList());
        }
    };
    registry.register(spectatorMeter);
    return new DefaultMeter(id, type, measurements);
}
Also used : StepFunctionCounter(io.micrometer.core.instrument.step.StepFunctionCounter) HistogramGauges(io.micrometer.core.instrument.distribution.HistogramGauges) AtlasRegistry(com.netflix.spectator.atlas.AtlasRegistry) Id(com.netflix.spectator.api.Id) PercentileDistributionSummary(com.netflix.spectator.api.histogram.PercentileDistributionSummary) ValueAtPercentile(io.micrometer.core.instrument.distribution.ValueAtPercentile) DoubleFormat(io.micrometer.core.instrument.util.DoubleFormat) PercentileTimer(com.netflix.spectator.api.histogram.PercentileTimer) DistributionStatisticConfig(io.micrometer.core.instrument.distribution.DistributionStatisticConfig) BasicTag(com.netflix.spectator.api.BasicTag) ToLongFunction(java.util.function.ToLongFunction) Method(java.lang.reflect.Method) Nullable(io.micrometer.core.lang.Nullable) AtlasConfig(com.netflix.spectator.atlas.AtlasConfig) PauseDetector(io.micrometer.core.instrument.distribution.pause.PauseDetector) StepFunctionTimer(io.micrometer.core.instrument.step.StepFunctionTimer) InvocationTargetException(java.lang.reflect.InvocationTargetException) TimeUnit(java.util.concurrent.TimeUnit) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList) StreamSupport.stream(java.util.stream.StreamSupport.stream) ToDoubleFunction(java.util.function.ToDoubleFunction) Registry(com.netflix.spectator.api.Registry) io.micrometer.core.instrument(io.micrometer.core.instrument) DefaultMeter(io.micrometer.core.instrument.internal.DefaultMeter) Id(com.netflix.spectator.api.Id) DefaultMeter(io.micrometer.core.instrument.internal.DefaultMeter)

Aggregations

BasicTag (com.netflix.spectator.api.BasicTag)1 Id (com.netflix.spectator.api.Id)1 Registry (com.netflix.spectator.api.Registry)1 PercentileDistributionSummary (com.netflix.spectator.api.histogram.PercentileDistributionSummary)1 PercentileTimer (com.netflix.spectator.api.histogram.PercentileTimer)1 AtlasConfig (com.netflix.spectator.atlas.AtlasConfig)1 AtlasRegistry (com.netflix.spectator.atlas.AtlasRegistry)1 io.micrometer.core.instrument (io.micrometer.core.instrument)1 DistributionStatisticConfig (io.micrometer.core.instrument.distribution.DistributionStatisticConfig)1 HistogramGauges (io.micrometer.core.instrument.distribution.HistogramGauges)1 ValueAtPercentile (io.micrometer.core.instrument.distribution.ValueAtPercentile)1 PauseDetector (io.micrometer.core.instrument.distribution.pause.PauseDetector)1 DefaultMeter (io.micrometer.core.instrument.internal.DefaultMeter)1 StepFunctionCounter (io.micrometer.core.instrument.step.StepFunctionCounter)1 StepFunctionTimer (io.micrometer.core.instrument.step.StepFunctionTimer)1 DoubleFormat (io.micrometer.core.instrument.util.DoubleFormat)1 Nullable (io.micrometer.core.lang.Nullable)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Method (java.lang.reflect.Method)1 List (java.util.List)1