Delete PrometheusCustomizerProvider (#5811)

This commit is contained in:
jack-berg 2023-09-11 10:00:07 -05:00 committed by GitHub
parent d204124134
commit 4a44474ff0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 50 deletions

View File

@ -1,49 +0,0 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.exporter.prometheus.internal;
import io.opentelemetry.exporter.prometheus.PrometheusHttpServer;
import io.opentelemetry.exporter.prometheus.PrometheusHttpServerBuilder;
import io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizer;
import io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizerProvider;
import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;
/**
* SPI implementation for {@link PrometheusHttpServer}.
*
* <p>This class is internal and is hence not for public use. Its APIs are unstable and can change
* at any time.
*/
public class PrometheusCustomizerProvider implements AutoConfigurationCustomizerProvider {
@Override
public void customize(AutoConfigurationCustomizer autoConfiguration) {
autoConfiguration.addMeterProviderCustomizer(
(builder, config) -> {
boolean prometheusEnabled =
config.getList("otel.metrics.exporter").contains("prometheus");
if (prometheusEnabled) {
builder.registerMetricReader(configurePrometheusHttpServer(config));
}
return builder;
});
}
// Visible for test
static PrometheusHttpServer configurePrometheusHttpServer(ConfigProperties config) {
PrometheusHttpServerBuilder prometheusBuilder = PrometheusHttpServer.builder();
Integer port = config.getInt("otel.exporter.prometheus.port");
if (port != null) {
prometheusBuilder.setPort(port);
}
String host = config.getString("otel.exporter.prometheus.host");
if (host != null) {
prometheusBuilder.setHost(host);
}
return prometheusBuilder.build();
}
}

View File

@ -1 +0,0 @@
io.opentelemetry.exporter.prometheus.internal.PrometheusCustomizerProvider