Trying to send the logged on username to Sentry. If hard coded in settings, I get the expected result on the Sentry dashboard. However I can't set the username in settings.
#settings.py
from sentry_sdk import configure_scope
with configure_scope() as scope:
scope.user = {"username": "Joe Soap"}
So I am not sure where I should be doing this:
with configure_scope() as scope:
scope.user = {"username": request.user.username}
I have tried my landing view and login view. But just get my IP Address back on the sentry dashboard.
#views.py
@login_required
def landing(request):
context={}
with configure_scope() as scope:
scope.user = {"username": request.user.username}
return render(request,'paysched/landing.html',context)
Python and Django are not my home language, so my questions really are
A) can I do this?
B) and if so, where/how.
Thanks in advance for any assistance on this.
The updated Sentry SDK 0.10.2, has resolved this problem.