发布

  • [OPIK-6026] [BE] fix: StatsClient and BiEventListener allow events when analytics OR usage-report is enabled (#6368)

    frostbyte_neo 发布于 2026-04-19 16:55:40 +00:00

    StatsClient.sendEvent and BiEventListener.onTracesCreated previously
    short-circuited whenever usageReport.enabled was false, which dropped
    every event from AnalyticsService even when analytics.enabled was true.

    • StatsClient: send when usageReport.enabled OR analytics.enabled is
      true; keep completedFuture(false) + log when both are disabled.
    • BiEventListener.onTracesCreated: skip only when both flags are
      disabled; gate the opik_os_first_trace_created BI reporting on
      usageReport.enabled so it stays off when only analytics is on.

    Per-stream gates elsewhere (DailyUsageReportJob, InstallationReport
    Service, WelcomeWizardEventListener) and AnalyticsServiceImpl's own
    analytics.enabled check at source are unchanged, so:

    • analytics only -> product analytics (opik_*) events flow
    • usage-report only -> self-hosted BI (opik_os_*) events flow
    • both enabled -> both streams flow
    • both disabled -> nothing flows

    Added BiEventListenerAnalyticsOnlyTest covering the analytics-only
    configuration; existing BiEventListenerTest still covers the both-on
    path.

    Co-authored-by: Claude Opus 4.7 (1M context) noreply@anthropic.com

    下载附件