From 81b1b253f16f065fb771dec7310e0ce691869de8 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 1 Apr 2026 11:49:50 +0200 Subject: [PATCH] :sparkles: Add unique email domains to telemetry report (#8819) Extend the telemetry payload with a sorted list of unique email domains extracted from all registered profile email addresses. The new :email-domains field is populated via a single SQL query using split_part and DISTINCT, and is included in the stats sent when telemetry is enabled. Also update the tasks-telemetry-test to assert the new field is present and contains the expected domain values. --- backend/src/app/tasks/telemetry.clj | 9 ++++++++- backend/test/backend_tests/tasks_telemetry_test.clj | 4 +++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/backend/src/app/tasks/telemetry.clj b/backend/src/app/tasks/telemetry.clj index dd0d42c4c6..aa2cae58e0 100644 --- a/backend/src/app/tasks/telemetry.clj +++ b/backend/src/app/tasks/telemetry.clj @@ -129,6 +129,12 @@ (->> [sql:team-averages] (db/exec-one! conn))) +(defn- get-email-domains + [conn] + (let [sql "SELECT DISTINCT split_part(email, '@', 2) AS domain FROM profile ORDER BY 1"] + (->> (db/exec! conn [sql]) + (mapv :domain)))) + (defn- get-enabled-auth-providers [conn] (let [sql (str "SELECT auth_backend AS backend, count(*) AS total " @@ -192,7 +198,8 @@ :total-fonts (get-num-fonts conn) :total-comments (get-num-comments conn) :total-file-changes (get-num-file-changes conn) - :total-touched-files (get-num-touched-files conn)} + :total-touched-files (get-num-touched-files conn) + :email-domains (get-email-domains conn)} (merge (get-team-averages conn) (get-jvm-stats) diff --git a/backend/test/backend_tests/tasks_telemetry_test.clj b/backend/test/backend_tests/tasks_telemetry_test.clj index bc1b2b06ef..c6edf381af 100644 --- a/backend/test/backend_tests/tasks_telemetry_test.clj +++ b/backend/test/backend_tests/tasks_telemetry_test.clj @@ -42,4 +42,6 @@ (t/is (contains? data :avg-files-on-project)) (t/is (contains? data :max-projects-on-team)) (t/is (contains? data :avg-files-on-project)) - (t/is (contains? data :version)))))) + (t/is (contains? data :version)) + (t/is (contains? data :email-domains)) + (t/is (= ["nodomain.com"] (:email-domains data)))))))