Search in sources :

Example 16 with InstrumentedFilter

use of com.codahale.metrics.servlet.InstrumentedFilter in project tutorials by eugenp.

the class WebConfigurer method initMetrics.

/**
 * Initializes Metrics.
 */
private void initMetrics(ServletContext servletContext, EnumSet<DispatcherType> disps) {
    log.debug("Initializing Metrics registries");
    servletContext.setAttribute(InstrumentedFilter.REGISTRY_ATTRIBUTE, metricRegistry);
    servletContext.setAttribute(MetricsServlet.METRICS_REGISTRY, metricRegistry);
    log.debug("Registering Metrics Filter");
    FilterRegistration.Dynamic metricsFilter = servletContext.addFilter("webappMetricsFilter", new InstrumentedFilter());
    metricsFilter.addMappingForUrlPatterns(disps, true, "/*");
    metricsFilter.setAsyncSupported(true);
    log.debug("Registering Metrics Servlet");
    ServletRegistration.Dynamic metricsAdminServlet = servletContext.addServlet("metricsServlet", new MetricsServlet());
    metricsAdminServlet.addMapping("/management/metrics/*");
    metricsAdminServlet.setAsyncSupported(true);
    metricsAdminServlet.setLoadOnStartup(2);
}
Also used : MetricsServlet(com.codahale.metrics.servlets.MetricsServlet) InstrumentedFilter(com.codahale.metrics.servlet.InstrumentedFilter)

Example 17 with InstrumentedFilter

use of com.codahale.metrics.servlet.InstrumentedFilter in project tutorials by eugenp.

the class WebConfigurer method initMetrics.

/**
 * Initializes Metrics.
 */
private void initMetrics(ServletContext servletContext, EnumSet<DispatcherType> disps) {
    log.debug("Initializing Metrics registries");
    servletContext.setAttribute(InstrumentedFilter.REGISTRY_ATTRIBUTE, metricRegistry);
    servletContext.setAttribute(MetricsServlet.METRICS_REGISTRY, metricRegistry);
    log.debug("Registering Metrics Filter");
    FilterRegistration.Dynamic metricsFilter = servletContext.addFilter("webappMetricsFilter", new InstrumentedFilter());
    metricsFilter.addMappingForUrlPatterns(disps, true, "/*");
    metricsFilter.setAsyncSupported(true);
    log.debug("Registering Metrics Servlet");
    ServletRegistration.Dynamic metricsAdminServlet = servletContext.addServlet("metricsServlet", new MetricsServlet());
    metricsAdminServlet.addMapping("/management/metrics/*");
    metricsAdminServlet.setAsyncSupported(true);
    metricsAdminServlet.setLoadOnStartup(2);
}
Also used : MetricsServlet(com.codahale.metrics.servlets.MetricsServlet) InstrumentedFilter(com.codahale.metrics.servlet.InstrumentedFilter)

Example 18 with InstrumentedFilter

use of com.codahale.metrics.servlet.InstrumentedFilter in project xm-ms-entity by xm-online.

the class WebConfigurer method initMetrics.

/**
 * Initializes Metrics.
 */
private void initMetrics(ServletContext servletContext, EnumSet<DispatcherType> disps) {
    log.debug("Initializing Metrics registries");
    servletContext.setAttribute(InstrumentedFilter.REGISTRY_ATTRIBUTE, metricRegistry);
    servletContext.setAttribute(MetricsServlet.METRICS_REGISTRY, metricRegistry);
    log.debug("Registering Metrics Filter");
    FilterRegistration.Dynamic metricsFilter = servletContext.addFilter("webappMetricsFilter", new InstrumentedFilter());
    metricsFilter.addMappingForUrlPatterns(disps, true, "/*");
    metricsFilter.setAsyncSupported(true);
    log.debug("Registering Metrics Servlet");
    ServletRegistration.Dynamic metricsAdminServlet = servletContext.addServlet("metricsServlet", new MetricsServlet());
    metricsAdminServlet.addMapping("/management/metrics/*");
    metricsAdminServlet.setAsyncSupported(true);
    metricsAdminServlet.setLoadOnStartup(2);
}
Also used : ServletRegistration(javax.servlet.ServletRegistration) MetricsServlet(com.codahale.metrics.servlets.MetricsServlet) FilterRegistration(javax.servlet.FilterRegistration) InstrumentedFilter(com.codahale.metrics.servlet.InstrumentedFilter)

Example 19 with InstrumentedFilter

use of com.codahale.metrics.servlet.InstrumentedFilter in project dubion by valsamiq.

the class WebConfigurer method initMetrics.

/**
 * Initializes Metrics.
 */
private void initMetrics(ServletContext servletContext, EnumSet<DispatcherType> disps) {
    log.debug("Initializing Metrics registries");
    servletContext.setAttribute(InstrumentedFilter.REGISTRY_ATTRIBUTE, metricRegistry);
    servletContext.setAttribute(MetricsServlet.METRICS_REGISTRY, metricRegistry);
    log.debug("Registering Metrics Filter");
    FilterRegistration.Dynamic metricsFilter = servletContext.addFilter("webappMetricsFilter", new InstrumentedFilter());
    metricsFilter.addMappingForUrlPatterns(disps, true, "/*");
    metricsFilter.setAsyncSupported(true);
    log.debug("Registering Metrics Servlet");
    ServletRegistration.Dynamic metricsAdminServlet = servletContext.addServlet("metricsServlet", new MetricsServlet());
    metricsAdminServlet.addMapping("/management/metrics/*");
    metricsAdminServlet.setAsyncSupported(true);
    metricsAdminServlet.setLoadOnStartup(2);
}
Also used : MetricsServlet(com.codahale.metrics.servlets.MetricsServlet) InstrumentedFilter(com.codahale.metrics.servlet.InstrumentedFilter)

Example 20 with InstrumentedFilter

use of com.codahale.metrics.servlet.InstrumentedFilter in project ArTEMiS by ls1intum.

the class WebConfigurer method initMetrics.

/**
 * Initializes Metrics.
 */
private void initMetrics(ServletContext servletContext, EnumSet<DispatcherType> disps) {
    log.debug("Initializing Metrics registries");
    servletContext.setAttribute(InstrumentedFilter.REGISTRY_ATTRIBUTE, metricRegistry);
    servletContext.setAttribute(MetricsServlet.METRICS_REGISTRY, metricRegistry);
    log.debug("Registering Metrics Filter");
    FilterRegistration.Dynamic metricsFilter = servletContext.addFilter("webappMetricsFilter", new InstrumentedFilter());
    metricsFilter.addMappingForUrlPatterns(disps, true, "/*");
    metricsFilter.setAsyncSupported(true);
    log.debug("Registering Metrics Servlet");
    ServletRegistration.Dynamic metricsAdminServlet = servletContext.addServlet("metricsServlet", new MetricsServlet());
    metricsAdminServlet.addMapping("/management/metrics/*");
    metricsAdminServlet.setAsyncSupported(true);
    metricsAdminServlet.setLoadOnStartup(2);
}
Also used : MetricsServlet(com.codahale.metrics.servlets.MetricsServlet) InstrumentedFilter(com.codahale.metrics.servlet.InstrumentedFilter)

Aggregations

InstrumentedFilter (com.codahale.metrics.servlet.InstrumentedFilter)20 MetricsServlet (com.codahale.metrics.servlets.MetricsServlet)20 FilterRegistration (javax.servlet.FilterRegistration)2 ServletRegistration (javax.servlet.ServletRegistration)2