Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@shuyangli
Copy link
Member

@shuyangli shuyangli commented Dec 8, 2025

The frontend "curated inference" queries are actually counting inferences with some specific metric/feedback criteria, so I put them all in InferenceStats.

This adds a new GET /internal/functions/{function_name}/inference-stats/{metric_name} route to the gateway to allow querying the number of feedback metrics and the number of inferences matching the metric, and changes the frontend to call this route instead.

Fixes #5064
A step towards #5062


Important

Adds a new API endpoint to fetch inference statistics with feedback metrics, updates backend logic, and refactors frontend to use the new endpoint.

  • API Changes:
    • Adds GET /internal/functions/{function_name}/inference-stats/{metric_name} route in internal.rs for fetching inference stats with feedback metrics.
    • Implements get_inference_with_feedback_stats_handler() in inference_stats.rs to handle the new route.
  • Backend Logic:
    • Introduces InferenceWithFeedbackStatsResponse type in InferenceWithFeedbackStatsResponse.ts.
    • Implements build_count_metric_feedbacks_query() and build_count_demonstration_feedbacks_query() in inference_stats.rs for querying feedback metrics.
    • Refactors ClickHouseConnectionInfo to implement InferenceStatsQueries trait for feedback metrics.
  • Frontend Updates:
    • Updates count.route.ts to use getInferenceStats() and getFeedbackStats() from tensorzero.server.
    • Removes old ClickHouse query functions from curation.server.ts.
  • Testing:
    • Adds E2E tests in inference_stats.rs for new API endpoints.
    • Updates unit tests in tensorzero.test.ts to cover new client methods.

This description was created by Ellipsis for 6e1a010. You can customize this summary. It will automatically update as commits are pushed.

Base automatically changed from sl/delete-unused-ui-code to main December 8, 2025 23:53
@shuyangli shuyangli force-pushed the sl/port-count-curated-clickhouse-queries branch 2 times, most recently from ee04630 to 2142e36 Compare December 9, 2025 15:56
@shuyangli shuyangli force-pushed the sl/port-count-curated-clickhouse-queries branch from 2142e36 to 882cf32 Compare December 9, 2025 16:08
@shuyangli shuyangli changed the title [Stacked] Port useCountFetcher clickhouse queries to gateway Port useCountFetcher clickhouse queries to gateway Dec 9, 2025
@shuyangli shuyangli changed the title Port useCountFetcher clickhouse queries to gateway Port "curated inference" clickhouse queries to gateway Dec 9, 2025
@shuyangli shuyangli force-pushed the sl/port-count-curated-clickhouse-queries branch 8 times, most recently from 8c21dbb to 453c08a Compare December 9, 2025 20:34
@shuyangli shuyangli marked this pull request as ready for review December 9, 2025 20:34
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@graphite-app
Copy link

graphite-app bot commented Dec 9, 2025

Merge activity

  • Dec 9, 8:59 PM UTC: This pull request can not be added to the Graphite merge queue. Please try rebasing and resubmitting to merge when ready.
  • Dec 9, 8:59 PM UTC: Graphite disabled "merge when ready" on this PR due to: a merge conflict with the target branch; resolve the conflict and try again..

@shuyangli shuyangli mentioned this pull request Dec 9, 2025
52 tasks
@shuyangli shuyangli force-pushed the sl/port-count-curated-clickhouse-queries branch from 453c08a to 45fa9d4 Compare December 9, 2025 21:07
@shuyangli shuyangli force-pushed the sl/port-count-curated-clickhouse-queries branch from 45fa9d4 to fb950c4 Compare December 9, 2025 21:08
@shuyangli shuyangli enabled auto-merge December 9, 2025 21:08
@shuyangli
Copy link
Member Author

Ready for review, failing test is flaky and is being fixed at head

GabrielBianconi
GabrielBianconi previously approved these changes Dec 9, 2025
@GabrielBianconi GabrielBianconi removed their assignment Dec 9, 2025
@shuyangli shuyangli added this pull request to the merge queue Dec 9, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 10, 2025
@shuyangli
Copy link
Member Author

/merge-queue

@shuyangli shuyangli enabled auto-merge December 10, 2025 04:45
@github-actions
Copy link
Contributor

🚀 Merge queue workflow triggered!

View the run: https://github.com/tensorzero/tensorzero/actions/runs/20087632451

Copy link
Member

@virajmehta virajmehta left a comment

Choose a reason for hiding this comment

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

blind

@shuyangli shuyangli added this pull request to the merge queue Dec 10, 2025
github-merge-queue bot pushed a commit that referenced this pull request Dec 10, 2025
* Port inference curation clickhouse queries to Rust

Unify

* Rewrite tests for e2e fixtures
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 10, 2025
@shuyangli shuyangli added this pull request to the merge queue Dec 10, 2025
github-merge-queue bot pushed a commit that referenced this pull request Dec 10, 2025
* Port inference curation clickhouse queries to Rust

Unify

* Rewrite tests for e2e fixtures
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 10, 2025
@shuyangli shuyangli added this pull request to the merge queue Dec 10, 2025
Merged via the queue into main with commit f21e910 Dec 10, 2025
61 checks passed
@shuyangli shuyangli deleted the sl/port-count-curated-clickhouse-queries branch December 10, 2025 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port useCountFetcher to gateway

4 participants