litellm/litellm-rust/crates/traces/tests/query.rs
ishaan-berri bf9bd35469
feat(lens): scope traces to one agent with a header picker (#45202)
* feat(lens): add trace_agents rollup query

* feat(lens): register the trace_agents read query

* feat(lens): add trace_agents params and row types

* feat(lens): dispatch the trace_agents query

* feat(lens): export trace_agents wire schemas

* test(lens): pin the trace_agents query name

* test(lens): cover trace_agents scope, window and failure counts

* feat(lens): cap the agent list size

* feat(lens): declare the trace_agents bridge query

* feat(lens): read trace agents from clickhouse storage

* feat(lens): add trace agent response models

* feat(lens): list agents within the reader's trace scope

* feat(lens): add GET /v1/traces/agents

* chore(lens): regenerate trace models with trace_agents

* chore(lens): regenerate trace types with trace_agents

* chore(lens): regenerate read query name schema

* chore(lens): add trace agent row schema

* chore(lens): add trace agents params schema

* test(lens): cover the trace agents route

* test(lens): cover agent listing scope and timestamps

* chore(ui): regenerate api types with trace agents route

* feat(lens): derive trace agent types from the schema

* feat(lens): fetch the agent list from the traces api

* feat(lens): roll up demo runs into agents

* feat(lens): serve the agent list in demo data

* feat(lens): load agents seen in the last two weeks

* feat(lens): remember the selected agent per browser

* feat(lens): add the agent picker

* feat(lens): wire agent selection into the lens header

* feat(lens): show the agent picker next to the lens title

* refactor(lens): drop the toolbar agent filter in favor of the header picker

* test(lens): remove tests for the toolbar agent filter

* test(lens): cover agent resolution and rollup

* test(lens): cover scoping, switching and remembering the agent

* test(lens): read only the create request in guided setup

* test(lens): assert the toolbar agent filter is gone

* test(lens): read stubbed requests without their abort signal
2026-10-07 23:48:04 +00:00

35 lines
1.3 KiB
Rust

use litellm_traces::{InvalidQuery, ReadQuery};
use rstest::rstest;
#[rstest]
#[case::list_traces("list_traces", ReadQuery::ListTraces)]
#[case::trace_agents("trace_agents", ReadQuery::TraceAgents)]
#[case::trace_spans("trace_spans", ReadQuery::TraceSpans)]
#[case::span_detail("span_detail", ReadQuery::SpanDetail)]
#[case::span_error("span_error", ReadQuery::SpanError)]
#[case::identity("trace_identity", ReadQuery::TraceIdentity)]
#[case::spend("spend_by_response_ids", ReadQuery::SpendByResponseIds)]
#[case::availability("availability", ReadQuery::Availability)]
#[case::agents("agents", ReadQuery::Agents)]
#[case::sample("sample", ReadQuery::Sample)]
#[case::content("content", ReadQuery::Content)]
#[case::evidence("evidence", ReadQuery::Evidence)]
fn names_select_the_public_query(#[case] name: &str, #[case] query: ReadQuery) {
assert_eq!(ReadQuery::parse(name).unwrap(), query);
assert_eq!(query.as_ref(), name);
assert_eq!(query.to_string(), name);
}
#[rstest]
#[case::unknown("unknown")]
#[case::case_sensitive("List_Traces")]
#[case::whitespace(" list_traces")]
#[case::empty("")]
fn invalid_names_preserve_the_public_error(#[case] name: &str) {
let error = ReadQuery::parse(name).unwrap_err();
assert!(matches!(error, InvalidQuery));
assert_eq!(error.to_string(), "unknown ClickHouse read query");
}
#[path = "query/named.rs"]
mod named;