use of io.prometheus.client.CollectorRegistry 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();
}
use of io.prometheus.client.CollectorRegistry in project promregator by promregator.
the class AbstractMetricsEndpoint method setupOwnRequestScopedMetrics.
@PostConstruct
public void setupOwnRequestScopedMetrics() {
this.requestRegistry = new CollectorRegistry();
Builder builder = Gauge.build("promregator_up", "Indicator, whether the target of promregator is available");
if (this.isLabelEnrichmentEnabled()) {
builder = builder.labelNames(CFAllLabelsMetricFamilySamplesEnricher.getEnrichingLabelNames());
} else {
builder = builder.labelNames(NullMetricFamilySamplesEnricher.getEnrichingLabelNames());
}
this.up = builder.register(this.requestRegistry);
}
use of io.prometheus.client.CollectorRegistry in project promregator by promregator.
the class PromregatorApplication method collectorRegistry.
@Bean
public CollectorRegistry collectorRegistry() {
CollectorRegistry cr = CollectorRegistry.defaultRegistry;
DefaultExports.initialize();
return cr;
}
Aggregations