发布

  • [OPIK-6850] [BE] feat: wire read-only ClickHouse client for Agent Insights freeform SQL behind a toggle (#7029)

    frostbyte_neo 发布于 2026-06-12 13:10:15 +00:00

    • Setup for readOnly user for arbitrary queries

    • address comments

    • fix(health): gate /is-alive/ping on critical checks only

    The /is-alive/ping endpoint ran all registered health checks and returned 500
    on any failure, ignoring the critical flag. A non-critical clickhouse-readonly
    failure (Agent Insights toggle on + RO user unhealthy) would therefore make the
    server look down to SDK/FE consumers, even though k8s probes (/health-check) were
    unaffected. IsAliveResource now gates liveness only on checks marked critical in
    the health config, falling back to all checks when none are configured.

    Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

    • refactor(agent-insights): address review — rename to free-form SQL, dedupe RO config, shared provisioning
    • Rename read-only identifiers to ClickHouseReadOnlyFreeFormSqlHealthCheck /
      readOnlyFreeFormSqlClickHouseClient / databaseAnalyticsReadOnlyFreeFormSql /
      clickhouse-readonly-freeform-sql (fixes HealthyCheck typo; feature-specific name).
    • Reduce config duplication: new DatabaseAnalyticsReadOnlyFreeFormSqlConfig holds only
      user/password; the RO client reuses databaseAnalytics connection params (drops the
      test-only RO overrides).
    • Move RO user provisioning into a single shared script
      (apps/opik-backend/provision_agent_insights_readonly_user.sh) used by both the
      docker-compose backend (after migrations, before app) and dev-runner; toggle-gated,
      default off. Removes the duplicated dev-runner DDL.
    • Add @NonNull validation on new ctor args; trim user-restriction details from comments;
      overload assertResponse in HealthCheckIntegrationTest.

    Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

    下载附件