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

Handle Plug.Parsers.UnsupportedMediaTypeError #41

Merged

Conversation

kamilkowalski
Copy link
Contributor

@kamilkowalski kamilkowalski commented Oct 19, 2020

Fixes #40.

Plug.Parsers.UnsupportedMediaTypeError is raised when Plug.Parsers doesn't support the content-type specified in the request.

Similarly to Phoenix.Router.NoRouteError, this shouldn't be treated as an error span, since anyone can send an unsupported media type to the server. Unlike Phoenix.Router.NoRouteError, we can keep the resource name.

This change matches the Plug.Parsers.UnsupportedMediaTypeError in SpandexPhoenix.mark_span_as_error/3 and skips marking the trace as an error.

Here's a sneak peek from our production monitoring where the change was already applied:

Screenshot_2020-10-19 APM Traces Datadog(1)

UnsupportedMediaTypeError is raised when Plug.Parsers doesn't support
the content-type specified in the request.

Similarly to Phoenix.Router.NoRouteError, this shouldn't be treated
as an error span, since anyone can send an unsupported media type to
the server. Unlike NoRouteError, we can keep the resource name.

This change matches the UnsupportedMediaTypeError and skips marking the
trace as an error.
Copy link
Member

@GregMefford GregMefford left a comment

Choose a reason for hiding this comment

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

Nice! Thank you! ❤️ 🚀

@GregMefford GregMefford merged commit 6f31cb5 into spandex-project:master Oct 19, 2020
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.

415 Unsupported Media Type Reported as Error
2 participants