pl.allegro.tech.hermes.common.metric.GaugeRegistrar Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hermes-common Show documentation
Show all versions of hermes-common Show documentation
Fast and reliable message broker built on top of Kafka.
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);
}
}