opik icon indicating copy to clipboard operation
opik copied to clipboard

[OPIK-3209] [BE] Add span feedback scores filters to trace table

Open thiagohora opened this issue 1 month ago • 2 comments

Details

This PR adds backend support for filtering traces by span feedback scores. It includes:

  • Added SPAN_FEEDBACK_SCORES filter strategy to FilterQueryBuilder
  • Added binding for SPAN_FEEDBACK_SCORES in TraceDAO.bindSearchCriteria
  • Fixed indentation in getFieldsByStrategy method
  • Added comprehensive tests for span feedback score filtering (EQUAL, NOT_EQUAL, GREATER_THAN, LESS_THAN_EQUAL, IS_EMPTY)

The implementation follows the same pattern as trace-level feedback scores filtering, aggregating span feedback scores per trace and allowing filtering on the aggregated average values.

https://github.com/user-attachments/assets/f5739af2-7837-46fa-87e6-d19c8e6cc8df

Change checklist

  • [x] User facing
  • [ ] Documentation update

Issues

  • OPIK-3209

Testing

  • Added parameterized tests for span feedback score filtering with EQUAL, NOT_EQUAL, GREATER_THAN, LESS_THAN_EQUAL, and IS_EMPTY operators
  • All tests pass successfully
  • Tests verify that filtering works correctly on aggregated span feedback score averages

Documentation

  • No documentation updates required (backend-only change)

thiagohora avatar Nov 25 '25 19:11 thiagohora

SDK E2E Tests Results

0 tests   0 ✅  0s ⏱️ 0 suites  0 💤 0 files    0 ❌

Results for commit e46022f9.

:recycle: This comment has been updated with latest results.

github-actions[bot] avatar Nov 26 '25 09:11 github-actions[bot]

Backend Tests Results

  322 files  ±  0    322 suites  ±0   54m 28s ⏱️ + 5m 58s 5 762 tests +111  5 755 ✅ +111  7 💤 ±0  0 ❌ ±0  5 694 runs  + 55  5 687 ✅ + 55  7 💤 ±0  0 ❌ ±0 

Results for commit 46c7f577. ± Comparison against base commit 055b6755.

This pull request removes 10 and adds 121 tests. Note that renamed tests count towards both.
com.comet.opik.domain.llm.ModelCapabilitiesTest ‑ supportsVisionHandlesColonSuffixes
com.comet.opik.domain.llm.ModelCapabilitiesTest ‑ supportsVisionHandlesWhitespace
com.comet.opik.domain.llm.ModelCapabilitiesTest ‑ supportsVisionIsCaseInsensitive
com.comet.opik.domain.llm.ModelCapabilitiesTest ‑ supportsVisionMatchesModelWithoutProviderPrefix
com.comet.opik.domain.llm.ModelCapabilitiesTest ‑ supportsVisionReturnsFalseForBlankModelName
com.comet.opik.domain.llm.ModelCapabilitiesTest ‑ supportsVisionReturnsFalseForNonVisionModelVariations
com.comet.opik.domain.llm.ModelCapabilitiesTest ‑ supportsVisionReturnsFalseForNonVisionModels
com.comet.opik.domain.llm.ModelCapabilitiesTest ‑ supportsVisionReturnsFalseForUnknownModels
com.comet.opik.domain.llm.ModelCapabilitiesTest ‑ supportsVisionReturnsTrueForKnownVisionModels
com.comet.opik.domain.llm.ModelCapabilitiesTest ‑ supportsVisionReturnsTrueForModelsThatMatchVisionPattern
com.comet.opik.api.resources.v1.priv.GetTracesByProjectResourceTest$FilterTest ‑ getTracesByProject__whenFilterSpanFeedbackScoresIsEmpty__thenReturnTracesFiltered(Operator, Function, Function, TracePageTestAssertion)[1]
com.comet.opik.api.resources.v1.priv.GetTracesByProjectResourceTest$FilterTest ‑ getTracesByProject__whenFilterSpanFeedbackScoresIsEmpty__thenReturnTracesFiltered(Operator, Function, Function, TracePageTestAssertion)[2]
com.comet.opik.api.resources.v1.priv.GetTracesByProjectResourceTest$FilterTest ‑ getTracesByProject__whenFilterSpanFeedbackScoresIsEmpty__thenReturnTracesFiltered(Operator, Function, Function, TracePageTestAssertion)[3]
com.comet.opik.api.resources.v1.priv.GetTracesByProjectResourceTest$FilterTest ‑ getTracesByProject__whenFilterSpanFeedbackScoresIsEmpty__thenReturnTracesFiltered(Operator, Function, Function, TracePageTestAssertion)[4]
com.comet.opik.api.resources.v1.priv.GetTracesByProjectResourceTest$FilterTest ‑ getTracesByProject__whenFilterSpanFeedbackScoresIsEmpty__thenReturnTracesFiltered(Operator, Function, Function, TracePageTestAssertion)[5]
com.comet.opik.api.resources.v1.priv.GetTracesByProjectResourceTest$FilterTest ‑ getTracesByProject__whenFilterSpanFeedbackScoresIsEmpty__thenReturnTracesFiltered(Operator, Function, Function, TracePageTestAssertion)[6]
com.comet.opik.api.resources.v1.priv.GetTracesByProjectResourceTest$FilterTest ‑ whenFilterInvalidOperatorForFieldType__thenReturn400(String, TraceFilter)[463]
com.comet.opik.api.resources.v1.priv.GetTracesByProjectResourceTest$FilterTest ‑ whenFilterInvalidOperatorForFieldType__thenReturn400(String, TraceFilter)[464]
com.comet.opik.api.resources.v1.priv.GetTracesByProjectResourceTest$FilterTest ‑ whenFilterInvalidOperatorForFieldType__thenReturn400(String, TraceFilter)[465]
com.comet.opik.api.resources.v1.priv.GetTracesByProjectResourceTest$FilterTest ‑ whenFilterInvalidOperatorForFieldType__thenReturn400(String, TraceFilter)[466]
…

:recycle: This comment has been updated with latest results.

github-actions[bot] avatar Nov 26 '25 09:11 github-actions[bot]

🔄 Test environment deployment started

Building images for PR #4226...

You can monitor the build progress here.

github-actions[bot] avatar Dec 01 '25 09:12 github-actions[bot]

Test environment is now available!

Access Information

  • URL: https://pr-4226.dev.comet.com
  • Cluster: comet-ml-development
  • Namespace: pr-4226
  • Version: 1.9.34-4226-merge-600
  • Application logs: View in Grafana

The deployment has completed successfully and the version has been verified.

CometActions avatar Dec 01 '25 09:12 CometActions