Commit 9fab7de8 authored by Björn Richerzhagen's avatar Björn Richerzhagen
Browse files

Fixed some NPS in Filter Toolchain for invalid derived metrics

parent 8b3f212a
......@@ -206,7 +206,9 @@ public abstract class AbstractFilter<M extends MetricValue<?>> implements
if (isOverallMetric) {
M overall = getDerivedMetricValueFor(DerivedMetric.this,
incoming, null);
setOverallMetric(overall);
if (overall != null) {
setOverallMetric(overall);
}
} else {
for (Host host : hosts) {
M perHost = getDerivedMetricValueFor(DerivedMetric.this,
......
......@@ -83,14 +83,17 @@ public abstract class StatisticsFilter extends
Metric<?> derivedMetric, List<Metric<?>> inputs, Host host) {
assert inputs.size() == 1;
assert host == null;
Metric<?> input = inputs.get(0);
Metric<? extends MetricValue<?>> input = inputs.get(0);
if (input.isOverallMetric()) {
throw new AssertionError(
"Only available for per-host input metrics.");
}
LinkedList<MetricValue> mvs = new LinkedList<MetricValue>(
input.getAllPerHostMetrics());
return new StatisticsMetricValue(mvs);
List<? extends MetricValue<?>> values = input.getAllPerHostMetrics();
if (values == null || values.isEmpty()) {
return null;
}
LinkedList<MetricValue> mvs = new LinkedList<MetricValue>(values);
return new StatisticsMetricValue(mvs);
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment