Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues tracing on Ubuntu #3683

Closed
dreamingkills opened this issue Oct 5, 2023 · 4 comments
Closed

Issues tracing on Ubuntu #3683

dreamingkills opened this issue Oct 5, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@dreamingkills
Copy link

dreamingkills commented Oct 5, 2023

Expected behaviour

I'm attempting to use dd-trace in a dockerized Node application with the datadog/agent image together as part of a compose.

Actual behaviour

The compose works on my development machine (Windows), but when I try to run it on my Ubuntu server it seems to break and throw this error:

tracer.dogstatsd.increment("example.stat");
                 ^

TypeError: Cannot read properties of undefined (reading 'increment')
    at Object.<anonymous> (/app/index.js:5:18)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Module._load (node:internal/modules/cjs/loader:878:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:23:47

In the datadog/agent container's debug logs I also noticed a lot of this:

{
  "level": "error",
  "ts": 1696498103.455323,
  "caller": "preload_go/process.go:120",
  "msg": "error sending telemetry",
  "error": "Post \"http://localhost/telemetry/proxy/api/v2/apmtelemetry\": dial unix /opt/datadog/apm/inject/run/apm.socket: connect: no such file or directory",
  "stacktrace": "github.com/datadog/preload_go.CommandLineEvaluator.telemetrySender\n\t/go/src/github.com/DataDog/auto_inject/preload_go/process.go:120\ngithub.com/datadog/preload_go.CommandLineEvaluator.Process.func1\n\t/go/src/github.com/DataDog/auto_inject/preload_go/process.go:164\ngithub.com/datadog/preload_go.CommandLineEvaluator.Process\n\t/go/src/github.com/DataDog/auto_inject/preload_go/process.go:176\ngithub.com/datadog/preload_go.Processor.Parser\n\t/go/src/github.com/DataDog/auto_inject/preload_go/parser.go:100\nmain.main\n\t/go/src/github.com/DataDog/auto_inject/preload_go/cmd/process/main.go:133\nruntime.main\n\t/goroot/src/runtime/proc.go:250"
}

I'm not sure if it's related or not but hopefully it can help figure out the problem because I'm kind of stuck lol.
I can provide further debug logs if others can't reproduce it.

Steps to reproduce

I've made a minimal repository that demonstrates the issue: https://github.com/dreamingkills/dd-trace-reproduction
Just run docker compose up --build.

Environment

  • Operation system: Ubuntu 22.04
  • Node.js version: 18.12.1-alpine
  • Tracer version: datadog/agent:7.47.1
  • Agent version: datadog/agent:7.47.1
  • Relevant library versions: dd-trace@4.16.0

See linked repo

@dreamingkills dreamingkills added the bug Something isn't working label Oct 5, 2023
@dreamingkills
Copy link
Author

Tested it some more today and this is clearly not a dd-trace issue. I ran this on a brand new VPS and it works, so I think something got misconfigured on the original host.

@torte
Copy link

torte commented Dec 13, 2023

@dreamingkills Did you find out by any chance what was the issue? Running into the same problem but on Amazon Linux. Running the dd-trace library locally is fine even no agent installation is present locally, I can at least see the dogstatsd property on the tracer instance. Once deployed on there it is undefined though. The agent is set up to allow dogstatsd as well.

@dreamingkills
Copy link
Author

dreamingkills commented Dec 17, 2023

@torte Unfortunately I never figured out exactly what was wrong, but in my case I had mistakenly installed the agent on the host machine before I started using the container so I assume having two agents around somehow confused the tracer. Re-doing everything on a new host sans the non-container agent resolved the issue.

@martinxsliu
Copy link

I just ran into this issue. The problem for me was that I was passing around the dogstatsd methods, but didn't bind them to the dogstatsd instance. This fixes it:

const increment = tracer.dogstatsd.increment.bind(tracer.dogstatsd);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants