use of io.opencensus.stats.AggregationData.SumDataDouble in project instrumentation-java by census-instrumentation.
the class StatszZPageHandler method emitViewDataRow.
private static void emitViewDataRow(View view, Entry<List</*@Nullable*/
TagValue>, AggregationData> entry, PrintWriter out, Formatter formatter) {
out.write("<tr>");
for (/*@Nullable*/
TagValue tagValue : entry.getKey()) {
String tagValueStr = tagValue == null ? "" : tagValue.asString();
formatter.format("<td class=\"borderRL\">%s</td>", tagValueStr);
}
entry.getValue().match(new Function<SumDataDouble, Void>() {
@Override
public Void apply(SumDataDouble arg) {
formatter.format("<td class=\"borderLL\">%.3f</td>", arg.getSum());
return null;
}
}, new Function<SumDataLong, Void>() {
@Override
public Void apply(SumDataLong arg) {
formatter.format("<td class=\"borderLL\">%d</td>", arg.getSum());
return null;
}
}, new Function<CountData, Void>() {
@Override
public Void apply(CountData arg) {
formatter.format("<td class=\"borderLL\">%d</td>", arg.getCount());
return null;
}
}, new Function<DistributionData, Void>() {
@Override
public Void apply(DistributionData arg) {
checkArgument(view.getAggregation() instanceof Distribution, "Distribution expected.");
formatter.format("<td>%.3f</td>", arg.getMean());
formatter.format("<td class=\"borderLL\">%d</td>", arg.getCount());
formatter.format("<td class=\"borderLL\">%.3f</td>", arg.getMax());
formatter.format("<td class=\"borderLL\">%.3f</td>", arg.getMin());
formatter.format("<td class=\"borderLL\">%.3f</td>", arg.getSumOfSquaredDeviations());
emitHistogramBuckets(((Distribution) view.getAggregation()).getBucketBoundaries().getBoundaries(), arg.getBucketCounts(), out, formatter);
return null;
}
}, new Function<LastValueDataDouble, Void>() {
@Override
public Void apply(LastValueDataDouble arg) {
formatter.format("<td>%.3f</td>", arg.getLastValue());
return null;
}
}, new Function<LastValueDataLong, Void>() {
@Override
public Void apply(LastValueDataLong arg) {
formatter.format("<td>%d</td>", arg.getLastValue());
return null;
}
}, new Function<AggregationData, Void>() {
@Override
public Void apply(AggregationData arg) {
if (arg instanceof AggregationData.MeanData) {
AggregationData.MeanData meanData = (AggregationData.MeanData) arg;
formatter.format("<td>%.3f</td>", meanData.getMean());
formatter.format("<td class=\"borderLL\">%d</td>", meanData.getCount());
return null;
}
throw new IllegalArgumentException("Unknown Aggregation.");
}
});
out.write("</tr>");
}
Aggregations