(backend) track meeting link generation events

Track events whenever a new meeting link is generated, both through
the public API and through the external API.

The goal is twofold:

* Identify where the most links are generated from, so we can assess
  which integration or entry point works best.
* Measure how many links are generated per user, so we can consider
  a user truly active when they generate a link, rather than only
  when they participate in a meeting.
This commit is contained in:
lebaudantoine
2026-07-01 18:57:57 +02:00
committed by aleb_the_flash
parent d2bfbee389
commit 657712d7cb
+16 -2
View File
@@ -19,7 +19,7 @@ from rest_framework import (
status as drf_status,
)
from core import api, models
from core import analytics, api, models
from core.api.feature_flag import FeatureFlag
from core.services.jwt_token import JwtTokenService
@@ -194,12 +194,26 @@ class RoomViewSet(
role=models.RoleChoices.OWNER,
)
auth_method = type(self.request.successful_authenticator).__name__
client_id = (self.request.auth or {}).get("client_id", "unknown")
# Log for auditing
logger.info(
"Room created via application: room_id=%s, user_id=%s, client_id=%s",
"Room created via application: room_id=%s, user_id=%s, client_id=%s, auth_method=%s",
room.id,
self.request.user.id,
client_id,
auth_method,
)
analytics.capture(
self.request.user,
analytics.AnalyticsEvent.ROOM_CREATED,
{
"room_id": str(room.pk),
"access_level": room.access_level,
"client_id": client_id,
"external_api": True,
"auth_method": auth_method,
},
)