Skip to content

fix(sight): match latency agents case-insensitively - #2590

Merged
chengshuyi merged 1 commit into
alibaba:mainfrom
yefuyou:fix/sight/latency-agent-identity
Aug 17, 2026
Merged

fix(sight): match latency agents case-insensitively#2590
chengshuyi merged 1 commit into
alibaba:mainfrom
yefuyou:fix/sight/latency-agent-identity

Conversation

@yefuyou

@yefuyou yefuyou commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Correctness follow-up to #2578, discovered during review of #2586.

The existing Agent Sessions UI treats casing variants such as Qoder and qoder as the same Agent, but the latency API used a case-sensitive SQLite comparison. This could make the selected sessions match while /api/metrics/latency returned no rows.

Changes

  • make filtered latency Agent matching case-insensitive with SQLite COLLATE NOCASE
  • aggregate casing variants into one filtered latency summary
  • use the requested Agent casing as the returned agent_name label
  • keep process_name fallback semantics unchanged

Scope

This PR is limited to src/agentsight/src/storage/sqlite/genai/stats.rs.

It does not change:

  • frontend code
  • source filtering
  • auxiliary-call scope
  • metric formulas or percentile semantics
  • null semantics
  • schema or eBPF code

Merge order

Recommended order: #2583 → this follow-up → #2586.

#2583 is preferred first because it addresses the existing AgentSight Clippy failures and also touches stats.rs; it is not a hard dependency of this PR. #2586 has the functional dependency on this case-insensitive latency filtering.

Validation

  • targeted casing regression test passed
  • latency_tests: 9 passed
  • latency handler test: 1 passed
  • cargo +1.89.0 fmt --all -- --check
  • git diff --check
  • full unit/integration tests passed
  • cargo test has one unrelated existing doctest failure in src/genai/helpers.rs
  • Rust 1.89 Clippy is blocked by the two existing lint issues addressed separately by fix(sight): address latency metrics CI follow-ups #2583:
    • clippy::let_and_return in src/agentsight/src/analyzer/unified.rs
    • clippy::unnecessary_map_or in src/agentsight/src/storage/sqlite/genai/stats.rs

@github-actions github-actions Bot added the component:sight src/agentsight/ label Aug 16, 2026
@yefuyou
yefuyou marked this pull request as ready for review August 16, 2026 07:01

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

Copy link
Copy Markdown

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: 6762108f3e

ℹ️ 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 src/agentsight/src/storage/sqlite/genai/stats.rs
@yefuyou
yefuyou force-pushed the fix/sight/latency-agent-identity branch from 6762108 to 797e246 Compare August 16, 2026 07:21
Correct the latency Agent filter to align with existing case-insensitive Agent identity handling.

Fixes: ba20d94 ("feat(agentsight): add LLM latency metrics API (alibaba#2578)")
@yefuyou
yefuyou force-pushed the fix/sight/latency-agent-identity branch from 797e246 to f2dd889 Compare August 16, 2026 13:05

@chengshuyi chengshuyi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. 核心逻辑正确,scope 干净。几点 minor suggestions 不阻塞合入:1) 同文件 get_token_timeseries/get_model_timeseries 仍为 case-sensitive,建议 follow-up 统一;2) ?3 COLLATE NOCASE 冗余可简化;3) 可补 process_name fallback 的 case-insensitive 测试。

@chengshuyi
chengshuyi merged commit 63cc5d9 into alibaba:main Aug 17, 2026
1 check passed
@Daydreamer-Li Daydreamer-Li mentioned this pull request Aug 18, 2026
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component:sight src/agentsight/

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants