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

feat: disable trace_layer on_failure, only emit error event for 500s #1608

Merged
merged 1 commit into from
Feb 2, 2024

Conversation

oddgrd
Copy link
Contributor

@oddgrd oddgrd commented Feb 2, 2024

Description of change

Motivation

  • We were emitting two events for every 5xx, one from the IntoResponse implementation, which can know more about what the error was, and one from the trace layer on_failure default implementation, which only knows the status code (and some metadata).
  • We were emitting error events for 4xx in the IntoResponse implementation, but they don't really warrant an error event. Trying to fetch a project that doesn't exist isn't possible, so it's not something we need to highlight as an error. The span will still have the 404 status code.
  • With the trace_layer on_failure disabled, we only get the error event in IntoResponse, and we still set the status code on the span so we can track 4xx's.

Alternatives

  • With the current solution, we have to create an event in the IntoResponse implementation for three crates, rather than having the same behavior for all creates defined in the trace layer. We could disable the events in the IntoResponse instead, and just use the trace layer on_failure, but we would have less data in the event about what the error was.

How has this been tested? (if applicable)

Tested with local env and Datadog.

additionaly, switch to only emit error event for 500s in error intoresponse impls
Copy link
Contributor

@chesedo chesedo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@oddgrd oddgrd merged commit 8c6e931 into main Feb 2, 2024
36 checks passed
@oddgrd oddgrd deleted the feat/disable-trace-layer-on-failure-events branch February 2, 2024 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants