Compare commits

...

2 Commits

Author SHA1 Message Date
Florent Chehab 1395db77ca fixup! (summary) add hostname to analytics properties 2026-08-20 10:41:56 +02:00
Florent Chehab 13c75697c7 (summary) add hostname to analytics properties
This helps track down what was the source of events.
This can be usefull when checking perf of different workers for instance.
2026-08-14 14:45:18 +02:00
2 changed files with 9 additions and 1 deletions
+1
View File
@@ -12,6 +12,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
+8 -1
View File
@@ -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