-
Notifications
You must be signed in to change notification settings - Fork 437
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 configurable error codes in contrib/net/http #2882
base: main
Are you sure you want to change the base?
Support configurable error codes in contrib/net/http #2882
Conversation
376b457
to
9d6c3af
Compare
9d6c3af
to
bc82905
Compare
Hello, thanks for your contribution! We're currently working on support for two related features, DD_TRACE_HTTP_CLIENT_ERROR_STATUSES and DD_TRACE_HTTP_SERVER_ERROR_STATUSES. These environment variables allow customization over which HTTP "error" codes on HTTP client and HTTP server spans, respectively. Note: If set, the options will apply to all http-based integrations, not just net-http. Would this address your use-case? Thanks! |
Hey Mikayla, thanks for the response. Can you explain a bit further, i.e this environment variable would be something like |
Hey @nakkamarra , The work is currently in progress, so ideally the change would land in the next dd-trace-go version, although we don't currently have an ETA for the release. What do you think? |
@mtoffl01 Sorry for the late response. Yeah I do prefer to be able to do it programmatically rather than having to update the env vars of my datadog pods in my cluster, but if the plan is that this will then remove all of those similar |
@nakkamarra , your preference makes sense, however, the work to support env var configuration is already in progress. A note:
Let me know if you have additional questions. |
Oh I see, the plan is to keep the existing integration-level checks but default to the environment variables if they are set? And there's no plans to remove those integration-level checks after the fact? If that's the case then I'd definitely prefer that there is an option here to specify one for net/http like this PR does, as it solves my use case and doesn't require reconfiguring and redeploying the agents and operators in my cluster. |
Hey @nakkamarra , |
Hi @nakkamarra , |
What does this PR do?
This PR adds a configurable
WithStatusCheck(...)
andisStatusError
to contrib/net/http so that theServeMux
andTraceAndServe(...)
can reference that to then decide whether or not to set an error tag on a span based on user defined function for status code checking.Motivation
As outlined in #2876, I feel this makes things a bit more configurable in the case that someone wants to reporting some other status code as an error that isn't handled by current logic (500 - 600 status code) or wants to omit a specific status code in the current logic for some reason (i.e a service is expected to send a 500 or some other status in an expected case and don't want that to add to affect SLOs or some other contrived case)
Reviewer's Checklist
Unsure? Have a question? Request a review!