minor fixes on PR

This commit is contained in:
Jonathan Shook 2022-11-22 18:11:43 -06:00
parent 28f561aedd
commit 69617042b1

View File

@ -149,14 +149,14 @@ public class ScenarioResult {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
ActivityMetrics.getMetricRegistry().getMetrics().forEach((k, v) -> { ActivityMetrics.getMetricRegistry().getMetrics().forEach((k, v) -> {
if (v instanceof Counting) { if (v instanceof Counting counting) {
long count = ((Counting) v).getCount(); long count = counting.getCount();
if (count > 0) { if (count > 0) {
NBMetricsSummary.summarize(sb, k, v); NBMetricsSummary.summarize(sb, k, v);
} }
} else if (v instanceof Gauge) { } else if (v instanceof Gauge<?> gauge) {
Object value = ((Gauge) v).getValue(); Object value = gauge.getValue();
if (value != null && value instanceof Number n) { if (value instanceof Number n) {
if (n.doubleValue() != 0) { if (n.doubleValue() != 0) {
NBMetricsSummary.summarize(sb, k, v); NBMetricsSummary.summarize(sb, k, v);
} }