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_r278480204
 
 

 ##########
 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())));
 
 Review comment:
   You can skip the creation of the registry. You can extract the reporter from 
the ReporterSetup and call report explicitly.

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