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.

feat(web-analytics): make warm team concurrency launch-configurable (#70617)

Lucas Ricoybcea1e0a5f80
diff --git a/products/web_analytics/dags/eager_web_analytics_precompute.py b/products/web_analytics/dags/eager_web_analytics_precompute.py
index 5d15921793ed..bc6e93053911 100644
--- a/products/web_analytics/dags/eager_web_analytics_precompute.py
+++ b/products/web_analytics/dags/eager_web_analytics_precompute.py
@@ -436,6 +436,13 @@ class EagerWarmConfig(dagster.Config):
# stable team set - a 24h window shifts between chunks and can drop the unwarmed
# tail of the previous run.
active_lookback_hours: int = pydantic.Field(default=24, ge=1, le=168)
+ # Per-team warm concurrency. The insert SELECTs execute on the shared offline
+ # tier, so raising this raises pressure there, not on aux - only go above the
+ # default when offline CPU is quiet (<~40% avg), and watch for 202
+ # TOO_MANY_SIMULTANEOUS_QUERIES, which is the tier's concurrency ceiling biting.
+ # None = use WARM_TEAM_CONCURRENCY (resolved at run time, so tests patching the
+ # constant still control the pool).
+ team_concurrency: int | None = pydantic.Field(default=None, ge=1, le=25)
@dagster.op
@@ -581,7 +588,7 @@ def warm_eager_baseline_op(context: dagster.OpExecutionContext, config: EagerWar
)
return team_warmed, team_failed
- with ThreadPoolExecutor(max_workers=WARM_TEAM_CONCURRENCY) as pool:
+ with ThreadPoolExecutor(max_workers=config.team_concurrency or WARM_TEAM_CONCURRENCY) as pool:
for team_warmed, team_failed in pool.map(_warm, eligible):
warmed += team_warmed
failed += team_failed