io.smallrye.faulttolerance.standalone.MicrometerAdapter Maven / Gradle / Ivy
package io.smallrye.faulttolerance.standalone;
import java.util.Collections;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.Tag;
import io.smallrye.faulttolerance.core.metrics.MeteredOperation;
import io.smallrye.faulttolerance.core.metrics.MetricsConstants;
import io.smallrye.faulttolerance.core.metrics.MetricsProvider;
import io.smallrye.faulttolerance.core.metrics.MetricsRecorder;
import io.smallrye.faulttolerance.core.metrics.MicrometerRecorder;
import io.smallrye.faulttolerance.core.timer.Timer;
public final class MicrometerAdapter implements MetricsAdapter {
private final MeterRegistry registry;
public MicrometerAdapter(MeterRegistry registry) {
this.registry = registry;
}
MetricsProvider createMetricsProvider(Timer timer) {
registry.gauge(MetricsConstants.TIMER_SCHEDULED, Collections.singletonList(Tag.of("id", "" + timer.getId())),
timer, Timer::countScheduledTasks);
return new MetricsProvider() {
private final Map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy