Skip to content
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

Merged
merged 8 commits into from
Mar 11, 2022
Merged

Add sender level tags #104

merged 8 commits into from
Mar 11, 2022

Conversation

turtlespin
Copy link

@turtlespin turtlespin commented Feb 25, 2022

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

2022-02-25 13_49_09

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

2022-02-25 13_49_16

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

2022-02-25 13_49_16

2022-02-25 13_49_22

The 2 resulting errors both have the sender level tags applied but differ with the instance level tags that are applied

@darcythomas
Copy link

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/raygunmsgs.py Show resolved Hide resolved
endpointpath = '/entries'
process_tags = None

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.

Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants