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

pl.allegro.tech.hermes.common.metric.GaugeRegistrar Maven / Gradle / Ivy

The newest version!
package pl.allegro.tech.hermes.common.metric;

import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.Tag;
import io.micrometer.core.instrument.Tags;

import java.util.function.ToDoubleFunction;

public class GaugeRegistrar {
    private final MeterRegistry meterRegistry;

    public GaugeRegistrar(MeterRegistry meterRegistry) {
        this.meterRegistry = meterRegistry;
    }

    public  void registerGauge(String name,
                                  T stateObj,
                                  ToDoubleFunction f) {
        registerGauge(name, stateObj, f, Tags.empty());
    }

    public  void registerGauge(String name,
                                  T stateObj,
                                  ToDoubleFunction f,
                                  Iterable tags) {
        meterRegistry.gauge(name, tags, stateObj, f);
    }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy