@Override public double getInstantThroughput() { return metric.getValue(); } }
protected ThroughputTimer throughputTimer(String... names) { try { return RegistryHelper.throughputTimer(registry, nameOf(names)); } catch (Exception e) { return new ThroughputTimer(); } }
requests.update(duration, TimeUnit.NANOSECONDS); methodRequests.get(metric.method).update(duration, TimeUnit.NANOSECONDS); if (match != null) { throughputTimer(metric.method.toString().toLowerCase() + "-requests", match).update(duration, TimeUnit.NANOSECONDS); throughputTimer("requests", match).update(duration, TimeUnit.NANOSECONDS);
private static JsonObject toJson(Timer timer, TimeUnit rateUnit, TimeUnit durationUnit) { Snapshot snapshot = timer.getSnapshot(); JsonObject json = new JsonObject(); json.put("type", "timer"); if (timer instanceof ThroughputTimer) { ThroughputTimer throughput = (ThroughputTimer) timer; json.put("oneSecondRate", throughput.getValue()); } // Meter populateMetered(json, timer, rateUnit); // Snapshot double factor = 1.0 / durationUnit.toNanos(1); populateSnapshot(json, snapshot, factor); // Duration rate String duration = durationUnit.toString().toLowerCase(); json.put("durationRate", duration); return json; }