@Test void testJson() { dataSetTimerClock.addNanos(1, TimeUnit.SECONDS); dataSetTimerClock.setMillis(System.currentTimeMillis()); JsonObjectBuilder builder = Json.createObjectBuilder(); dataSetTimer.jsonData(builder, dataSetTimerID); JsonObject json = builder.build(); JsonObject metricData = json.getJsonObject("response_time"); assertThat(metricData, notNullValue()); assertThat("count", metricData.getJsonNumber("count").longValue(), is(withinTolerance(200L))); assertThat("min", metricData.getJsonNumber("min").longValue(), is(withinTolerance(0L))); assertThat("max", metricData.getJsonNumber("max").longValue(), is(withinTolerance(990L))); assertThat("mean", metricData.getJsonNumber("mean").doubleValue(), is(withinTolerance(506.349))); assertThat("stddev", metricData.getJsonNumber("stddev").doubleValue(), is(withinTolerance(294.389))); assertThat(metricData.getJsonNumber("p50").intValue(), is(withinTolerance(480))); assertThat(metricData.getJsonNumber("p75").intValue(), is(withinTolerance(750))); assertThat(metricData.getJsonNumber("p95").intValue(), is(withinTolerance(960))); assertThat(metricData.getJsonNumber("p98").intValue(), is(withinTolerance(980))); assertThat(metricData.getJsonNumber("p99").intValue(), is(withinTolerance(980))); assertThat(metricData.getJsonNumber("p999").intValue(), is(withinTolerance(990))); assertThat(metricData.getJsonNumber("meanRate").intValue(), is(withinTolerance(200))); assertThat(metricData.getJsonNumber("oneMinRate").intValue(), is(0)); assertThat(metricData.getJsonNumber("fiveMinRate").intValue(), is(0)); assertThat(metricData.getJsonNumber("fifteenMinRate").intValue(), is(0)); }
@Override public void jsonData(JsonObjectBuilder builder, MetricID metricID) { JsonObjectBuilder myBuilder = JSON.createObjectBuilder() .add(jsonFullKey("count", metricID), getCount()) .add(jsonFullKey("meanRate", metricID), getMeanRate()) .add(jsonFullKey("oneMinRate", metricID), getOneMinuteRate()) .add(jsonFullKey("fiveMinRate", metricID), getFiveMinuteRate()) .add(jsonFullKey("fifteenMinRate", metricID), getFifteenMinuteRate()); Snapshot snapshot = getSnapshot(); myBuilder = myBuilder.add(jsonFullKey("min", metricID), snapshot.getMin()) .add(jsonFullKey("max", metricID), snapshot.getMax()) .add(jsonFullKey("mean", metricID), snapshot.getMean()) .add(jsonFullKey("stddev", metricID), snapshot.getStdDev()) .add(jsonFullKey("p50", metricID), snapshot.getMedian()) .add(jsonFullKey("p75", metricID), snapshot.get75thPercentile()) .add(jsonFullKey("p95", metricID), snapshot.get95thPercentile()) .add(jsonFullKey("p98", metricID), snapshot.get98thPercentile()) .add(jsonFullKey("p99", metricID), snapshot.get99thPercentile()) .add(jsonFullKey("p999", metricID), snapshot.get999thPercentile()); builder.add(metricID.getName(), myBuilder); }
HelidonTimer extends MetricImpl implements Timer { @Override public void jsonData(JsonObjectBuilder builder, MetricID metricID) { JsonObjectBuilder myBuilder = JSON.createObjectBuilder() .add(jsonFullKey("count", metricID), getCount()) .add(jsonFullKey("meanRate", metricID), getMeanRate()) .add(jsonFullKey("oneMinRate", metricID), getOneMinuteRate()) .add(jsonFullKey("fiveMinRate", metricID), getFiveMinuteRate()) .add(jsonFullKey("fifteenMinRate", metricID), getFifteenMinuteRate()); Snapshot snapshot = getSnapshot(); myBuilder = myBuilder.add(jsonFullKey("min", metricID), snapshot.getMin()) .add(jsonFullKey("max", metricID), snapshot.getMax()) .add(jsonFullKey("mean", metricID), snapshot.getMean()) .add(jsonFullKey("stddev", metricID), snapshot.getStdDev()) .add(jsonFullKey("p50", metricID), snapshot.getMedian()) .add(jsonFullKey("p75", metricID), snapshot.get75thPercentile()) .add(jsonFullKey("p95", metricID), snapshot.get95thPercentile()) .add(jsonFullKey("p98", metricID), snapshot.get98thPercentile()) .add(jsonFullKey("p99", metricID), snapshot.get99thPercentile()) .add(jsonFullKey("p999", metricID), snapshot.get999thPercentile()); builder.add(metricID.getName(), myBuilder); } }
HelidonTimer extends MetricImpl implements Timer { @Override public void jsonData(JsonObjectBuilder builder, MetricID metricID) { JsonObjectBuilder myBuilder = JSON.createObjectBuilder() .add(jsonFullKey("count", metricID), getCount()) .add(jsonFullKey("meanRate", metricID), getMeanRate()) .add(jsonFullKey("oneMinRate", metricID), getOneMinuteRate()) .add(jsonFullKey("fiveMinRate", metricID), getFiveMinuteRate()) .add(jsonFullKey("fifteenMinRate", metricID), getFifteenMinuteRate()); Snapshot snapshot = getSnapshot(); myBuilder = myBuilder.add(jsonFullKey("min", metricID), snapshot.getMin()) .add(jsonFullKey("max", metricID), snapshot.getMax()) .add(jsonFullKey("mean", metricID), snapshot.getMean()) .add(jsonFullKey("stddev", metricID), snapshot.getStdDev()) .add(jsonFullKey("p50", metricID), snapshot.getMedian()) .add(jsonFullKey("p75", metricID), snapshot.get75thPercentile()) .add(jsonFullKey("p95", metricID), snapshot.get95thPercentile()) .add(jsonFullKey("p98", metricID), snapshot.get98thPercentile()) .add(jsonFullKey("p99", metricID), snapshot.get99thPercentile()) .add(jsonFullKey("p999", metricID), snapshot.get999thPercentile()); builder.add(metricID.getName(), myBuilder); } private  HelidonTimer(String type, Metadata metadata, Timer delegate); }
HelidonTimer extends MetricImpl implements Timer { @Override public void jsonData(JsonObjectBuilder builder, MetricID metricID) { JsonObjectBuilder myBuilder = JSON.createObjectBuilder() .add(jsonFullKey("count", metricID), getCount()) .add(jsonFullKey("meanRate", metricID), getMeanRate()) .add(jsonFullKey("oneMinRate", metricID), getOneMinuteRate()) .add(jsonFullKey("fiveMinRate", metricID), getFiveMinuteRate()) .add(jsonFullKey("fifteenMinRate", metricID), getFifteenMinuteRate()); Snapshot snapshot = getSnapshot(); myBuilder = myBuilder.add(jsonFullKey("min", metricID), snapshot.getMin()) .add(jsonFullKey("max", metricID), snapshot.getMax()) .add(jsonFullKey("mean", metricID), snapshot.getMean()) .add(jsonFullKey("stddev", metricID), snapshot.getStdDev()) .add(jsonFullKey("p50", metricID), snapshot.getMedian()) .add(jsonFullKey("p75", metricID), snapshot.get75thPercentile()) .add(jsonFullKey("p95", metricID), snapshot.get95thPercentile()) .add(jsonFullKey("p98", metricID), snapshot.get98thPercentile()) .add(jsonFullKey("p99", metricID), snapshot.get99thPercentile()) .add(jsonFullKey("p999", metricID), snapshot.get999thPercentile()); builder.add(metricID.getName(), myBuilder); } private  HelidonTimer(String type, Metadata metadata, Timer delegate); @Override void update(long duration, TimeUnit unit); @Override T time(Callable<T> event); @Override void time(Runnable event); @Override Context time(); @Override long getCount(); @Override double getFifteenMinuteRate(); @Override double getFiveMinuteRate(); @Override double getMeanRate(); @Override double getOneMinuteRate(); @Override Snapshot getSnapshot(); @Override void prometheusData(StringBuilder sb, MetricID metricID, boolean withHelpType); @Override String prometheusValue(); @Override void jsonData(JsonObjectBuilder builder, MetricID metricID); @Override boolean equals(Object o); @Override int hashCode(); }
HelidonTimer extends MetricImpl implements Timer { @Override public void jsonData(JsonObjectBuilder builder, MetricID metricID) { JsonObjectBuilder myBuilder = JSON.createObjectBuilder() .add(jsonFullKey("count", metricID), getCount()) .add(jsonFullKey("meanRate", metricID), getMeanRate()) .add(jsonFullKey("oneMinRate", metricID), getOneMinuteRate()) .add(jsonFullKey("fiveMinRate", metricID), getFiveMinuteRate()) .add(jsonFullKey("fifteenMinRate", metricID), getFifteenMinuteRate()); Snapshot snapshot = getSnapshot(); myBuilder = myBuilder.add(jsonFullKey("min", metricID), snapshot.getMin()) .add(jsonFullKey("max", metricID), snapshot.getMax()) .add(jsonFullKey("mean", metricID), snapshot.getMean()) .add(jsonFullKey("stddev", metricID), snapshot.getStdDev()) .add(jsonFullKey("p50", metricID), snapshot.getMedian()) .add(jsonFullKey("p75", metricID), snapshot.get75thPercentile()) .add(jsonFullKey("p95", metricID), snapshot.get95thPercentile()) .add(jsonFullKey("p98", metricID), snapshot.get98thPercentile()) .add(jsonFullKey("p99", metricID), snapshot.get99thPercentile()) .add(jsonFullKey("p999", metricID), snapshot.get999thPercentile()); builder.add(metricID.getName(), myBuilder); } private  HelidonTimer(String type, Metadata metadata, Timer delegate); @Override void update(long duration, TimeUnit unit); @Override T time(Callable<T> event); @Override void time(Runnable event); @Override Context time(); @Override long getCount(); @Override double getFifteenMinuteRate(); @Override double getFiveMinuteRate(); @Override double getMeanRate(); @Override double getOneMinuteRate(); @Override Snapshot getSnapshot(); @Override void prometheusData(StringBuilder sb, MetricID metricID, boolean withHelpType); @Override String prometheusValue(); @Override void jsonData(JsonObjectBuilder builder, MetricID metricID); @Override boolean equals(Object o); @Override int hashCode();  }