当前位置: 首页>>代码示例>>Java>>正文


Java MetricsServlet类代码示例

本文整理汇总了Java中com.codahale.metrics.servlets.MetricsServlet的典型用法代码示例。如果您正苦于以下问题:Java MetricsServlet类的具体用法?Java MetricsServlet怎么用?Java MetricsServlet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MetricsServlet类属于com.codahale.metrics.servlets包,在下文中一共展示了MetricsServlet类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getMetricsHandler

import com.codahale.metrics.servlets.MetricsServlet; //导入依赖的package包/类
private ServletContextHandler getMetricsHandler() {
    MetricRegistry registry = Metrics.getRegistry();
    HealthCheckRegistry healthCheckRegistry = Metrics.getHealthCheckRegistry();
    healthCheckRegistry.register("rotation", new Rotation(configuration.getRotationStatusFilePath()));

    registry.registerAll(new GarbageCollectorMetricSet());
    registry.registerAll(new MemoryUsageGaugeSet());
    registry.registerAll(new ThreadStatesGaugeSet());
    registry.registerAll(new JvmAttributeGaugeSet());

    ServletContextHandler servletContextHandler = new ServletContextHandler();
    servletContextHandler.setContextPath("/__metrics");
    servletContextHandler.setAttribute(MetricsServlet.class.getCanonicalName() + ".registry", registry);
    servletContextHandler.setAttribute(HealthCheckServlet.class.getCanonicalName() + ".registry", healthCheckRegistry);
    servletContextHandler.addServlet(new ServletHolder(new AdminServlet()), "/*");

    return servletContextHandler;
}
 
开发者ID:flipkart-incubator,项目名称:Poseidon,代码行数:19,代码来源:Poseidon.java

示例2: initMetrics

import com.codahale.metrics.servlets.MetricsServlet; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:xm-online,项目名称:xm-ms-entity,代码行数:26,代码来源:WebConfigurer.java

示例3: initMetrics

import com.codahale.metrics.servlets.MetricsServlet; //导入依赖的package包/类
/**
 * 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("/metrics/metrics/*");
    metricsAdminServlet.setAsyncSupported(true);
    metricsAdminServlet.setLoadOnStartup(2);
}
 
开发者ID:GastonMauroDiaz,项目名称:buenojo,代码行数:26,代码来源:WebConfigurer.java

示例4: initMetrics

import com.codahale.metrics.servlets.MetricsServlet; //导入依赖的package包/类
/**
 * 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/jhipster/metrics/*");
    metricsAdminServlet.setAsyncSupported(true);
    metricsAdminServlet.setLoadOnStartup(2);
}
 
开发者ID:mraible,项目名称:devoxxus-jhipster-microservices-demo,代码行数:26,代码来源:WebConfigurer.java

示例5: initMetrics

import com.codahale.metrics.servlets.MetricsServlet; //导入依赖的package包/类
/**
 * 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("/metrics/metrics/*");
    metricsAdminServlet.setAsyncSupported(true);
    metricsAdminServlet.setLoadOnStartup(2);
}
 
开发者ID:VHAINNOVATIONS,项目名称:BCDS,代码行数:26,代码来源:WebConfigurer.java


注:本文中的com.codahale.metrics.servlets.MetricsServlet类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。