Search in sources :

Example 6 with HTTPServer

use of io.prometheus.client.exporter.HTTPServer in project infrautils by opendaylight.

the class MetricsPrometheusExampleMain method main.

public static void main(String[] args) throws IOException {
    // see also OsgiWebInitializer
    CollectorRegistry collectorRegistry = new CollectorRegistrySingleton();
    PrometheusMetricProviderImpl metricProvider = new PrometheusMetricProviderImpl(collectorRegistry);
    MetricsExample metricsExample = new MetricsExample(metricProvider);
    metricsExample.init();
    HTTPServer server = new HTTPServer(new InetSocketAddress("localhost", 1234), collectorRegistry);
    System.in.read();
    server.stop();
    metricsExample.close();
    metricProvider.close();
}
Also used : HTTPServer(io.prometheus.client.exporter.HTTPServer) PrometheusMetricProviderImpl(org.opendaylight.infrautils.metrics.prometheus.impl.PrometheusMetricProviderImpl) InetSocketAddress(java.net.InetSocketAddress) CollectorRegistry(io.prometheus.client.CollectorRegistry) CollectorRegistrySingleton(org.opendaylight.infrautils.metrics.prometheus.impl.CollectorRegistrySingleton)

Aggregations

HTTPServer (io.prometheus.client.exporter.HTTPServer)6 InetSocketAddress (java.net.InetSocketAddress)5 CollectorRegistry (io.prometheus.client.CollectorRegistry)2 File (java.io.File)2 IOException (java.io.IOException)2 ServiceCombException (org.apache.servicecomb.foundation.common.exceptions.ServiceCombException)1 BBoxDBConfiguration (org.bboxdb.misc.BBoxDBConfiguration)1 CollectorRegistrySingleton (org.opendaylight.infrautils.metrics.prometheus.impl.CollectorRegistrySingleton)1 PrometheusMetricProviderImpl (org.opendaylight.infrautils.metrics.prometheus.impl.PrometheusMetricProviderImpl)1 Listener (org.spongepowered.api.event.Listener)1