Skip to content

fix(tracing): use count unit for chat_exception_counter - #1186

Open
RichardoMrMu wants to merge 2 commits into
volcengine:mainfrom
RichardoMrMu:fix/portal-metrics-counter-unit
Open

RichardoMrMu wants to merge 2 commits into
volcengine:mainfrom
RichardoMrMu:fix/portal-metrics-counter-unit

Conversation

@RichardoMrMu

@RichardoMrMu RichardoMrMu commented Oct 27, 2026 •

Copy link
Copy Markdown

改动 / Change

veadk/tracing/telemetry/portal_metrics.py 中 chat_exception_counter 用 unit="time"(duration 单位,从相邻 histogram 复制),description 为 "Number of exceptions"。改为与同文件 skill 计数器一致的 unit="1"。

chat_exception_counter was created with unit="time" (a duration unit copied from a neighboring histogram), while its description says "Number of exceptions". Align it to unit="1", matching the sibling skill counters already in this file.

 self.chat_exception_counter = self.meter.create_counter(
     name=Meters.LLM_COMPLETIONS_EXCEPTIONS,
-    unit="time",
+    unit="1",
     description="Number of exceptions occurred during chat completions",
 )

双语 PRD / bilingual PRD: prd-spec/bugfixes/2026-10-27-portal-metrics-counter-unit.md (+ .zh.md)。

测试 / Tests

新增 tests/test_portal_metrics_counter_unit.py,仅依赖标准库、不 import google.adk:

  • test_chat_exception_counter_uses_count_unit:断言该 counter 单位为计数单位。
  • test_sibling_counters_unchanged:范围守卫,断言 llm_invoke_counter="count"、skill_download/load_counter="1" 均未被误改。

静态实算 / Static RED/GREEN (no runtime):

  • base main 2301477(unit="time"):exception counter 断言 FAILED (RED),sibling 守卫 PASSED。
  • head 6ada3e70(unit="1"):两项 PASSED (GREEN)。

Recorder-based runtime test in test_portal_metrics.py requires google.adk and is NOT run locally; left to CI. No runtime green is claimed.

Claim / occupancy (limited)

  • In this repo, no open PR touches portal_metrics.py (57 open PRs; only 3 touch tracing, different files). Search for chat_exception_counter / portal_metrics = no matching issue.
  • 此为限定结论:本仓/相关搜索范围内无 matching issue;不代表全局无人在改。No absolute "FREE" claim.
  • 本改动未改公共 API、span/事件契约或依赖;仅修正遥测元数据单位。

The chat_exception_counter was created with unit="time" (a duration unit
copied from a histogram) while its description says "Number of exceptions".
Align it to unit="1" like the sibling skill counters, and add a static
regression guard for the counter unit metadata.
…egression

- Add prd-spec/bugfixes/2026-10-27-portal-metrics-counter-unit.{md,zh.md}
- Strengthen test with sibling-counter scope guard (llm/skill units unchanged)

This branch has not been deployed

No deployments
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.

1 participant