|
56 | 56 | import java.util.List; |
57 | 57 | import java.util.Map; |
58 | 58 | import java.util.Set; |
59 | | -import java.util.stream.Collectors; |
60 | 59 | import javax.annotation.Nullable; |
61 | 60 | import org.apache.commons.text.StringSubstitutor; |
62 | 61 | import org.checkerframework.checker.nullness.qual.MonotonicNonNull; |
@@ -155,27 +154,25 @@ public void trackAsync(TelemetryItem telemetry) { |
155 | 154 | MonitorDomain data = telemetry.getData().getBaseData(); |
156 | 155 | if (data instanceof MetricsData) { |
157 | 156 | MetricsData metricsData = (MetricsData) data; |
158 | | - List<MetricDataPoint> filteredPoints = |
159 | | - metricsData.getMetrics().stream() |
160 | | - .filter( |
161 | | - point -> { |
162 | | - String metricName = point.getName(); |
163 | | - if (nonFilterableMetricNames.contains(metricName)) { |
164 | | - return true; |
165 | | - } |
166 | | - for (MetricFilter metricFilter : metricFilters) { |
167 | | - if (!metricFilter.matches(metricName)) { |
168 | | - return false; |
169 | | - } |
170 | | - } |
171 | | - return true; |
172 | | - }) |
173 | | - .collect(Collectors.toList()); |
174 | | - |
175 | | - if (filteredPoints.isEmpty()) { |
| 157 | + if (metricsData.getMetrics().isEmpty()) { |
| 158 | + throw new AssertionError("MetricsData has no metric point"); |
| 159 | + } |
| 160 | + MetricDataPoint point = metricsData.getMetrics().get(0); |
| 161 | + String metricName = point.getName(); |
| 162 | + if (!nonFilterableMetricNames.contains(metricName)) { |
| 163 | + for (MetricFilter metricFilter : metricFilters) { |
| 164 | + if (!metricFilter.matches(metricName)) { |
| 165 | + // user configuration filtered out this metric name |
| 166 | + return; |
| 167 | + } |
| 168 | + } |
| 169 | + } |
| 170 | + |
| 171 | + if (!Double.isFinite(point.getValue())) { |
| 172 | + // TODO (trask) add test for this |
| 173 | + // breeze doesn't like these values |
176 | 174 | return; |
177 | 175 | } |
178 | | - metricsData.setMetrics(filteredPoints); |
179 | 176 | } |
180 | 177 |
|
181 | 178 | if (telemetry.getTime() == null) { |
|
0 commit comments