feat(metrics): emit conserver.vcons.inflight UpDownCounter#177
Merged
Conversation
Adds an OpenTelemetry UpDownCounter that tracks how many vCons are currently being processed — i.e. between BLPOP from the ingress list and the end of ``_handle_vcon``. +1 on entry, -1 in finally, so every exit path (success, early-return from ``before_processing``, chain exception → DLQ) symmetrically decrements. Attribute: ``chain.name`` only. ``vcon.uuid`` deliberately omitted to avoid the per-event cardinality problem. Also adds ``add_updown_counter`` helper to common/lib/metrics.py for this and any future UpDownCounter use, matching the lazy-init pattern of the existing ``increment_counter`` / ``record_histogram`` helpers. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an OpenTelemetry UpDownCounter (`conserver.vcons.inflight`) that tracks how many vCons are currently being processed — i.e. between BLPOP from the ingress list and the end of `_handle_vcon`.
`+1` on entry, `-1` in the `finally`, so every exit path symmetrically decrements:
Attribute: `chain.name` only. Deliberately no `vcon.uuid` (cardinality).
Also adds an `add_updown_counter` helper in `common/lib/metrics.py` that mirrors the lazy-init pattern of `increment_counter` / `record_histogram`, so future UpDownCounter use sites can plug in without re-implementing the SDK plumbing.
Why an UpDownCounter (not a counter pair or observable gauge)
Test plan
🤖 Generated with Claude Code