|
|
|
@ -22,6 +22,8 @@ import org.hyperledger.besu.metrics.opentelemetry.OpenTelemetrySystem; |
|
|
|
|
import org.hyperledger.besu.metrics.prometheus.MetricsConfiguration; |
|
|
|
|
import org.hyperledger.besu.metrics.prometheus.PrometheusMetricsSystem; |
|
|
|
|
|
|
|
|
|
import java.util.concurrent.atomic.AtomicBoolean; |
|
|
|
|
|
|
|
|
|
import io.opentelemetry.api.GlobalOpenTelemetry; |
|
|
|
|
import io.opentelemetry.api.OpenTelemetry; |
|
|
|
|
import org.slf4j.Logger; |
|
|
|
@ -31,12 +33,15 @@ import org.slf4j.LoggerFactory; |
|
|
|
|
public class MetricsSystemFactory { |
|
|
|
|
|
|
|
|
|
private static final Logger LOG = LoggerFactory.getLogger(MetricsSystemFactory.class); |
|
|
|
|
private static final AtomicBoolean globalOpenTelemetryDisabled = new AtomicBoolean(false); |
|
|
|
|
|
|
|
|
|
private MetricsSystemFactory() {} |
|
|
|
|
|
|
|
|
|
private static void disableGlobalOpenTelemetry() { |
|
|
|
|
if (!globalOpenTelemetryDisabled.compareAndExchange(false, true)) { |
|
|
|
|
GlobalOpenTelemetry.set(OpenTelemetry.noop()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Creates and starts a new metric system to observe the behavior of the client |
|
|
|
|