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

apm.DefaultTracer misbehaves when transport configuration is invalid #1383

Open
axw opened this issue Feb 9, 2023 · 4 comments
Open

apm.DefaultTracer misbehaves when transport configuration is invalid #1383

axw opened this issue Feb 9, 2023 · 4 comments
Labels
agent-go bug Something isn't working

Comments

@axw
Copy link
Member

axw commented Feb 9, 2023

The documentation for apm.DefaultTracer says:

// The default tracer is configured via environment variables, and will always
// be non-nil. If any of the environment variables are invalid, the
// corresponding errors will be logged to stderr and the default values will be
// used instead.

However, at the moment, if creating the transport fails (e.g. beause the URL is invalid) the default URL (http://localhost:8200) is not used -- instead, we use a transport that discards all data:

apm-agent-go/tracer.go

Lines 315 to 317 in 2e6d3cf

initialTransport, err := initialTransport(opts.ServiceName, opts.ServiceVersion)
if failed(err) {
opts.Transport = transport.NewDiscardTransport(err)

Another problem is that the agent will be "active", meaning that it will create transactions and spans and inject their trace context into headers, but the events will be discarded - so distributed traces will always be broken.

If we were to change the code to match the comment, distributed traces would still be broken unless the expected URL happened to be http://localhost:8200, which seems unlikely. I think instead we should:

  • set the tracer to be inactive rather than just using a discard transport
  • update the DefaultTracer comment to mention that if the transport-specific config vars are invalid, then we'll deactivate the tracer
@axw axw added the bug Something isn't working label Feb 9, 2023
@shubhamsharma7867
Copy link
Contributor

Hi @axw,
I hope this message finds you well. I'm reaching out to express my interest in contributing to the resolution of this bug. I noticed this particular issue and wanted to inquire if anyone is currently working on it. If not, I would like to take it up!

@dmathieu
Copy link
Member

dmathieu commented Apr 2, 2024

Nobody is working on this yet. We do welcome PRs though.

@shubhamsharma7867
Copy link
Contributor

@dmathieu Sure! Thanks for confirming.

@shubhamsharma7867
Copy link
Contributor

shubhamsharma7867 commented Apr 28, 2024

Hi @dmathieu created a PR for this bug fix #1618

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

No branches or pull requests

3 participants