-
Notifications
You must be signed in to change notification settings - Fork 601
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
Use media_type
instead of content_type
when avaliable
#2855
Conversation
media_type
instead of content_type
when avaliable
CHANGELOG.md
Outdated
@@ -56,6 +56,10 @@ Version <dev> adds Apache Kafka instrumentation for the rdkafka and ruby-kafka g | |||
|
|||
[PR#2851](https://github.com/newrelic/newrelic-ruby-agent/pull/2851) | |||
|
|||
- **Feature: Collect just MIME type from AcionDispatch requests** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe at a byline to the summary for this version as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking for version in title? 60dcfc9
@@ -24,7 +24,7 @@ def initialize(request) | |||
@referer = referer_from_request(request) | |||
@accept = attribute_from_env(request, HTTP_ACCEPT_HEADER_KEY) | |||
@content_length = content_length_from_request(request) | |||
@content_type = attribute_from_request(request, :content_type) | |||
@content_type = content_type_attribute_from_request(request) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optionally, you could simply leverage the existing attribute_from_method
's functionality instead of creating a special one-off method for content-type.
@content_type = content_type_attribute_from_request(request) | |
@content_type = content_type_attribute_from_request(request) | |
@content_type = attribute_from_request(request, :media_type) || attribute_from_request(request, :content_type) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I love the simplicity of just using one method, I liked having that longer comment + link explaining the change and it looked a bit off here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🌻
SimpleCov Report
|
Rails 7.0 changed the behavior of
ActionDispatch::Request#content_type
, adding extra request-related details the agent wasn't expecting to collect, such as charset. Additionally, the agent's use ofcontent_type
was triggering deprecation warnings. This PR updated the agent to useActionDispatch::Request#media_type
to capture the MIME type when available.Closes #2506