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

io.quarkus.micrometer.runtime.binder.mpmetrics.MpMetricsBinder Maven / Gradle / Ivy

Go to download

Instrument the runtime and your application with dimensional metrics using Micrometer.

There is a newer version: 3.17.5
Show newest version
package io.quarkus.micrometer.runtime.binder.mpmetrics;

import java.util.Iterator;

import jakarta.enterprise.inject.Instance;
import jakarta.inject.Singleton;

import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.binder.MeterBinder;

@Singleton
class MpMetricsBinder implements MeterBinder {

    final Instance allGaugeAdapters;

    // Micrometer application meter registry
    final MetricRegistryAdapter registry;

    MpMetricsBinder(MetricRegistryAdapter registry,
            Instance allGaugeAdapters) {
        this.registry = registry;
        this.allGaugeAdapters = allGaugeAdapters;
    }

    @Override
    public void bindTo(MeterRegistry r) {
        // register all annotation-declared gauges
        // this needs to wait until associated/monitored objects can be created.
        for (Iterator gauges = allGaugeAdapters.iterator(); gauges.hasNext();) {
            registry.bindAnnotatedGauge(gauges.next());
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy