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 set_customdata to RaygunSender, apply process level custom data w… #106

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

turtlespin
Copy link

Overview

This PR adds the concept of custom data 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 custom data with each invocation of send_exception.

A new method set_customdata has been added to RaygunSender to allow this to be specified.

Examples

Setup

client = raygunprovider.RaygunSender('YOUR_API_KEY')

Initialize a client instance

client.set_customdata({'key':'value','foo':'bar'})

Use the new set_customdata method to apply the custom data Dict at a sender level

Example 1

client.send_exception(exc_info=(exc_type, exc_value, exc_traceback))

Raising an exception with no custom data specified

2022-03-11 14_53_11

The resulting error has the sender level custom data applied

Example 2

client.send_exception(exc_info=(exc_type, exc_value, exc_traceback), userCustomData={'baz':'value','elden':'ring'})

Raising an exception with custom data specified

2022-03-11 14_54_10

The resulting error has both the sender level custom data and the instance level custom data

Example 3

client.send_exception(exc_info=(exc_type, exc_value, exc_traceback), userCustomData={'key':'elden','foo2':'ring'})

Raising an exception with custom data specified where some keys are the same as the sender level

2022-03-11 14_54_55

The resulting error has both the sender level custom data and the instance level custom data but where keys are the same the instance level is used in preference

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.

None yet

2 participants