tenants: set tenant uuid in sentry

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-07-25 22:28:09 +02:00
parent 0587ab26e8
commit 669329e49c
1 changed files with 3 additions and 0 deletions

View File

@ -3,6 +3,7 @@ from typing import Callable
from django.http.request import HttpRequest
from django.http.response import HttpResponse
from sentry_sdk.api import set_tag
from authentik.tenants.utils import get_tenant_for_request
@ -19,4 +20,6 @@ class TenantMiddleware:
if not hasattr(request, "tenant"):
tenant = get_tenant_for_request(request)
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)