fix(sentry): set the user's name correctly

https://docs.sentry.io/platforms/python/enriching-events/identify-user/

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
Akhil Narang 2023-12-08 16:13:15 +05:30
parent 57699a54b1
commit faef64bab4
No known key found for this signature in database
GPG key ID: 9DCC61E211BF645F

View file

@ -41,7 +41,7 @@ def capture_exception(
evt_processor = _make_wsgi_event_processor(frappe.request.environ, False)
scope.add_event_processor(evt_processor)
scope.set_tag("site", frappe.local.site)
scope.set_tag("user", getattr(frappe.session, "user", "Unidentified"))
scope.set_user({"name": getattr(frappe.session, "user", "Unidentified")})
# Extract `X-Frappe-Request-ID` to store as a separate field if its present
if trace_id := frappe.monitor.get_trace_id():