honeybadger-io / honeybadger-python

Send Python and Django errors to Honeybadger.
https://www.honeybadger.io/
MIT License
15 stars 26 forks source link

Add user name to session object #155

Closed dotysan closed 1 year ago

dotysan commented 1 year ago

Make it easy to track down what user got the error.

stympy commented 1 year ago
  • Where would this information show in the error page?

It would appear in the session block on the error page, along with the other session data.

So far, I've known that we use context to set information such as username.

Yes, the context is the place for this kind of info. This is what we do with the Ruby client:

https://github.com/honeybadger-io/honeybadger-ruby/blob/72ab159a03101cd459df9959895e5a17387c1970/lib/honeybadger/plugins/warden.rb#L13

subzero10 commented 1 year ago

Following @stympy's advice, I think we should go for this solution #156. What do you think @dotysan?

subzero10 commented 1 year ago

This is handled with #156, which was just published (0.16.0)!

joshuap commented 1 year ago

@subzero10 do you know if there is a user ID attribute available? It would be good to add user_id to the context, since that's one of the special keys we use for advanced features:

image
stympy commented 1 year ago

@joshuap we also added username as one of those special keys (in addition to user_id and user_email) to Honeybadger's processing, as a result of this change 😉

subzero10 commented 1 year ago

do you know if there is a user ID attribute available?

@joshuap I couldn't find anything official but I can read from SO that people can get a user id from the User object. I added it!

dotysan commented 4 months ago

I jus got a backtrace in Django with 0.20.1 and it is missing the user name again. :-(

joshuap commented 3 months ago

@subzero10 @Kelvin4664 can you take a look at this?

subzero10 commented 3 months ago

Yes, I've made a note to try and reproduce in the coming days.

subzero10 commented 3 months ago

Hey @dotysan, thanks for reporting the issue! I've found the problem and submitted #176.

subzero10 commented 3 months ago

@dotysan, I just published 0.20.2. This version should propertly report user name and id now!

dotysan commented 3 months ago

@subzero10 Thx! I did have honeybadger middleware at the top, but still didn't get the user name.

Will test with 0.20.2 again now.

subzero10 commented 3 months ago

I did have honeybadger middleware at the top, but still didn't get the user name.

This makes sense, considering the fix we just published. With 0.20.2, it should work!

dotysan commented 3 months ago

Yay! image

subzero10 commented 3 months ago

I'm glad it worked for you this time! And thank you for helping me with the fix :)