Skip to content

Conversation

@BorisTkachenko
Copy link
Contributor

@BorisTkachenko BorisTkachenko commented Dec 5, 2025

Details

This PR adds percentile aggregation methods (p50, p90, p99) for numerical metrics in experiment items table headers, extending the existing pattern used for duration to cost, feedback scores, and total tokens.

Screenshot 2025-12-05 at 15 49 27

Backend Changes

  • Extended ClickHouse query in DatasetItemDAO to compute percentiles for:
    • Total estimated cost (p50, p90, p99)
    • Feedback scores by name (p50, p90, p99 per score)
    • Usage total tokens (p50, p90, p99)
  • Added new StatsMapper methods to process and format percentile data
  • Added constants for new percentile fields in StatsMapper

Frontend Changes

  • Enhanced HeaderStatistic component to support both avg and percentile displays in a unified dropdown
  • Modified HeaderWrapper to pass both avg and percentile statistics to headers
  • Updated ExperimentItemsTab to include statisticKey for cost and total tokens columns
  • Added visual separator in dropdown between avg/sum options and percentiles
  • Implemented automatic selection of default value based on statistic type

Testing

  • Updated DatasetsResourceTest with comprehensive percentile assertions
  • Added test data with specific cost and token values for predictable percentile calculations
  • Verified all three test scenarios properly calculate and assert percentiles

Change checklist

  • User facing
  • Documentation update

Issues

  • Resolves #
  • OPIK-2679

Testing

Backend Tests

  • DatasetsResourceTest includes three comprehensive test scenarios verifying p50, p90, p99 values match expected quantiles

Manual Testing

  1. Navigate to experiment items comparison view
  2. Click on cost, feedback score, or total tokens column headers
  3. Verify dropdown shows: avg, sum (for tokens), and percentile options (p50, p90, p99)
  4. Select different aggregation methods and verify correct values display
  5. Confirm percentile calculations match backend data

Documentation

N/A - This is an internal UI/API enhancement that follows existing patterns. No external documentation updates required.

Copilot AI review requested due to automatic review settings December 5, 2025 14:43
@BorisTkachenko BorisTkachenko requested a review from a team as a code owner December 5, 2025 14:43
@github-actions github-actions bot added java Pull requests that update Java code Frontend Backend tests Including test files, or tests related like configuration. typescript *.ts *.tsx labels Dec 5, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds percentile aggregation methods (p50, p90, p99) for numerical metrics in experiment items, extending the existing pattern from duration to cost, feedback scores, and total tokens.

Key changes:

  • Backend adds percentile calculations in ClickHouse queries for cost, feedback scores, and tokens
  • Frontend enhances the header statistics component to display both averages and percentiles in a unified dropdown
  • Test coverage updated to verify percentile calculations across all scenarios

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
HeaderWrapper.tsx Filters statistics to separate AVG and PERCENTAGE types, passing both to HeaderStatistic
HeaderStatistic.tsx Refactored to support unified dropdown with avg/sum and percentile options based on available data
ExperimentItemsTab.tsx Added statisticKey properties to cost and total tokens columns
DatasetsResourceTest.java Added comprehensive test data and assertions for percentile calculations
StatsMapper.java Added helper methods to process and format percentile data from ClickHouse
DatasetItemDAO.java Extended ClickHouse query to compute percentiles for cost, feedback scores, and tokens

@BorisTkachenko BorisTkachenko added the test-environment Deploy Opik adhoc environment label Dec 5, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2025

🔄 Test environment deployment started

Building images for PR #4366...

You can monitor the build progress here.

@BorisTkachenko BorisTkachenko marked this pull request as draft December 5, 2025 14:49
@CometActions
Copy link
Collaborator

Test environment is now available!

Access Information

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

@BorisTkachenko BorisTkachenko marked this pull request as ready for review December 5, 2025 15:00
@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2025

Backend Tests Results

  356 files    356 suites   52m 42s ⏱️
6 017 tests 6 010 ✅ 7 💤 0 ❌
5 927 runs  5 920 ✅ 7 💤 0 ❌

Results for commit aad4ed5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backend Frontend java Pull requests that update Java code test-environment Deploy Opik adhoc environment tests Including test files, or tests related like configuration. typescript *.ts *.tsx

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants