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.

chore(batch-exports): Update histogram buckets (#65744)

Tomás Farías Santana32541be6bae3
diff --git a/posthog/temporal/common/worker.py b/posthog/temporal/common/worker.py
index fbb18bc26b42..236b6a907fa8 100644
--- a/posthog/temporal/common/worker.py
+++ b/posthog/temporal/common/worker.py
@@ -82,6 +82,7 @@ BATCH_EXPORTS_LATENCY_HISTOGRAM_METRICS = (
"batch_exports_activity_interval_execution_latency",
"batch_exports_workflow_interval_execution_latency",
)
+# Unit: ms
BATCH_EXPORTS_LATENCY_HISTOGRAM_BUCKETS = [
1_000.0,
30_000.0, # 30 seconds
@@ -95,6 +96,23 @@ BATCH_EXPORTS_LATENCY_HISTOGRAM_BUCKETS = [
86_400_000.0, # 24 hours
]
+BATCH_EXPORTS_FAST_LATENCY_HISTOGRAM_METRICS = ("batch_exports_queue_wait_time",)
+# Unit: ns
+BATCH_EXPORTS_FAST_LATENCY_HISTOGRAM_BUCKETS = [
+ 1_000_000.0, # 1 ms
+ 5_000_000.0, # 5 ms
+ 10_000_000.0, # 10 ms
+ 100_000_000.0, # 100 ms
+ 500_000_000.0, # 500 ms
+ 1_000_000_000.0, # 1 s
+ 5_000_000_000.0, # 5 s
+ 10_000_000_000.0, # 10 s
+ 30_000_000_000.0, # 30 s
+ 60_000_000_000.0, # 1 min
+ 300_000_000_000.0, # 5 min
+ 600_000_000_000.0, # 10 min
+]
+
EVALS_LATENCY_HISTOGRAM_METRICS = (
"llma_eval_activity_execution_latency",
"llma_eval_workflow_execution_latency",
@@ -253,6 +271,12 @@ async def create_worker(
itertools.repeat(BATCH_EXPORTS_LATENCY_HISTOGRAM_BUCKETS),
)
)
+ | dict(
+ zip(
+ BATCH_EXPORTS_FAST_LATENCY_HISTOGRAM_METRICS,
+ itertools.repeat(BATCH_EXPORTS_FAST_LATENCY_HISTOGRAM_BUCKETS),
+ )
+ )
| dict(zip(EVALS_LATENCY_HISTOGRAM_METRICS, itertools.repeat(EVALS_LATENCY_HISTOGRAM_BUCKETS)))
| dict(zip(SUMMARIZATION_LATENCY_HISTOGRAM_METRICS, itertools.repeat(SUMMARIZATION_LATENCY_HISTOGRAM_BUCKETS)))
| dict(zip(CLUSTERING_LATENCY_HISTOGRAM_METRICS, itertools.repeat(CLUSTERING_LATENCY_HISTOGRAM_BUCKETS)))