Skip to content

fix(metrics): drop vcon.uuid from link metrics and guard against per-vCon attributes - #226

Merged
howethomas merged 2 commits into
mainfrom
fix/link-metric-uuid-cardinality
Nov 4, 2026
Merged

howethomas merged 2 commits into
mainfrom
fix/link-metric-uuid-cardinality

Conversation

@howethomas

Copy link
Copy Markdown
Contributor

Problem

#154 added vcon.uuid to the metric attributes of 17 links. Every distinct uuid is its own time series. The counters and histograms are cumulative, so each worker re-exports every series it has created on every export interval until the process restarts, and metric volume grows without bound. #224 fixed the jq link after it filled a metrics store (over 1M series and about 460M samples an hour from one counter). The other links have the same flaw at lower volume today; the histograms are the worst case, since each series carries a full set of buckets.

Change

  • Remove vcon.uuid from metric attributes in analyze, analyze_and_label, analyze_vcon, check_and_tag, datatrails, deepgram_link, detect_engagement, diet, groq_whisper, hugging_face_whisper, hugging_llm_link, openai_transcribe, post_analysis_to_slack, sampler, scitt, tag_router and webhook (27 call sites). Each attrs dict was checked to feed only metric calls. The uuid stays in log lines and span attributes, where per-event detail belongs.
  • common/lib/metrics.py: increment_counter, add_updown_counter and record_histogram drop per-vCon keys (vcon.uuid, vcon_uuid, vcon_id, vcon.id) and log a warning once per metric. This is a backstop so a new or out-of-tree link cannot bring the problem back.

Tests

  • The CON-6 tests in conserver/tests/test_link_metrics.py asserted vcon.uuid was present. assert_metric_has_attrs now fails if any data point carries a per-vCon key.
  • New TestPerVconAttributeGuard covers counter, up/down counter and histogram: three uuids in, one series out.
  • Mutation checks: with the guard disabled, the 3 guard tests fail. With the guard disabled and the links reverted, 27 tests fail. With both in place, all 31 pass.

Notes for operators

Dashboards or alerts that group or filter link metrics by vcon.uuid will lose that dimension. Per-vCon lookups belong in traces or logs.

🤖 Generated with Claude Code

howethomas and others added 2 commits November 3, 2026 16:36
…vCon attributes

#154 put vcon.uuid on the metrics of 17 links. Each distinct value is its
own time series, and with cumulative temporality every series is
re-exported on each interval for the life of the worker, so metric volume
grows without bound until a restart. #224 fixed the jq link after it
filled a metrics store; this removes the same label from the rest:
analyze, analyze_and_label, analyze_vcon, check_and_tag, datatrails,
deepgram_link, detect_engagement, diet, groq_whisper, hugging_face_whisper,
hugging_llm_link, openai_transcribe, post_analysis_to_slack, sampler,
scitt, tag_router and webhook. Span attributes keep the uuid; spans are
per-event and do not have this problem.

lib.metrics now drops per-vCon keys (vcon.uuid, vcon_uuid, vcon_id,
vcon.id) from counter, up/down counter and histogram attributes and warns
once per metric, so a new or out-of-tree link cannot reintroduce it.

The CON-6 metric tests asserted vcon.uuid was present; they now assert
no per-vCon key appears on any data point. With the guard disabled, 3
guard tests fail; with the guard disabled and the links reverted, 27 fail.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The per-link test files still asserted vcon.uuid in the attributes passed
to the metric helpers. Update them to match the links.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@howethomas
howethomas merged commit 66fe6d5 into main Nov 4, 2026
1 check passed
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