Skip to content

Workspace-level feedback-score metrics never include online-scoring (authored) scores — WorkspaceMetricsDAO reads only legacy feedback_scores #7693

Description

@macblackstuff

Component: Opik Server

Opik version: 2.2.13 (self-hosted, docker-compose deployment); also verified present at current HEAD (2.2.14-6215, commit d6c2776)

Describe the problem

Feedback scores written by online scoring (automation rule LLM-as-judge evaluators) never appear in workspace-level feedback-score metrics — summary and daily time-series both return empty, so score trends cannot be charted at workspace scope, even though the scores exist and are visible per-trace/per-span.

Root cause (from source at tag 2.2.13):

  • The score write path is author-aware: FeedbackScoreDAOImpl.BULK_INSERT_FEEDBACK_SCORE (apps/opik-backend/.../FeedbackScoreDAO.java:81-120) renders INSERT INTO <if(author)>authored_feedback_scores<else>feedback_scores<endif>(...). The online-scoring consumer always sets an author (OnlineScoringBaseScorer.java:121-130), so all online-scoring rows land in authored_feedback_scores.
  • Project-level metrics correctly UNION ALL both tables (ProjectMetricsDAO.java:164-206, SpanMetricsQueries.java:20-149) — these return the data fine.
  • Workspace-level metrics read only the legacy table: WorkspaceMetricsDAOImpl.GET_FEEDBACK_SCORES_SUMMARY (WorkspaceMetricsDAO.java:78-98) and GET_FEEDBACK_SCORES_DAILY / GET_FEEDBACK_SCORES_DAILY_BY_PROJECT (WorkspaceMetricsDAO.java:115-185) use FROM feedback_scores fs final with no authored_feedback_scores branch.
  • No materialized view or migration folds authored_feedback_scoresfeedback_scores (checked the analytics Liquibase changelogs through 000090), so on a deployment where all scores are online-scoring-authored, feedback_scores has 0 rows and workspace score metrics are permanently empty.

Diffing FeedbackScoreDAO.java, WorkspaceMetricsDAO.java, and ProjectMetricsDAO.java between 2.2.13 and current HEAD shows no change — the gap is still present upstream.

Reproduction steps

  1. Self-host Opik 2.2.13. Create an automation rule (LLM-as-judge, span scope) on a project; let it score some spans (source = online_scoring rows appear in ClickHouse opik.authored_feedback_scores; opik.feedback_scores stays at 0 rows).
  2. POST /v1/private/projects/{projectId}/metrics with {"metric_type":"SPAN_FEEDBACK_SCORES","interval":"DAILY",...}returns data (unioned read).
  3. Call the workspace feedback-score summary/daily endpoints (WorkspacesResource) for the same window → empty for every score name.

Expected: workspace-level feedback-score metrics include authored (online-scoring) scores, consistent with the project-level queries.

Suggested fix: mirror the UNION ALL feedback_scores / authored_feedback_scores + dedup pattern already used in ProjectMetricsDAO/SpanMetricsQueries in the three WorkspaceMetricsDAO queries.

Error logs or stack trace

None — no errors anywhere; the queries simply read a table the write path no longer populates.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions