Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Track Snowplow emit time as a `publish` phase in complexity scoring (#73283)

Chris Truter7a86f5c2032f
diff --git a/enterprise/backend/src/metabase_enterprise/data_complexity_score/complexity.clj b/enterprise/backend/src/metabase_enterprise/data_complexity_score/complexity.clj
index 4f6f80db944..5eb1958f9cc 100644
--- a/enterprise/backend/src/metabase_enterprise/data_complexity_score/complexity.clj
+++ b/enterprise/backend/src/metabase_enterprise/data_complexity_score/complexity.clj
@@ -483,11 +483,13 @@
embedding-model-meta (assoc :embedding-model embedding-model-meta)
text-variant (assoc :text-variant text-variant))}]
(log-scores! result)
- (let [published? (try
- (emit-snowplow! result)
- (catch Throwable t
- (log/warn t "Failed to publish complexity score to Snowplow")
- false))]
+ (let [published? (time-phase! "publish" "all"
+ (fn []
+ (try
+ (emit-snowplow! result)
+ (catch Throwable t
+ (log/warn t "Failed to publish complexity score to Snowplow")
+ false))))]
;; `emit-snowplow!` returns true only when every event reached the tracker (false when
;; Snowplow is disabled or any emission failed) — scheduler/boot callers gate
;; `data-complexity-scoring-last-fingerprint` on this so a disabled collector or any
diff --git a/src/metabase/analytics/prometheus.clj b/src/metabase/analytics/prometheus.clj
index 29bb6a2c87c..b7c4d98bc10 100644
--- a/src/metabase/analytics/prometheus.clj
+++ b/src/metabase/analytics/prometheus.clj
@@ -406,7 +406,7 @@
{:description "Duration (ms) of a full Data Complexity Score run end-to-end (enumerate + score for all three catalogs + Snowplow publish)."
:buckets [1 10 50 100 500 1000 5000 10000 30000 60000]})
(prometheus/histogram :metabase-data-complexity/phase-duration-ms
- {:description "Duration (ms) of one stage (`enumerate` = DB fetch, `score` = in-memory scoring) for one catalog within a Data Complexity Score run."
+ {:description "Duration (ms) of one stage (`enumerate` = DB fetch, `score` = in-memory scoring, `publish` = Snowplow emit) for one catalog within a Data Complexity Score run."
:labels [:stage :catalog]
:buckets [1 10 50 100 500 1000 5000 10000 30000 60000]})