All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ringcentral.platform.metrics.micrometer.MfMeasurementsMeter Maven / Gradle / Ivy

There is a newer version: 4.0.0-RELEASE
Show newest version
package com.ringcentral.platform.metrics.micrometer;

import com.ringcentral.platform.metrics.MetricRegistry;
import io.micrometer.core.instrument.Measurement;
import io.micrometer.core.instrument.internal.DefaultMeter;

import java.util.*;

public class MfMeasurementsMeter extends DefaultMeter implements MfMeter {

    private final List> gauges = new ArrayList<>();

    public MfMeasurementsMeter(
        MetricRegistry mfRegistry,
        Id id,
        Type type,
        Iterable measurements) {

        super(id, type, measurements);

        measurements.forEach(m -> {
            MfDoubleGauge gauge = new MfDoubleGauge<>(
                mfRegistry,
                id.withTag(m.getStatistic()),
                a -> m.getValue(),
                MfMeasurementsMeter.class,
                false);

            this.gauges.add(gauge);
        });
    }

    @Override
    public void meterRemoved() {
        gauges.forEach(MfDoubleGauge::meterRemoved);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy