-
Notifications
You must be signed in to change notification settings - Fork 602
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
Error fingerprinting user tracking #1883
Merged
Merged
Conversation
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
Allow the customer to register a proc to be invoked on each noticed error in order to associate each noticed error with an error group
remove comment placeholder (since satisfied)
- in the (potentially customer facing) log message, give the class and method name for the public API method producing the message - typo fix ("GRUP" -> "GROUP") in a constant name
- added tests - added getter for the error group callback
Co-authored-by: Kayla Reopelle (she/her) <[email protected]>
- fix pre-existing bug with request.uri applying - make sure internal errors are routed through the error group callback
Co-authored-by: James Bunch <[email protected]>
Co-authored-by: James Bunch <[email protected]>
Co-authored-by: James Bunch <[email protected]>
- revert fix for request.uri setting (to be addressed with a separate PR) - update comment for request.uri setting to have it apply also to error group setting - restore logic to use the caller location as a backtrace (calling `#backtrace` on a noticed error will always return either a trace or a string, but never `nil`).
also include the error group in the agent attributes hash when it is available
add supportability reporting for `set_error_group_callback`
CHANGELOG entries for error fingerprinting and user tracking
Error inbox add set_user_id API method
set_error_group_callback typo Co-authored-by: Kayla Reopelle (she/her) <[email protected]>
errors inbox fingerprinting
`NewRelic::Agent::ErrorCollector#create_noticed_error`, which is the sole consumer of `NoticedError#error_group=`, ends up calling `NoticedError#processed_attributes` fully 3 times in order to build the hash that is passed to the customer error group callback. As a result, the agent attributes for the noticed error end up being memoized. Because of the memoization, the agent attributes hash is not rebuilt later on when it comes time to submit those attributes to the collector. Updated `NoticedError#error_group=` to effectively bust the memoization cache and ensure that the error group name makes it into the agent attributes hash.
add a test to prove the need for PR 1882
- have the harvest! calls separated out so in the event of a failure it's easier to tell which one failed - update the assertions so that the expected value is listed first, then the actual value second
NoticedError: update attr cache for error group
and a corresponding test!
…frozen What if agent attributes isn't frozen
updates for error fingerprinting and user tracking
Reconcile the errors inbox functionality update changelog entries with the dev branch ones
add missing closing backtick Co-authored-by: Kayla Reopelle (she/her) <[email protected]>
SimpleCov Report
|
tannalynn
approved these changes
Mar 27, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR delivers support for two new errors inbox features: error fingerprinting and user tracking.
Error fingerprinting
A new
set_error_group_callback
public API method now exists that will accept a user defined proc. The proc will be invoked for each noticed error and whenever it returns a string, that string will be used as the error group name for the error and will take precedence over any server-side grouping that takes place with the New Relic errors inbox. This gives users much greater control over the grouping of their errors.The customer defined proc will be expected to receive exactly one input argument, a hash. The hash contains the following:
:error
#class
,#message
, and#backtrace
:customAttributes
:'request.uri'
:'http.statusCode'
:'http.method'
:'error.expected'
:'options'
The callback only needs to be set once per initialization of the New Relic agent. The
NewRelic::Agent.set_error_group_callback
method can be called from a Rails initializer or whatnot.Example usage:
User tracking
A new
set_user_id
public API method now exists that will accept a string representation of a user id and associate that user id with the current transaction. Transactions and errors will then have a newenduser.id
agent attribute associated with them. This will allow agent users to tag transactions and errors as belonging to given user ids in support of greater filtering and alerting capabilities.