-
Notifications
You must be signed in to change notification settings - Fork 28
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
Add sender level tags #104
Conversation
…lied tags, allows for multiple assignment
…llow assignment of this list, assign both sets when building messages
Side note: Do we have a matrix of features (like this) vs providers. Something we could use to make small improvements to the providers, during our downtime etc. |
python2/raygun4py/raygunprovider.py
Outdated
endpointpath = '/entries' | ||
process_tags = None |
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.
I am not a fan of nulls (None
) could this be an empty array (list?) instead.
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.
Have updated to initialize as empty list
Overview
This PR adds the concept of tags which can be set once against a RaygunSender instance and then applied to each exception which is raised through that sender. This avoids the requirement to specify tags with each invocation of send_exception.
A new method set_tags has been added to RaygunSender to allow these tags to be specified.
I have also updated the API endpoint to use api.raygun.com rather than api.raygun.io as part of this PR.
Examples
Setup
client = raygunprovider.RaygunSender('YOUR_API_KEY')
Initialize a client instance
client.set_tags(["process_tag1", "process_tag2"])
Use the new set_tags method to apply tags at a sender level
Example 1
client.send_exception(exc_info=(exc_type, exc_value, exc_traceback))
Raising an exception with no tags specified
The resulting error has the sender level tags applied
Example 2
client.send_exception(exc_info=(exc_type, exc_value, exc_traceback), tags={"tag1", "tag2"})
Raising an exception with tags specified
The resulting error has both the sender level tags and the instance level tags applied
Example 3
client.send_exception(exc_info=(exc_type, exc_value, exc_traceback), tags={"tag1", "tag1"})
client.send_exception(exc_info=(exc_type, exc_value, exc_traceback), tags={"tag3", "tag4"})
Raising 2 exceptions with different instance level tags specified
The 2 resulting errors both have the sender level tags applied but differ with the instance level tags that are applied