@Test public void testRpcNameIncludes() throws Exception { RpcEvent foo = new RpcEvent(new RpcRequest("vrpcb: RpcEvent bar = new RpcEvent(new RpcRequest("vrpcb: l.onRpc(foo); l.onRpc(bar); assertThat(metrics.getTimers().containsKey(DEFAULT_METRICS_BASE_NAME + ".example.org:9600/mock/foo?timeout=30"), is(true)); assertThat(metrics.getTimers().containsKey(DEFAULT_METRICS_BASE_NAME + ".example.org:9600/mock/bar?timeout=30"), is(false)); }
@Override public void onRpc(RpcEvent rpcEvent) { if (!matches(rpcEvent)) return; UriComponents uriComponents = rpcEvent.getRequest().getUriComponents(); String name = MetricRegistry.name(metricsName, rpcEvent.getHost().toHostString() + uriComponents.getPath() + "?" + uriComponents.getQuery()); Timer timer = metricRegistry.timer(name); RpcResponse response = rpcEvent.getResponse(); if (response != null) { timer.update(response.getElapsedMillis(), TimeUnit.MILLISECONDS); } }
VistaRpcElapsedTimeMetricListener implements RpcListener { @Override public void onRpc(RpcEvent rpcEvent) { if (!matches(rpcEvent)) return; UriComponents uriComponents = rpcEvent.getRequest().getUriComponents(); String name = MetricRegistry.name(metricsName, rpcEvent.getHost().toHostString() + uriComponents.getPath() + "?" + uriComponents.getQuery()); Timer timer = metricRegistry.timer(name); RpcResponse response = rpcEvent.getResponse(); if (response != null) { timer.update(response.getElapsedMillis(), TimeUnit.MILLISECONDS); } } }
VistaRpcElapsedTimeMetricListener implements RpcListener { @Override public void onRpc(RpcEvent rpcEvent) { if (!matches(rpcEvent)) return; UriComponents uriComponents = rpcEvent.getRequest().getUriComponents(); String name = MetricRegistry.name(metricsName, rpcEvent.getHost().toHostString() + uriComponents.getPath() + "?" + uriComponents.getQuery()); Timer timer = metricRegistry.timer(name); RpcResponse response = rpcEvent.getResponse(); if (response != null) { timer.update(response.getElapsedMillis(), TimeUnit.MILLISECONDS); } } VistaRpcElapsedTimeMetricListener(MetricRegistry metricRegistry);  VistaRpcElapsedTimeMetricListener(MetricRegistry metricRegistry, String... rpcNameIncludes);  VistaRpcElapsedTimeMetricListener(MetricRegistry metricRegistry, List<Pattern> rpcUriPatternIncludes); }
VistaRpcElapsedTimeMetricListener implements RpcListener { @Override public void onRpc(RpcEvent rpcEvent) { if (!matches(rpcEvent)) return; UriComponents uriComponents = rpcEvent.getRequest().getUriComponents(); String name = MetricRegistry.name(metricsName, rpcEvent.getHost().toHostString() + uriComponents.getPath() + "?" + uriComponents.getQuery()); Timer timer = metricRegistry.timer(name); RpcResponse response = rpcEvent.getResponse(); if (response != null) { timer.update(response.getElapsedMillis(), TimeUnit.MILLISECONDS); } } VistaRpcElapsedTimeMetricListener(MetricRegistry metricRegistry);  VistaRpcElapsedTimeMetricListener(MetricRegistry metricRegistry, String... rpcNameIncludes);  VistaRpcElapsedTimeMetricListener(MetricRegistry metricRegistry, List<Pattern> rpcUriPatternIncludes); @Override void onRpc(RpcEvent rpcEvent); }
VistaRpcElapsedTimeMetricListener implements RpcListener { @Override public void onRpc(RpcEvent rpcEvent) { if (!matches(rpcEvent)) return; UriComponents uriComponents = rpcEvent.getRequest().getUriComponents(); String name = MetricRegistry.name(metricsName, rpcEvent.getHost().toHostString() + uriComponents.getPath() + "?" + uriComponents.getQuery()); Timer timer = metricRegistry.timer(name); RpcResponse response = rpcEvent.getResponse(); if (response != null) { timer.update(response.getElapsedMillis(), TimeUnit.MILLISECONDS); } } VistaRpcElapsedTimeMetricListener(MetricRegistry metricRegistry);  VistaRpcElapsedTimeMetricListener(MetricRegistry metricRegistry, String... rpcNameIncludes);  VistaRpcElapsedTimeMetricListener(MetricRegistry metricRegistry, List<Pattern> rpcUriPatternIncludes); @Override void onRpc(RpcEvent rpcEvent); static final String DEFAULT_METRICS_BASE_NAME; }