public ClientResponseWriter(RequestCompleteHandler requestCompleteHandler, Registry registry) { this.requestCompleteHandler = requestCompleteHandler; this.responseBeforeReceivedLastContentCounter = registry.counter("server.http.requests.responseBeforeReceivedLastContent"); }
public PassportLoggingHandler(Registry spectatorRegistry) { incompleteProxySessionCounter = spectatorRegistry.counter("server.http.session.incomplete"); }
protected static void incrementExceptionCounter(Throwable throwable, String handler) { registry.counter("server.connection.exception", "handler", handler, "id", throwable.getClass().getSimpleName()) .increment(); }
protected static void incrementExceptionCounter(Throwable throwable) { registry.counter("server.connection.exception", "handler", "Http2ConnectionCloseHandler", "id", throwable.getClass().getSimpleName()) .increment(); }
public ClientResponseWriter(RequestCompleteHandler requestCompleteHandler, Registry registry) { this.requestCompleteHandler = requestCompleteHandler; this.responseBeforeReceivedLastContentCounter = registry.counter("server.http.requests.responseBeforeReceivedLastContent"); }
public PassportLoggingHandler(Registry spectatorRegistry) { incompleteProxySessionCounter = spectatorRegistry.counter("server.http.session.incomplete"); }
private static Counter getCounter(String name, String...additionalTags) { String key = className + "." + name + "." + Joiner.on(",").join(additionalTags); return errors.computeIfAbsent(key, k -> { List<Tag> tags = getTags(additionalTags); return registry.counter(name, tags); }); }
private static Counter getCounter(String className, String name, String... additionalTags) { Map<String, String> tags = toMap(className, additionalTags); return counters.computeIfAbsent(name, s -> new ConcurrentHashMap<>()).computeIfAbsent(tags, t -> { Id id = registry.createId(name, tags); return registry.counter(id); }); }
public HttpMetricsChannelHandler(Registry registry, String name, String id) { super(); this.registry = registry; this.currentRequestsGauge = this.registry.gauge(this.registry.createId(name + ".http.requests.current", "id", id)); this.unSupportedPipeliningCounter = this.registry.counter(name + ".http.requests.pipelining.dropped", "id", id); }
protected static void incrementErrorCounter(Registry registry, String counterName, String metricId, Http2Exception h2e) { String h2Error = h2e.error() != null ? h2e.error().name() : "NA"; String exceptionName = h2e.getClass().getSimpleName(); registry.counter(counterName, "id", metricId, "error", h2Error, "exception", exceptionName) .increment(); }
protected static void incrementExceptionCounter(Throwable throwable) { registry.counter("server.connection.exception", "handler", "Http2ConnectionCloseHandler", "id", throwable.getClass().getSimpleName()) .increment(); }
protected static void incrementExceptionCounter(Throwable throwable, String handler) { registry.counter("server.connection.exception", "handler", handler, "id", throwable.getClass().getSimpleName()) .increment(); }
protected static void incrementCounter(Registry registry, String counterName, String metricId, Http2Frame frame) { long errorCode; if (frame instanceof Http2ResetFrame) { errorCode = ((Http2ResetFrame) frame).errorCode(); } else if (frame instanceof Http2GoAwayFrame) { errorCode = ((Http2GoAwayFrame) frame).errorCode(); } else { errorCode = -1; } registry.counter(counterName, "id", metricId, "frame", frame.name(), "error_code", Long.toString(errorCode)) .increment(); }
public HttpMetricsChannelHandler(Registry registry, String name, String id) { super(); this.registry = registry; this.currentRequestsGauge = this.registry.gauge(this.registry.createId(name + ".http.requests.current", "id", id)); this.unSupportedPipeliningCounter = this.registry.counter(name + ".http.requests.pipelining.dropped", "id", id); }
protected static void incrementErrorCounter(Registry registry, String counterName, String metricId, Http2Exception h2e) { String h2Error = h2e.error() != null ? h2e.error().name() : "NA"; String exceptionName = h2e.getClass().getSimpleName(); registry.counter(counterName, "id", metricId, "error", h2Error, "exception", exceptionName) .increment(); }
@Test public void testBasicCounterIncrementAmount() { BasicCounter c = new BasicCounter(CONFIG); register(c); c.increment(42); assertEquals(42, registry.counter(ID).count()); }
protected static void incrementCounter(Registry registry, String counterName, String metricId, Http2Frame frame) { long errorCode; if (frame instanceof Http2ResetFrame) { errorCode = ((Http2ResetFrame) frame).errorCode(); } else if (frame instanceof Http2GoAwayFrame) { errorCode = ((Http2GoAwayFrame) frame).errorCode(); } else { errorCode = -1; } registry.counter(counterName, "id", metricId, "frame", frame.name(), "error_code", Long.toString(errorCode)) .increment(); }
@Test public void testContextualTimerRecordMillis() { TagList context = BasicTagList.of("a", "1"); ContextualTimer d = new ContextualTimer(CONFIG, () -> context, BasicTimer::new); d.record(42, TimeUnit.NANOSECONDS); Id id = ID.withTag("unit", "MILLISECONDS").withTag("a", "1"); assertEquals(1, registry.counter(id.withTag(Statistic.count)).count()); assertEquals(42e-6, registry.counter(id.withTag(Statistic.totalTime)).actualCount(), 1e-12); assertEquals(42e-6 * 42e-6, registry.counter(id.withTag(Statistic.totalOfSquares)).actualCount(), 1e-12); assertEquals(42e-6, registry.maxGauge(id.withTag(Statistic.max)).value(), 1e-12); }
@Test public void testBasicDistributionSummaryRecord() { BasicDistributionSummary d = new BasicDistributionSummary(CONFIG); register(d); d.record(42); assertEquals(1, registry.counter(ID.withTag(Statistic.count)).count()); assertEquals(42, registry.counter(ID.withTag(Statistic.totalAmount)).count()); assertEquals(42.0, registry.maxGauge(ID.withTag(Statistic.max)).value(), 1e-12); }
@Test public void testAnnotatedCounter() { AnnotateExample ex = new AnnotateExample("foo"); PolledMeter.update(registry); Id id = registry.createId("counter") .withTag("class", "AnnotateExample") .withTag("level", "INFO") .withTag("id", "foo"); assertEquals(1, registry.counter(id).count()); }