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(aio): stagger the eval report trigger and keep rolling windows (#106991)

Sandy Spicere9ab83738d39
diff --git a/posthog/temporal/ai_observability/eval_reports/schedule.py b/posthog/temporal/ai_observability/eval_reports/schedule.py
index 44f5497bf75a..901b6b704789 100644
--- a/posthog/temporal/ai_observability/eval_reports/schedule.py
+++ b/posthog/temporal/ai_observability/eval_reports/schedule.py
@@ -7,6 +7,7 @@ from django.conf import settings
from temporalio.client import Client, Schedule, ScheduleActionStartWorkflow, ScheduleIntervalSpec, ScheduleSpec
+from posthog.scheduling.jitter import deterministic_offset
from posthog.temporal.ai_observability.eval_reports.constants import (
CHECK_COUNT_TRIGGERED_REPORTS_WORKFLOW_NAME,
COUNT_TRIGGER_SCHEDULE_ID,
@@ -47,7 +48,14 @@ async def create_count_trigger_schedule(client: Client):
id=COUNT_TRIGGER_SCHEDULE_ID,
task_queue=settings.LLMA_TASK_QUEUE,
),
- spec=ScheduleSpec(intervals=[ScheduleIntervalSpec(every=timedelta(minutes=5))]),
+ spec=ScheduleSpec(
+ intervals=[
+ ScheduleIntervalSpec(
+ every=timedelta(minutes=5),
+ offset=deterministic_offset(COUNT_TRIGGER_SCHEDULE_ID, timedelta(minutes=5)),
+ )
+ ]
+ ),
)
if await a_schedule_exists(client, COUNT_TRIGGER_SCHEDULE_ID):