use of io.micrometer.prometheus.PrometheusMeterRegistry in project jaeger-client-java by jaegertracing.
the class MicrometerTest method setUp.
@Before
public void setUp() {
registry = io.micrometer.core.instrument.Metrics.globalRegistry;
prometheusRegistry = new PrometheusMeterRegistry(PrometheusConfig.DEFAULT);
io.micrometer.core.instrument.Metrics.addRegistry(prometheusRegistry);
metrics = new Metrics(new MicrometerMetricsFactory());
}
use of io.micrometer.prometheus.PrometheusMeterRegistry in project vertx-micrometer-metrics by vert-x3.
the class MetricsExamples method setupPrometheusBoundRouter.
public void setupPrometheusBoundRouter() {
Vertx vertx = Vertx.vertx(new VertxOptions().setMetricsOptions(new MicrometerMetricsOptions().setPrometheusOptions(new VertxPrometheusOptions().setEnabled(true)).setEnabled(true)));
// Later on, creating a router
Router router = Router.router(vertx);
router.route("/metrics").handler(routingContext -> {
PrometheusMeterRegistry prometheusRegistry = (PrometheusMeterRegistry) BackendRegistries.getDefaultNow();
if (prometheusRegistry != null) {
String response = prometheusRegistry.scrape();
routingContext.response().end(response);
} else {
routingContext.fail(500);
}
});
vertx.createHttpServer().requestHandler(router::accept).listen(8080);
}
use of io.micrometer.prometheus.PrometheusMeterRegistry in project dolphin-platform by canoo.
the class MetricsModule method initialize.
@Override
public void initialize(final ServerCoreComponents coreComponents) {
final PlatformConfiguration configuration = coreComponents.getConfiguration();
final ServletContext servletContext = coreComponents.getInstance(ServletContext.class);
if (!configuration.getBooleanProperty(METRICS_NOOP_PROPERTY, true)) {
final PrometheusMeterRegistry prometheusRegistry = new PrometheusMeterRegistry(PrometheusConfig.DEFAULT);
final List<Tag> tagList = TagUtil.convertTags(ContextManagerImpl.getInstance().getGlobalContexts());
new ClassLoaderMetrics(tagList).bindTo(prometheusRegistry);
new JvmMemoryMetrics(tagList).bindTo(prometheusRegistry);
new JvmGcMetrics(tagList).bindTo(prometheusRegistry);
new ProcessorMetrics(tagList).bindTo(prometheusRegistry);
new JvmThreadMetrics(tagList).bindTo(prometheusRegistry);
servletContext.addFilter(METRICS_SERVLET_FILTER_NAME, new RequestMetricsFilter()).addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, ALL_URL_MAPPING);
servletContext.addListener(new MetricsHttpSessionListener());
servletContext.addServlet(METRICS_SERVLET_NAME, new MetricsServlet(prometheusRegistry)).addMapping(configuration.getProperty(METRICS_ENDPOINT_PROPERTY));
MetricsImpl.getInstance().init(prometheusRegistry);
}
}
use of io.micrometer.prometheus.PrometheusMeterRegistry in project zeppelin by apache.
the class ZeppelinServer method initMetrics.
private static void initMetrics(ZeppelinConfiguration conf) {
if (conf.isPrometheusMetricEnabled()) {
promMetricRegistry = new PrometheusMeterRegistry(PrometheusConfig.DEFAULT);
Metrics.addRegistry(promMetricRegistry);
}
if (conf.isJMXEnabled()) {
Metrics.addRegistry(new JmxMeterRegistry(JmxConfig.DEFAULT, Clock.SYSTEM));
}
new ClassLoaderMetrics().bindTo(Metrics.globalRegistry);
new JvmMemoryMetrics().bindTo(Metrics.globalRegistry);
new JvmThreadMetrics().bindTo(Metrics.globalRegistry);
new FileDescriptorMetrics().bindTo(Metrics.globalRegistry);
new ProcessorMetrics().bindTo(Metrics.globalRegistry);
new UptimeMetrics().bindTo(Metrics.globalRegistry);
new JVMInfoBinder().bindTo(Metrics.globalRegistry);
}
use of io.micrometer.prometheus.PrometheusMeterRegistry in project micrometer by micrometer-metrics.
the class CounterBenchmark method setup.
@Setup
public void setup() {
registry = new PrometheusMeterRegistry(PrometheusConfig.DEFAULT);
counter = registry.counter("counter");
}
Aggregations