:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(experiments): derive canary metric types from builder registry (#113034)
Juraj Majerikc4fd7c3936ef
diff --git a/products/experiments/backend/temporal/canary_logic.py b/products/experiments/backend/temporal/canary_logic.pyindex e731d0b6ba6e..32b8d9a3ee9b 100644--- a/products/experiments/backend/temporal/canary_logic.py+++ b/products/experiments/backend/temporal/canary_logic.py@@ -57,6 +57,7 @@ from posthog.models.scoping import team_scopefrom products.experiments.backend.hogql_queries.experiment_query_runner import ExperimentQueryRunnerfrom products.experiments.backend.metric_resolution import (+ METRIC_BUILDERS,ExperimentMetric,build_metric,find_metric_dict,@@ -104,8 +105,9 @@ MIN_CORRECTNESS_SUM_DELTA = 100.0MIN_EXPOSURES_PER_VARIANT = 100# Metric types that use the precompute path: all of them read precomputed exposures, and funnel,-# mean, and retention also read precomputed metric events when eligible.-ELIGIBLE_METRIC_TYPES = ("funnel", "mean", "ratio", "retention")+# mean, and retention also read precomputed metric events when eligible. Derived from the runner's+# builder registry so a new buildable type is sampled automatically instead of silently uncovered.+ELIGIBLE_METRIC_TYPES = frozenset(METRIC_BUILDERS)# Experiments must have been running this long to be sampled — comfortably past the runner's 12h# precomputation gate, with enough accumulated exposures for the comparison to be meaningful.