io.quarkiverse.micrometer.registry.datadog.ConditionalRegistryProducer Maven / Gradle / Ivy
package io.quarkiverse.micrometer.registry.datadog;
import javax.enterprise.inject.Alternative;
import javax.enterprise.inject.Produces;
import javax.inject.Singleton;
import javax.interceptor.Interceptor;
import io.micrometer.core.instrument.Clock;
import io.micrometer.datadog.DatadogConfig;
import io.micrometer.datadog.DatadogMeterRegistry;
import io.quarkus.arc.Priority;
@Singleton
public class ConditionalRegistryProducer {
/**
* This producer is added as a bean by the Processor IFF the default registry
* instance has been enabled.
*/
@Produces
@Singleton
@Alternative
@Priority(Interceptor.Priority.APPLICATION + 100)
public DatadogMeterRegistry registry(DatadogConfig config, Clock clock) {
return DatadogMeterRegistry.builder(config)
.clock(clock)
.build();
}
}