Skip to content

armgit / meet

Public Imported from GitHub
0

Open source video conferencing app powered by LiveKit. Built with Django and React.

✨(summary) add hostname to analytics properties

Florent Chehabcec2eb5a10fe
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7ff7947b..2a086cd7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -56,6 +56,7 @@ and this project adheres to
- πŸ”₯(frontend) drop unused vendored ConnectionObserver
- πŸ›(frontend) vendor formatChatMessageLinks and trim surrounding newlines
+- ✨(summary) add hostname to analytics properties
### Fixed
diff --git a/src/summary/summary/core/analytics.py b/src/summary/summary/core/analytics.py
index c1a9391e..d4f40c20 100644
--- a/src/summary/summary/core/analytics.py
+++ b/src/summary/summary/core/analytics.py
@@ -1,9 +1,10 @@
"""Analytics classes."""
import json
+import socket
import time
from collections import Counter
-from functools import lru_cache
+from functools import cached_property, lru_cache
from urllib.parse import urlsplit, urlunsplit
import redis
@@ -33,6 +34,10 @@ class Analytics:
logger.info("Initialize analytics client")
self._client = Posthog(settings.posthog_api_key, settings.posthog_api_host)
+ @cached_property
+ def _hostname(self):
+ return socket.gethostname()
+
@property
def is_disabled(self):
"""Check if analytics client is disabled or not configured."""
@@ -43,6 +48,8 @@ class Analytics:
if self.is_disabled:
return
+ properties = {**(properties or {}), "_hostname": self._hostname}
+
try:
self._client.capture(
event_name, distinct_id=distinct_id, properties=properties