dd-trace-go icon indicating copy to clipboard operation
dd-trace-go copied to clipboard

[BUG] Newly introduced database/sql metrics do not send over Unix sockets

Open jared-mackey opened this issue 4 months ago • 3 comments

Version of dd-trace-go 1.63.0

Describe what happened:

https://github.com/DataDog/dd-trace-go/issues/2303#issuecomment-2076000564

Describe what you expected: New metrics to work over Unix sockets

Steps to reproduce the issue:

https://github.com/DataDog/dd-trace-go/issues/2303#issuecomment-2076000564

cc @mtoffl01

jared-mackey avatar Apr 30 '24 14:04 jared-mackey

Hey @jared-mackey ,

It does not read or use DD_DOGSTATSD_URL like I would expect it to.

DD_DOGSTATSD_URL is not a valid config option for dd-trace-go (Note: Confusingly, it is valid for other Datadog tracers such as dd-trace-py). See here: https://docs.datadoghq.com/tracing/trace_collection/library_config/go, only DD_DOGSTATSD_PORT is available for configuration via env var. To have total control over the dogstatsd address, you'd need the tracer config option WithDogstatsdAddress.

Regardless of the env var's significance to the tracer, it should still work if you pass that env var as a value to the tracer start option, like in your example tracer.WithDogstatsdAddress(os.Getenv("DD_DOGSTATSD_URL")). A few questions:

  1. When you use just the DD_DOGSTATSD_URL env var, can you confirm whether you receive any runtime metrics or tracer health metrics (these should be prefixed with datadog.tracer, entries like datadog.tracer.started and datadog.tracer.spans_started). With this config, I'd guess you're missing all dogstatsd payloads from the tracer, not just db stats
  2. Can you confirm the tracer.WithDogstatsdAddress option does not work? What is the behavior you're seeing in the logs for this specific case? I could not reproduce this on my side.

mtoffl01 avatar May 02 '24 20:05 mtoffl01

Hi @mtoffl01,

So this is confusing then. Because I am getting runtime metrics currently with only that env var configured. I do not currently call tracer.WithDogstatsdAddress. I do however setup a Dogstatsd client. I do not provide it a URL but it instead uses the env var. You can see that here. Is the tracer somehow using that client for runtime metrics but not for the sql metrics?

I’d be happy to share exact code samples over a support ticket if that’s helpful. Just let me know.

jared-mackey avatar May 03 '24 13:05 jared-mackey

@jared-mackey ,

I’d be happy to share exact code samples over a support ticket if that’s helpful. Just let me know.

Please do! When you open the support ticket, please be sure to link to this github issue so that the support rep who takes the case will have the necessary context, and bubble it up to us.

mtoffl01 avatar May 08 '24 19:05 mtoffl01