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


Java MetricsHandler类代码示例

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


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

示例1: to

import io.undertow.server.handlers.MetricsHandler; //导入依赖的package包/类
public static RequestMXBean to(MetricsHandler handler) {
	return new RequestMXBean() {

		@Override
		public void reset() {
			handler.reset();
		}

		@Override
		public RequestMetrics getMetrics() {
			MetricResult result = handler.getMetrics();
			return new RequestMetrics(result.getMetricsStartDate(),
					result.getTotalRequestTime(),
					result.getMaxRequestTime(), result.getMinRequestTime(),
					result.getTotalRequests());
		}
	};
}
 
开发者ID:taichi,项目名称:siden,代码行数:19,代码来源:RequestMetrics.java

示例2: handleRequest

import io.undertow.server.handlers.MetricsHandler; //导入依赖的package包/类
@Override
public void handleRequest(final HttpServerExchange exchange) throws Exception {
    ServletRequestContext context = exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY);
    ServletInfo servletInfo = context.getCurrentServlet().getManagedServlet().getServletInfo();
    MetricsHandler handler = servletHandlers.get(servletInfo.getName());
    if(handler != null) {
        handler.handleRequest(exchange);
    } else {
        next.handleRequest(exchange);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:12,代码来源:MetricsChainHandler.java

示例3: MetricsChainHandler

import io.undertow.server.handlers.MetricsHandler; //导入依赖的package包/类
public MetricsChainHandler(HttpHandler next, MetricsCollector collector, Deployment deployment) {
    this.next = next;
    final Map<String, MetricsHandler> servletHandlers = new HashMap<>();
    for(Map.Entry<String, ServletHandler> entry : deployment.getServlets().getServletHandlers().entrySet()) {
        MetricsHandler handler = new MetricsHandler(next);
        servletHandlers.put(entry.getKey(), handler);
        collector.registerMetric(entry.getKey(), handler);
    }
    this.servletHandlers = Collections.unmodifiableMap(servletHandlers);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:11,代码来源:MetricsChainHandler.java

示例4: makeSharedHandlers

import io.undertow.server.handlers.MetricsHandler; //导入依赖的package包/类
@Override
protected HttpHandler makeSharedHandlers(App root, OptionMap config,
		HttpHandler next) {
	HttpHandler shared = super.makeSharedHandlers(root, config, next);
	register(root, RequestMetrics.to(new MetricsHandler(shared)),
			Arrays.asList("type", "Request", "name", "Global"));
	return shared;
}
 
开发者ID:taichi,项目名称:siden,代码行数:9,代码来源:MetricsAppBuilder.java

示例5: MonitoringHandler

import io.undertow.server.handlers.MetricsHandler; //导入依赖的package包/类
public MonitoringHandler(HttpHandler nextHandler) {
    MetricsHandler mh = new MetricsHandler(nextHandler);
    this.pathHandler = path(mh).addPath("/stats", exchange -> {
        HightideExchange ex = HightideExchangeFactory.get(exchange);
        HightideResponse resp = new HightideResponse();
        resp.setReturnedObj(mh.getMetrics());
        ex.setResponse(resp);
        respond().handleRequest(exchange);
    });
}
 
开发者ID:gzlabs,项目名称:hightide,代码行数:11,代码来源:MonitoringHandler.java

示例6: registerMetric

import io.undertow.server.handlers.MetricsHandler; //导入依赖的package包/类
void registerMetric(String servletName, MetricsHandler handler); 
开发者ID:lamsfoundation,项目名称:lams,代码行数:2,代码来源:MetricsCollector.java


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