-
Notifications
You must be signed in to change notification settings - Fork 600
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
Subscribe to additional Action controller topics #1744
Merged
tannalynn
merged 40 commits into
dev
from
action_controller_subscriber_additional_topic
Jan 24, 2023
Merged
Changes from 34 commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
4607b3c
Subscribe to render_layout
hannahramadan a4d709f
WIP add subscribers for additional
tannalynn 37f5010
add test for halted_callback
tannalynn d16512f
updated names/paths
tannalynn 30346c9
added unpermitted parameter test
tannalynn 4d82aa9
moved generic start and finish to parent class
tannalynn 9224ab5
added parameters to tests
tannalynn d24827c
move action controller that aren't process_action
tannalynn a6ad626
Merge branch 'dev' into action_controller_subscriber_additional_topic
tannalynn ee1c789
moved test for start and finish into
tannalynn e2d9788
removed start and finish from subclasses that are
tannalynn 7d1caec
rename file
tannalynn 97da112
fix for rails 6 tests
tannalynn 39ad8b2
skip when topic not available in rails version
tannalynn 30b9939
removed binding.irb
tannalynn 247bf5a
fix Gem::Version.new
tannalynn 92402a8
update to match all rails version filter
tannalynn 5363967
pr feedback updates
tannalynn fbccb6e
fix spelling
tannalynn 512bfea
Merge branch 'action_controller_subscriber_additional_topic' into NR1…
hannahramadan 319e972
Add test and refactor
hannahramadan c834c46
Add test for when there is no segment
hannahramadan e675cb8
added test for not implemented methods
tannalynn 7e3a4f8
Protect for unknown action view topics
hannahramadan bbeff88
DRYed up notification subscriber some more
tannalynn 57d6f61
Merge pull request #1748 from newrelic/NR1512_subscribe_actionview
hannahramadan 8a1b890
Merge branch 'dev' into action_controller_subscriber_additional_topic
tannalynn ac50f7c
DRYed up notification subscriber subclasses
tannalynn 7172943
Merge branch 'action_controller_subscriber_additional_topic' of githu…
tannalynn acf7507
comment out hanging test
tannalynn 1e7e1bc
add test for segment getting created by
tannalynn 66c6dd9
disable weird rubocop failure
tannalynn 5fd2e2a
Merge branch 'dev' into action_controller_subscriber_additional_topic
tannalynn 1c6ddda
added config
tannalynn f7a252f
Use NewRelic::UNKNOWN const
hannahramadan ac8f980
Merge pull request #1755 from newrelic/actionview-updates
hannahramadan 55ed14f
fix for frozen segment name in action mailer
tannalynn 6eb12b3
test fixes
tannalynn 3a82667
rubocop
tannalynn a41dba4
don't test action mailer on ruby 2.3
tannalynn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
lib/new_relic/agent/instrumentation/action_controller_other_subscriber.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# This file is distributed under New Relic's license terms. | ||
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details. | ||
# frozen_string_literal: true | ||
|
||
require 'new_relic/agent/instrumentation/notifications_subscriber' | ||
require 'new_relic/agent/instrumentation/ignore_actions' | ||
require 'new_relic/agent/parameter_filtering' | ||
|
||
module NewRelic | ||
module Agent | ||
module Instrumentation | ||
class ActionControllerOtherSubscriber < NotificationsSubscriber | ||
def add_segment_params(segment, payload) | ||
segment.params[:filter] = payload[:filter] if payload[:filter] | ||
segment.params[:keys] = payload[:keys] if payload[:keys] | ||
segment.params[:original_path] = payload[:request].original_fullpath if payload[:request] | ||
|
||
if payload[:context] | ||
segment.params[:action] = payload[:context][:action] | ||
segment.params[:controller] = payload[:context][:controller] | ||
end | ||
end | ||
|
||
def metric_name(name, payload) | ||
controller_name = controller_name_for_metric(payload) | ||
"Ruby/ActionController#{"/#{controller_name}" if controller_name}/#{name.gsub(/\.action_controller/, '')}" | ||
end | ||
|
||
def controller_name_for_metric(payload) | ||
# redirect_to | ||
return payload[:request].controller_class.controller_path if payload[:request] && payload[:request].controller_class | ||
|
||
# unpermitted_parameters | ||
::NewRelic::LanguageSupport.constantize(payload[:context][:controller]).controller_path if payload[:context] && payload[:context][:controller] | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This is a great cleanup, thank you.