@Override public Map<HttpClientMetrics, ?> requestBegin(Map<HttpClientMetrics, ?> endpointMetric, Map<HttpClientMetrics, ?> socketMetric, SocketAddress localAddress, SocketAddress remoteAddress, HttpClientRequest request) { return null; }
@Override public Map<HttpClientMetrics, ?> responsePushed(Map<HttpClientMetrics, ?> endpointMetric, Map<HttpClientMetrics, ?> socketMetric, SocketAddress localAddress, SocketAddress remoteAddress, HttpClientRequest request) { return unmap2WithResult(endpointMetric, socketMetric, (m, ec, sc) -> m.responsePushed(ec, sc, localAddress, remoteAddress, request)); }
@Override public Map<HttpClientMetrics, ?> connected(Map<HttpClientMetrics, ?> endpointMetric, Map<HttpClientMetrics, ?> socketMetric, WebSocket webSocket) { return unmap2WithResult(endpointMetric, socketMetric, (m, ec, sc) -> m.connected(ec, sc, webSocket)); }
@Override public HttpClientMetrics<HttpRequestMetrics, SocketAddress, SocketAddress, Void, Void> createMetrics(final HttpClient client, final HttpClientOptions options) { HttpClientMetricsImpl httpClientMetricsImpl = new HttpClientMetricsImpl(statfulMetricsOptions); httpClientMetricsImpl.setSender(this.getOrCreateSender()); this.poolMetricsCollectors.forEach(collector -> collector.setSender(this.getOrCreateSender())); return httpClientMetricsImpl; }
@Override public synchronized HttpClientMetrics<?, ?, ?, ?, ?> createMetrics(HttpClient client, HttpClientOptions options) { String name = options.getMetricsName(); String baseName; if (name != null && name.length() > 0) { baseName = nameOf("http.clients", name); } else { baseName = nameOf("http.clients"); } HttpClientReporter reporter = clientReporters.computeIfAbsent(baseName, n -> new HttpClientReporter(registry, baseName, null)); return new HttpClientMetricsImpl(this, reporter, options, this.options.getMonitoredHttpClientUris(), this.options.getMonitoredHttpClientEndpoint()); }
@Override default HttpClientMetrics<?, ?, ?, ?, ?> createMetrics(HttpClient client, HttpClientOptions options) { return DummyVertxMetrics.DummyHttpClientMetrics.INSTANCE; }
public DispatchingHttpClientMetrics(List<? extends HttpClientMetrics> delegates) { super(delegates); }
@Override public Map<HttpClientMetrics, ?> createEndpoint(String host, int port, int maxPoolSize) { return dispatchWithResult(m -> m.createEndpoint(host, port, maxPoolSize)); }
@Override public void closeEndpoint(String host, int port, Map<HttpClientMetrics, ?> endpointMetric) { unmap(endpointMetric, (m, c) -> m.closeEndpoint(host, port, c)); }
@Override public Map<HttpClientMetrics, ?> enqueueRequest(Map<HttpClientMetrics, ?> endpointMetric) { return unmapWithResult(endpointMetric, (m, c) -> m.enqueueRequest(c)); }
@Override public void dequeueRequest(Map<HttpClientMetrics, ?> endpointMetric, Map<HttpClientMetrics, ?> taskMetric) { unmap2(endpointMetric, taskMetric, (m, ec, tc) -> m.endpointDisconnected(ec, tc)); }
@Override public void endpointConnected(Map<HttpClientMetrics, ?> endpointMetric, Map<HttpClientMetrics, ?> socketMetric) { unmap2(endpointMetric, socketMetric, (m, ec, sc) -> m.endpointConnected(ec, sc)); }
@Override public void endpointDisconnected(Map<HttpClientMetrics, ?> endpointMetric, Map<HttpClientMetrics, ?> socketMetric) { unmap2(endpointMetric, socketMetric, (m, ec, sc) -> m.endpointDisconnected(ec, sc)); }
@Override public void requestEnd(Map<HttpClientMetrics, ?> requestMetric) { unmap(requestMetric, (m, c) -> m.requestEnd(c)); }
@Override public void responseBegin(Map<HttpClientMetrics, ?> requestMetric, HttpClientResponse response) { unmap(requestMetric, (m, c) -> m.responseBegin(c, response)); }
@Override public void requestReset(Map<HttpClientMetrics, ?> requestMetric) { unmap(requestMetric, (m, c) -> m.requestReset(c)); }
@Override public void responseEnd(Map<HttpClientMetrics, ?> requestMetric, HttpClientResponse response) { unmap(requestMetric, (m, c) -> m.responseEnd(c, response)); }
@Override public void disconnected(Map<HttpClientMetrics, ?> webSocketMetric) { unmap(webSocketMetric, (m, c) -> m.disconnected(c)); }
@Override public HttpClientMetrics<?, ?, ?, ?, ?> createMetrics(HttpClient client, HttpClientOptions options) { return this.<HttpClientMetrics<?, ?, ?, ?, ?>> createSubMetrics(v -> v.createMetrics(client, options), d -> new DispatchingHttpClientMetrics(d)); }
@Override public HttpClientMetrics<?, ?, ?, ?, ?> createMetrics(HttpClient client, HttpClientOptions options) { return new HttpClientMetricsImpl(counterService, gaugeService, properties.getHttp().getClient()); }
@Test public void testHttpClientMetricCreation() { VertxMetricsImpl victim = new VertxMetricsImpl(vertx, statfulMetricsOptions); HttpClientMetrics createdMetrics = victim.createMetrics(mock(HttpClient.class), mock(HttpClientOptions.class)); assertNotNull(createdMetrics); }
@Override public HttpClientMetrics createMetrics(HttpClient client, HttpClientOptions options) { HttpClientMetricsSupplier supplier = (HttpClientMetricsSupplier) metricSuppliers.get(HTTP_CLIENT); return supplier != null ? new HttpClientMetricsImpl(supplier) : super.createMetrics(client, options); }