From 13c75697c75ab1f0e807ef43185c4048102ba95f Mon Sep 17 00:00:00 2001 From: Florent Chehab Date: Fri, 14 Aug 2026 14:39:06 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8(summary)=20add=20hostname=20to=20anal?= =?UTF-8?q?ytics=20properties?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This helps track down what was the source of events. This can be usefull when checking perf of different workers for instance. --- CHANGELOG.md | 1 + src/summary/summary/core/analytics.py | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f28a591..9bbc8e36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/summary/summary/core/analytics.py b/src/summary/summary/core/analytics.py index c1a9391e..132dd1f5 100644 --- a/src/summary/summary/core/analytics.py +++ b/src/summary/summary/core/analytics.py @@ -1,6 +1,7 @@ """Analytics classes.""" import json +import socket import time from collections import Counter from functools import lru_cache @@ -43,6 +44,11 @@ class Analytics: if self.is_disabled: return + # We add hostname to help track down the source of events + properties = properties or {} + if not properties.get("hostname"): + properties = {**properties, "hostname": socket.gethostname()} + try: self._client.capture( event_name, distinct_id=distinct_id, properties=properties