org.zodiac.monitor.metrics.micrometer.MicrometerAdviceBase Maven / Gradle / Ivy
package org.zodiac.monitor.metrics.micrometer;
import java.util.concurrent.atomic.AtomicBoolean;
import org.zodiac.monitor.metrics.MetricsAdviceBase;
import io.micrometer.core.instrument.MeterRegistry;
public abstract class MicrometerAdviceBase extends MetricsAdviceBase {
private final AtomicBoolean registryInitialized = new AtomicBoolean();
/**
* Related and SpringBoot-1.x core types:
*
*
* DefaultGaugeService
* DropwizardMetricServices
* BufferGaugeService
* ServoMetricService
* MetricRegistry
*
*
*/
private MeterRegistry registry;
protected MicrometerAdviceBase() {
}
protected MicrometerAdviceBase(MeterRegistry registry) {
setRegistry(registry);
}
public MicrometerAdviceBase setRegistry(MeterRegistry registry) {
if (registryInitialized.compareAndSet(false, true)) {
this.registry = registry;
}
return this;
}
protected final MeterRegistry getRegistry() {
return registry;
}
}