Github user aledsage commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/915#discussion_r158230801
--- Diff:
core/src/main/java/org/apache/brooklyn/enricher/stock/MathAggregatorFunctions.java
---
@@ -118,9 +123,10 @@ public T apply(@Nullable Collection<? extends Number>
vals) {
List<Number> postProcessedVals = new ArrayList<>();
int count = 0;
if (vals != null) {
- for (Number val : vals) {
- if (val != null) {
- postProcessedVals.add(val);
+ for (Object val : vals) {
+ Maybe<Number> coercedVal =
TypeCoercions.tryCoerce(val, Number.class);
+ if (coercedVal.isPresentAndNonNull()) {
+ postProcessedVals.add(coercedVal.get());
count++;
} else if (defaultValueForUnreportedSensors != null) {
--- End diff --
Done - but also guarding so we don't log repeatedly at warn. The aggregator
might well get called every few seconds per enricher, so must avoid flooding
the log with such warn messages.
---