Skip to content

set up tools for variant statistics view#7235

Merged
AntoineToussaint merged 10 commits intomainfrom
viraj/variant-stats-tool
Apr 13, 2026
Merged

set up tools for variant statistics view#7235
AntoineToussaint merged 10 commits intomainfrom
viraj/variant-stats-tool

Conversation

@virajmehta
Copy link
Copy Markdown
Member

@virajmehta virajmehta commented Apr 8, 2026

Note

Medium Risk
Adds a new internal HTTP endpoint and cross-database query path (ClickHouse + Postgres) for aggregated variant statistics, including new parameter parsing and query construction that could affect observability/analytics correctness.

Overview
Adds a new get_variant_statistics capability end-to-end: an internal GET /internal/variant_statistics route, a corresponding Autopilot SimpleTool, and TS bindings for the new request/response shapes.

Implements VariantStatisticsQueries in tensorzero-core with ClickHouse and Postgres backends (including optional variant_names and after/before time filtering, and ClickHouse-only latency quantiles), wires it through DelegatingDatabaseConnection, and exposes it via the durable-tools TensorZeroClient in both HTTP-gateway and embedded modes (with RFC3339 parsing in embedded mode).

Reviewed by Cursor Bugbot for commit 3cb0431. Bugbot is set up for automated code reviews on this repo. Configure here.

@virajmehta virajmehta self-assigned this Apr 8, 2026
Comment thread crates/tensorzero-core/src/db/clickhouse/variant_statistics.rs Outdated
Copy link
Copy Markdown

@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.

Reviewed commit: eb33c7438b

ℹ️ 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".

Comment thread crates/tensorzero-core/src/db/clickhouse/variant_statistics.rs Outdated
@virajmehta virajmehta assigned Aaron1011 and unassigned virajmehta Apr 8, 2026
Comment thread crates/autopilot-tools/src/tools/prod/get_variant_statistics.rs Outdated
Comment thread crates/durable-tools/src/tensorzero_client/client_ext.rs
Comment thread crates/tensorzero-core/src/db/clickhouse/variant_statistics.rs Outdated
Comment thread crates/tensorzero-core/src/db/clickhouse/variant_statistics.rs Outdated
Comment thread crates/tensorzero-core/src/db/clickhouse/variant_statistics.rs Outdated
@Aaron1011 Aaron1011 assigned virajmehta and unassigned Aaron1011 Apr 8, 2026
Comment thread crates/tensorzero-core/src/db/clickhouse/variant_statistics.rs
Comment thread crates/durable-tools/src/tensorzero_client/client_ext.rs
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

There are 3 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b2ed763. Configure here.

Comment thread crates/tensorzero-core/src/endpoints/internal/variant_statistics.rs
Comment thread crates/tensorzero-core/src/db/clickhouse/variant_statistics.rs
@virajmehta virajmehta force-pushed the viraj/variant-stats-tool branch from b2ed763 to a2b2fdd Compare April 8, 2026 20:31
Comment thread crates/durable-tools/src/tensorzero_client/client_ext.rs
@virajmehta virajmehta enabled auto-merge April 13, 2026 15:19
@virajmehta virajmehta added this pull request to the merge queue Apr 13, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 13, 2026
`autopilot-tools` depends on `durable-tools` with `ts-bindings` always
enabled, so the `ToolMetadata` trait unconditionally requires
`llm_params_ts_bundle` / `output_ts_bundle` and friends. Gating the
impls behind `#[cfg(feature = "ts-bindings")]` (which refers to
`autopilot-tools`'s own feature) caused `E0046` when building the
gateway without that feature (e.g. `cargo build -p gateway --features
e2e_tests`).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
AntoineToussaint and others added 3 commits April 13, 2026 14:23
The `disallowed-types` clippy lint (added in #7252) bans
`SwappableAppStateData` outside of router/gateway construction and the
config-apply handler. This handler doesn't need it — it just extracts
`AppState`, same as the other internal endpoints.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@AntoineToussaint AntoineToussaint added this pull request to the merge queue Apr 13, 2026
Merged via the queue into main with commit af2438a Apr 13, 2026
81 checks passed
@AntoineToussaint AntoineToussaint deleted the viraj/variant-stats-tool branch April 13, 2026 20:15
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.

3 participants