avast/datadog4s

metrics not being reported

andrewmslack opened this issue · 2 comments

So I have a local netcat running on port 8130 via

$ nc -ul 8130

I can mimic a succesful metric publish via

echo "foo:1|c" | nc -u -w0 127.0.0.1 8130

with that I see the packet echoed out in my netcat listener.

So now I have a "test" that attempts to write to the same address using datadog4s primitives ...

        val port = 8130
        val statsDServer = InetSocketAddress.createUnresolved("localhost", port)
        val config = StatsDMetricFactoryConfig(Some("my-service"), statsDServer)
        val factoryResource: Resource[IO, MetricFactory[IO]] = StatsDMetricFactory.make(config)

        factoryResource.use { factory =>
          val count: Count[IO] = factory.count("foo")
          for {
            _ <- count.inc()
          } yield {
            ()
          }
        }.unsafeToFuture

Yet I never see metrics appear in my netcat console.

So I must be missing something here, just cant see what that is.

dependencies:

  "com.avast.cloud" %% "datadog4s-api" % "0.14.0",
  "com.avast.cloud" %% "datadog4s-statsd" % "0.14.0",
  "cats" %% "effect" % "2.5.1"	

hmm, it works if I restart netcat between tests. I had it left open. The first time I run the test I see glorious metrics, however a rerun without restarting netcat no more metrics are received. I would have thought re: UDP I would not have to do this kind of restart.

so instead of netcat, I attempted to run against the local datadog agent. Same thing occurs, if I restart DD agent I see metrics of the test being published. If I rerun the test without restarting DD Agent no more stats are published.

that sounds really strange, to be honest i have no idea how to help you with this :(