Xeli 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_r279071512
 
 

 ##########
 File path: 
flink-metrics/flink-metrics-statsd/src/test/java/org/apache/flink/metrics/statsd/StatsDReporterTest.java
 ##########
 @@ -262,6 +262,69 @@ public void testStatsDMetersReporting() throws Exception {
                }
        }
 
+       /**
+        * Tests that meters are properly reported via the StatsD reporter.
+        */
+       @Test
+       public void testStatsDMetersReportingOfNegativeValues() throws 
Exception {
+               MetricRegistryImpl registry = null;
+               DatagramSocketReceiver receiver = null;
+               Thread receiverThread = null;
+               long timeout = 5000;
+               long joinTimeout = 30000;
+
+               String meterName = "meter";
+
+               try {
+                       receiver = new DatagramSocketReceiver();
+
+                       receiverThread = new Thread(receiver);
+
+                       receiverThread.start();
+
+                       int port = receiver.getPort();
+
+                       MetricConfig config = new MetricConfig();
+                       
config.setProperty(ConfigConstants.METRICS_REPORTER_INTERVAL_SUFFIX, "1 
SECONDS");
+                       config.setProperty("host", "localhost");
+                       config.setProperty("port", String.valueOf(port));
+
+                       registry = new MetricRegistryImpl(
+                               
MetricRegistryConfiguration.defaultMetricRegistryConfiguration(),
+                               
Collections.singletonList(ReporterSetup.forReporter("test", config, new 
StatsDReporter())));
+                       TaskManagerMetricGroup metricGroup = new 
TaskManagerMetricGroup(registry, "localhost", "tmId");
+                       TestMeter meter = new TestMeter(-50, -5.3);
 
 Review comment:
   Done

----------------------------------------------------------------
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

Reply via email to