@Test void testJson() { JsonObjectBuilder builder = Json.createObjectBuilder(); histoInt.jsonData(builder, new MetricID("file_sizes")); JsonObject result = builder.build(); JsonObject metricData = result.getJsonObject("file_sizes"); assertThat(metricData, notNullValue()); assertThat(metricData.getJsonNumber("count").longValue(), is(200L)); assertThat(metricData.getJsonNumber("min").longValue(), is(0L)); assertThat(metricData.getJsonNumber("max").longValue(), is(99L)); assertThat("mean", metricData.getJsonNumber("mean").doubleValue(), is(withinTolerance(50.6349))); assertThat("stddev", metricData.getJsonNumber("stddev").doubleValue(), is(withinTolerance(29.4389))); assertThat("p50", metricData.getJsonNumber("p50").intValue(), is(withinTolerance(48))); assertThat("p75", metricData.getJsonNumber("p75").intValue(), is(withinTolerance(75))); assertThat("p95", metricData.getJsonNumber("p95").intValue(), is(withinTolerance(96))); assertThat("p98", metricData.getJsonNumber("p98").intValue(), is(withinTolerance(98))); assertThat("p99", metricData.getJsonNumber("p99").intValue(), is(withinTolerance(98))); assertThat("p999", metricData.getJsonNumber("p999").intValue(), is(withinTolerance(99))); }
@Override public void jsonData(JsonObjectBuilder builder, MetricID metricID) { JsonObjectBuilder myBuilder = JSON.createObjectBuilder() .add(jsonFullKey("count", metricID), getCount()); 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); }
HelidonHistogram extends MetricImpl implements Histogram { @Override public void jsonData(JsonObjectBuilder builder, MetricID metricID) { JsonObjectBuilder myBuilder = JSON.createObjectBuilder() .add(jsonFullKey("count", metricID), getCount()); 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); } }
HelidonHistogram extends MetricImpl implements Histogram { @Override public void jsonData(JsonObjectBuilder builder, MetricID metricID) { JsonObjectBuilder myBuilder = JSON.createObjectBuilder() .add(jsonFullKey("count", metricID), getCount()); 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  HelidonHistogram(String type, Metadata metadata, Histogram delegate); }
HelidonHistogram extends MetricImpl implements Histogram { @Override public void jsonData(JsonObjectBuilder builder, MetricID metricID) { JsonObjectBuilder myBuilder = JSON.createObjectBuilder() .add(jsonFullKey("count", metricID), getCount()); 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  HelidonHistogram(String type, Metadata metadata, Histogram delegate); @Override void update(int value); @Override void update(long value); @Override long getCount(); @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(); }
HelidonHistogram extends MetricImpl implements Histogram { @Override public void jsonData(JsonObjectBuilder builder, MetricID metricID) { JsonObjectBuilder myBuilder = JSON.createObjectBuilder() .add(jsonFullKey("count", metricID), getCount()); 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  HelidonHistogram(String type, Metadata metadata, Histogram delegate); @Override void update(int value); @Override void update(long value); @Override long getCount(); @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();  }