coursera / metrics-datadog

metrics-datadog
Other
187 stars 105 forks source link

DatadogReporter is sending my Counter metric every 10 seconds #92

Open JeremyColton opened 6 years ago

JeremyColton commented 6 years ago

Here's my config for the DatadogReporter:

`try { UdpTransport udpTransport = new UdpTransport.Builder().build();

        final DatadogReporter reporter = DatadogReporter.forRegistry(metrics)
                    .withTransport(udpTransport)
                    .convertRatesTo(TimeUnit.SECONDS)
                    .convertDurationsTo(TimeUnit.MILLISECONDS)
                    .filter(MetricFilter.ALL)
                    .build();
            reporter.start(periodInSecs, TimeUnit.SECONDS);
        } catch (Throwable t) {
            LOGGER.error(t);
        }`

(Sorry I can't get the formatting to work properly on my code above!)

I am using a com.codahale.metrics.Counter metric and increment it once for my metric. I check its valus using the DropWizard metrics-servlet which reports:

{"version":"4.0.0","gauges":{},"counters":{"male.uk.test.counter":{"count":1}},"histograms":{},"meters":{},"timers":{}}

When I listen to what the datadog agent is receiving via: sudo tcpdump -i lo udp port 8125 -vv -X

I see that every 10 seconds it receives: 15:33:26.041024 IP (tos 0x0, ttl 64, id 39196, offset 0, flags [DF], proto UDP (17), length 52) localhost.45074 > localhost.8125: [bad udp cksum 0xfe33 -> 0xae3f!] UDP, length 24 0x0000: 4500 0034 991c 4000 4011 a39a 7f00 0001 E..4..@.@....... 0x0010: 7f00 0001 b012 1fbd 0020 fe33 6d61 6c65 ...........3male 0x0020: 2e75 6b2e 7465 7374 2e63 6f75 6e74 6572 .uk.test.counter 0x0030: 3a31 7c67 :1|g

  1. Is this normal behaviour for a com.codahale.metrics.Counter metric?

It's causing my datadog visual for this Counter metric to constantly increase every 10 seconds. But there was only 1 ACTUAL event for this metric. So my datadog visual should read 1 for the given time window!

  1. Am I using the wrong metric to record the ACTUAL number of events for a given time window?

Many thanks.