发布

  • [OPIK-6853] [BE] Daily Agent Insights report cron + bounded Redis trigger queue (#7105)

    frostbyte_neo 发布于 2026-06-22 07:54:39 +00:00

    Daily cron triggers Agent Insights reports for enabled projects that had traces the
    previous UTC day; manual /trigger and the cron enqueue onto a bounded Redis stream and a
    consumer group does the actual platform call (PlatformAgentInsightsReportClient ->
    POST /opik/ollie/generate-agent-insights).

    Review (Boris):

    • triggerUrl has a config default (react-svc); single gate is the Agent Insights toggle
      (no client isEnabled() check). ServiceTogglesConfig injected via @Config.
    • One trace query for the whole sweep via an exact (workspace_id, project_id) tuple-IN
      (TraceService.getProjectsWithTracesInRange(List, ...)); findAllEnabled INNER JOINs
      projects; no last_triggered_at marker. Schedule/lock-wait/timeout env-configurable.
    • Platform payload is a typed record (AgentInsightsTriggerRequest), not a generic Map.
    • migration 000085 aligns agent_insights_jobs collation with the schema.
    • Tests consolidated into AgentInsightsJobsResourceTest (dropped the dedicated trigger class).

    Co-authored-by: Claude Opus 4.8 noreply@anthropic.com

    下载附件