Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24978 from code-dot-org/newrelic_user_custom_attr…
…ibute add user id as Custom Attribute to New Relic agent
- Loading branch information
Showing
2 changed files
with
16 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
if defined?(::NewRelic::Agent.add_custom_attributes) && | ||
defined?(::Warden::Manager.after_set_user) | ||
::Warden::Manager.after_set_user do |user, _auth, _opts| | ||
if user.respond_to?(:id) | ||
::NewRelic::Agent.add_custom_attributes({user_id: user.id}) | ||
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