Skip to content

[OPIK-5658] [FE] fix: align KPI metrics logsSource filter with traces table#6072

Merged
thiagohora merged 2 commits intomainfrom
thiagohora/OPIK-5658-fix-metrics-count-mismatch-traces-table-logs-page
Apr 4, 2026
Merged

[OPIK-5658] [FE] fix: align KPI metrics logsSource filter with traces table#6072
thiagohora merged 2 commits intomainfrom
thiagohora/OPIK-5658-fix-metrics-count-mismatch-traces-table-logs-page

Conversation

@thiagohora
Copy link
Copy Markdown
Contributor

@thiagohora thiagohora commented Apr 3, 2026

Details

On the Logs page (Traces tab), the metrics header was showing a trace count that didn't match what the table displayed. When a project had traces from non-SDK sources (e.g. playground, online evaluation), the metrics header counted all traces while the table filtered to SDK-only traces — causing the "Log your first trace" empty state to appear even though the header showed N traces.

The fix adds a logsSource prop to MetricsSummary and threads it through to useProjectKpiCards, which now passes it as an additional filter (alongside existing user filters) to the /kpi-cards endpoint. The TracesSpansTab passes LOGS_SOURCE.sdk so the metrics and table share the same filter scope. The prop is optional so other consumers of MetricsSummary are unaffected.

Change checklist

  • User facing
  • Documentation update

Issues

  • Resolves #
  • OPIK-5658

AI-WATERMARK

AI-WATERMARK: yes

  • If yes:
    • Tools: Claude Code
    • Model(s): claude-sonnet-4-6
    • Scope: full implementation
    • Human verification: code review + manual reproduction

Testing

  • Reproduced locally: project with playground traces shows count > 0 in metrics but "Log your first trace" in table
  • After fix: metrics header shows 0 for SDK-only filter, consistent with table
  • Verified FilterStrategy.TRACE supports TraceField.SOURCE with ENUM_LEGACY type (includes legacy unknown rows for sdk filter)
  • Lint: npm run lint — passed
  • Typecheck: pre-existing react-h5-audio-player type error unrelated to this change

Documentation

N/A — internal filter alignment, no user-facing documentation changes required.

@thiagohora thiagohora marked this pull request as ready for review April 3, 2026 09:17
@thiagohora thiagohora requested a review from a team as a code owner April 3, 2026 09:17
@thiagohora thiagohora merged commit 50cd343 into main Apr 4, 2026
10 checks passed
@thiagohora thiagohora deleted the thiagohora/OPIK-5658-fix-metrics-count-mismatch-traces-table-logs-page branch April 4, 2026 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants