Search in sources :

Example 1 with PrometheusMeterRegistry

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());
}
Also used : PrometheusMeterRegistry(io.micrometer.prometheus.PrometheusMeterRegistry) Metrics(com.uber.jaeger.metrics.Metrics) Before(org.junit.Before)

Example 2 with PrometheusMeterRegistry

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);
}
Also used : PrometheusMeterRegistry(io.micrometer.prometheus.PrometheusMeterRegistry) VertxPrometheusOptions(io.vertx.micrometer.VertxPrometheusOptions) Router(io.vertx.ext.web.Router) Vertx(io.vertx.core.Vertx) VertxOptions(io.vertx.core.VertxOptions) MicrometerMetricsOptions(io.vertx.micrometer.MicrometerMetricsOptions)

Example 3 with PrometheusMeterRegistry

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);
    }
}
Also used : PrometheusMeterRegistry(io.micrometer.prometheus.PrometheusMeterRegistry) PlatformConfiguration(com.canoo.platform.core.PlatformConfiguration) ProcessorMetrics(io.micrometer.core.instrument.binder.system.ProcessorMetrics) RequestMetricsFilter(com.canoo.dp.impl.platform.server.metrics.servlet.RequestMetricsFilter) JvmMemoryMetrics(io.micrometer.core.instrument.binder.jvm.JvmMemoryMetrics) JvmGcMetrics(io.micrometer.core.instrument.binder.jvm.JvmGcMetrics) ClassLoaderMetrics(io.micrometer.core.instrument.binder.jvm.ClassLoaderMetrics) JvmThreadMetrics(io.micrometer.core.instrument.binder.jvm.JvmThreadMetrics) MetricsHttpSessionListener(com.canoo.dp.impl.platform.server.metrics.servlet.MetricsHttpSessionListener) MetricsServlet(com.canoo.dp.impl.platform.server.metrics.servlet.MetricsServlet) ServletContext(javax.servlet.ServletContext) Tag(io.micrometer.core.instrument.Tag) DispatcherType(javax.servlet.DispatcherType)

Example 4 with PrometheusMeterRegistry

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);
}
Also used : PrometheusMeterRegistry(io.micrometer.prometheus.PrometheusMeterRegistry) ClassLoaderMetrics(io.micrometer.core.instrument.binder.jvm.ClassLoaderMetrics) JvmThreadMetrics(io.micrometer.core.instrument.binder.jvm.JvmThreadMetrics) ProcessorMetrics(io.micrometer.core.instrument.binder.system.ProcessorMetrics) JmxMeterRegistry(io.micrometer.jmx.JmxMeterRegistry) FileDescriptorMetrics(io.micrometer.core.instrument.binder.system.FileDescriptorMetrics) JvmMemoryMetrics(io.micrometer.core.instrument.binder.jvm.JvmMemoryMetrics) UptimeMetrics(io.micrometer.core.instrument.binder.system.UptimeMetrics) JVMInfoBinder(org.apache.zeppelin.metric.JVMInfoBinder)

Example 5 with PrometheusMeterRegistry

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");
}
Also used : PrometheusMeterRegistry(io.micrometer.prometheus.PrometheusMeterRegistry)

Aggregations

PrometheusMeterRegistry (io.micrometer.prometheus.PrometheusMeterRegistry)9 ClassLoaderMetrics (io.micrometer.core.instrument.binder.jvm.ClassLoaderMetrics)3 JvmMemoryMetrics (io.micrometer.core.instrument.binder.jvm.JvmMemoryMetrics)3 JvmThreadMetrics (io.micrometer.core.instrument.binder.jvm.JvmThreadMetrics)3 ProcessorMetrics (io.micrometer.core.instrument.binder.system.ProcessorMetrics)3 JvmGcMetrics (io.micrometer.core.instrument.binder.jvm.JvmGcMetrics)2 VertxOptions (io.vertx.core.VertxOptions)2 Router (io.vertx.ext.web.Router)2 MicrometerMetricsOptions (io.vertx.micrometer.MicrometerMetricsOptions)2 VertxPrometheusOptions (io.vertx.micrometer.VertxPrometheusOptions)2 MetricsHttpSessionListener (com.canoo.dp.impl.platform.server.metrics.servlet.MetricsHttpSessionListener)1 MetricsServlet (com.canoo.dp.impl.platform.server.metrics.servlet.MetricsServlet)1 RequestMetricsFilter (com.canoo.dp.impl.platform.server.metrics.servlet.RequestMetricsFilter)1 PlatformConfiguration (com.canoo.platform.core.PlatformConfiguration)1 HttpServer (com.sun.net.httpserver.HttpServer)1 Metrics (com.uber.jaeger.metrics.Metrics)1 Tag (io.micrometer.core.instrument.Tag)1 FileDescriptorMetrics (io.micrometer.core.instrument.binder.system.FileDescriptorMetrics)1 UptimeMetrics (io.micrometer.core.instrument.binder.system.UptimeMetrics)1 Nullable (io.micrometer.core.lang.Nullable)1