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 user event data from logging extra #457

Closed
wants to merge 1 commit into from

Conversation

alexmick
Copy link

@alexmick alexmick commented Aug 8, 2019

While migrating from raven to sentry-python I noticed my usage of the user key no longer populated the field on the sentry interface :

logger.critical("User error", extra=dict(user=dict(id=123, email="user@example.org")))

This PR is an attempt to bring back this behaviour by adding the user key to the captured event.

I tried to do my best to respect codestyle and conventions but I'm sure this can be further improved. This is more a proof of concept, wasn't sure if it was better to open an issue or and PR so I chose the option with a bit of code 😊

@alexmick alexmick marked this pull request as ready for review August 8, 2019 16:19
@untitaker
Copy link
Member

Sorry, we categorically decided not to do this, here is the rationale: getsentry/sentry-php#844 (comment)

There is also a vague hint as to how a workaround could look like (there are multiple solutions, such as using before_send or push_scope). Let me know if you would like to have a usage example.

@untitaker untitaker closed this Aug 8, 2019
@alexmick
Copy link
Author

alexmick commented Aug 8, 2019

Thanks, I was unaware that it was by design !

You're right, a workaround with push_scope by overriding _emit() in EventHandler or a before_send function on the SDK init work fine 👌

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