Search in sources :

Example 1 with PrometheusHttpServerBuilder

use of io.opentelemetry.exporter.prometheus.PrometheusHttpServerBuilder in project opentelemetry-java by open-telemetry.

the class MetricExporterConfiguration method configurePrometheusMetricReader.

private static MetricReaderFactory configurePrometheusMetricReader(ConfigProperties config) {
    ClasspathUtil.checkClassExists("io.opentelemetry.exporter.prometheus.PrometheusHttpServer", "Prometheus Metrics Server", "opentelemetry-exporter-prometheus");
    PrometheusHttpServerBuilder prom = PrometheusHttpServer.builder();
    Integer port = config.getInt("otel.exporter.prometheus.port");
    if (port != null) {
        prom.setPort(port);
    }
    String host = config.getString("otel.exporter.prometheus.host");
    if (host != null) {
        prom.setHost(host);
    }
    return prom.newMetricReaderFactory();
}
Also used : PrometheusHttpServerBuilder(io.opentelemetry.exporter.prometheus.PrometheusHttpServerBuilder)

Aggregations

PrometheusHttpServerBuilder (io.opentelemetry.exporter.prometheus.PrometheusHttpServerBuilder)1