-
Notifications
You must be signed in to change notification settings - Fork 301
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
Support Datadog unix sockets for reporting traces #1615
Comments
this is a really good callout! we're going to be doing some more work around tracing and observability soon, so i'll keep this in mind for when we do. |
kia ora @agates4! I've had a bit more of a chance to engage my brain on this this afternoon. As far as i can tell, there's no way to tell
With this in mind, we could theoretically do something like // in bootstrap/tracing.go
func (b *Bootstrap) startTracingDatadog(ctx context.Context) (tracetools.Span, context.Context, stopper) {
opts := []tracer.StartOption{
tracer.WithServiceName("buildkite_agent"),
tracer.WithSampler(tracer.NewAllSampler()),
tracer.WithAnalytics(true),
}
if sock := os.Getenv("DD_APM_RECEIVER_SOCKET"); sock != "" {
opts = append(opts, tracer.WithUDS(sock))
}
// ... rest of the tracing setup
} ...butttt i'm not super keen to do something like this for a couple of reasons. The main one is that the socket location is a concern somewhat external to the agent itself; we don't really want to be explicitly handling an environment variable that's meant for the datadog agent. my recommendation at this stage would be to open a PR against the other option would be to create a socket at the magic location above, but (bit of a digression here) it seems like both the datadog agent and the tracing library expect the socket to exist prior to their initialisation, which seems like a weirdly hands-off approach. I would've expected the datadog agent to create the socket and have the libraries connect to it? It's all a bit odd. I realise "go implement it yourself" isn't exactly am awesome outcome for this issue; i'm happy to discuss further and see if we can get to some sort of a happy middle ground :) |
Hey Moskyb, thanks for the detailed explanation! Even if the hosts are not set, and the file exists in the magic location, the datadog client will still use To fix this, I implemented this change and submitted a PR to the Go client This should offload any changes from Buildkite and allow the user set environment variables to handle the rest! |
Awesome! When that gets released, we'll update dd-trace-go to use that feature :) I'll leave this issue open for tracking until then |
Supporting resources
Is your feature request related to a problem? Please describe.
Traces aren’t sent to Datadog when a unix socket is used, because Buildkite only support sending traces via HTTP.
So, even though my Buildkite Agent is configured properly to send traces via the volume mounted socket, they will not send, because the Buildkite implementation expects to use HTTP requests, defaulting to
http://localhost:8126/v0.4/traces
It appears this is a bug!
Describe the solution you'd like
If one of these environment variables are set:
Then I expect the Buildkite Agent to use that address to send traces rather than the default
localhost:8126
address.Describe alternatives you've considered
Hacking together the address by setting "HOST" to
unix
and "PORT" to///var/run/datadog/apm.socket
(Doesn't work because of a failure to resolve DNS)Additional context
With these environment variables:
I receive this error at the end of the Buildkite job:
The text was updated successfully, but these errors were encountered: