zentol commented on a change in pull request #8259: [FLINK-12325][metrics] Fix
bug in statsd exporter when using negative values
URL: https://github.com/apache/flink/pull/8259#discussion_r280375417
##########
File path:
flink-metrics/flink-metrics-statsd/src/main/java/org/apache/flink/metrics/statsd/StatsDReporter.java
##########
@@ -216,4 +238,14 @@ public String filterCharacters(String input) {
return chars == null ? input : new String(chars, 0, pos);
}
+
+ private boolean numberIsNegative(Number input) {
+ try {
+ return new
BigDecimal(input.toString()).compareTo(BigDecimal.ZERO) == -1;
Review comment:
I'm wondering whether we could use `return
Double.compare(input.doubleValue(), 0) < 0` instead. This should be sufficient
for our use-cases, and we get around the repeated convert-to-string ->
parse-from-string operations.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services