Skip to content

: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.

fix(experiments): force experiment metric recalculations to use the online workload for experiment queries (#93783)

Rodrigo Ilorod7b8a16d9dfc
diff --git a/products/experiments/backend/recalculation.py b/products/experiments/backend/recalculation.py
index 5143973d5eb2..877e681f85d1 100644
--- a/products/experiments/backend/recalculation.py
+++ b/products/experiments/backend/recalculation.py
@@ -146,7 +146,7 @@ def get_live_query_progress(recalc: ExperimentMetricsRecalculation) -> dict | No
SETTINGS skip_unavailable_shards=1, max_execution_time=2
""",
{"cluster": CLICKHOUSE_CLUSTER, "prefix": prefix, "since": int(since.timestamp())},
- workload=Workload.OFFLINE,
+ workload=Workload.ONLINE,
team_id=recalc.team_id,
)
except Exception:
diff --git a/products/experiments/backend/temporal/recalculation_logic.py b/products/experiments/backend/temporal/recalculation_logic.py
index ee3c423d5398..bad3deac72f8 100644
--- a/products/experiments/backend/temporal/recalculation_logic.py
+++ b/products/experiments/backend/temporal/recalculation_logic.py
@@ -664,7 +664,7 @@ def _calculate_experiment_metric_for_recalculation_sync(
query=ExperimentQuery(experiment_id=experiment_id, metric=build_metric(metric_dict)),
team=experiment.team,
as_of=query_to_dt,
- workload=Workload.OFFLINE,
+ workload=Workload.ONLINE,
# Userless background recompute. Warehouse access is enforced when the metric is authored,
# so resolve warehouse tables here instead of failing closed.
bypass_warehouse_access_control=True,