tenants: set tenant uuid in sentry
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
0587ab26e8
commit
669329e49c
|
@ -3,6 +3,7 @@ from typing import Callable
|
||||||
|
|
||||||
from django.http.request import HttpRequest
|
from django.http.request import HttpRequest
|
||||||
from django.http.response import HttpResponse
|
from django.http.response import HttpResponse
|
||||||
|
from sentry_sdk.api import set_tag
|
||||||
|
|
||||||
from authentik.tenants.utils import get_tenant_for_request
|
from authentik.tenants.utils import get_tenant_for_request
|
||||||
|
|
||||||
|
@ -19,4 +20,6 @@ class TenantMiddleware:
|
||||||
if not hasattr(request, "tenant"):
|
if not hasattr(request, "tenant"):
|
||||||
tenant = get_tenant_for_request(request)
|
tenant = get_tenant_for_request(request)
|
||||||
setattr(request, "tenant", tenant)
|
setattr(request, "tenant", tenant)
|
||||||
|
set_tag("authentik.tenant_uuid", tenant.tenant_uuid.hex)
|
||||||
|
set_tag("authentik.tenant_domain", tenant.domain)
|
||||||
return self.get_response(request)
|
return self.get_response(request)
|
||||||
|
|
Reference in a new issue