Conversation
telemt publishes conventional Prometheus counters, i.e. with a _total
suffix. The patterns required `{` immediately after `client`:
awk '/^telemt_user_octets_from_client\{/{s+=$NF}...'
so against telemt 3.5.6+ nothing matched and every traffic figure read 0
— `secret list`, `metrics`, the traffic totals, all of them. The failure
is silent by construction: an awk sum over a pattern matching nothing
yields 0 rather than an error, so nothing anywhere reports a problem.
All 34 sites across both syntactic forms — the literal /^...\{/ form and
the `-v u="$label"` regex form — now match the _total names.
Only these two counters drifted. telemt_user_connections_current and the
rest still match unmodified, so they are deliberately left alone; the new
test asserts that, to guard against over-correcting the whole family.
The patterns match the _total spelling only, not `(_total)?`. The tolerant
form would work today but would double-count if a future telemt published
both spellings, so tests/test_metric_names.sh pins the exclusive behaviour.
tests/test_traffic_reset.sh stubbed the old metric names in its fixture
and so was asserting against a payload telemt no longer produces; its
fixture is updated here too.
Two independent upstream telemt changes left the manager reading counter
names the engine no longer publishes. Both failures are silent: an awk sum
over a pattern that matches nothing yields 0, not an error.
1. Conventional _total suffix on the user octet counters.
telemt ede3314 (2026-08-01, first released in 3.5.4) renamed
telemt_user_octets_from_client -> telemt_user_octets_from_client_total,
and the _to_client pair likewise. The patterns required `{` immediately
after `client`, so from 3.5.4 on nothing matched and every traffic
figure across the manager read 0 — `secret list`, `metrics`, the
per-user totals. All 34 sites across both syntactic forms now match the
_total spelling.
The old names were removed in the same commit, so the two spellings
never coexisted in any release; matching _total exactly rather than
`(_total)?` therefore cannot double-count.
2. Removal of the aggregate connection gauges.
telemt c07b600 (2026-03-19) deleted telemt_connections_current,
telemt_connections_me_current and telemt_connections_direct_current.
That predates 3.5.0, so they are absent for the whole supported range:
show_connections reported "Total active: 0", and the metrics view showed
a permanent "(ME: 0 direct: 0)".
The aggregate is now summed from the still-published per-user gauge
telemt_user_connections_current. The ME/direct breakdown has no
replacement — telemt removed it outright — so it is dropped from the
display rather than left asserting a number that was never measured.
tests/test_metric_names.sh records both upstream commits with links and
asserts the resulting behaviour; it fails 5 of 6 assertions beforehand.
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
Two independent upstream telemt changes left this script scraping counter names the engine no longer publishes. The manager therefore displayed zeros where it should have displayed traffic, with no error anywhere — an
awksum over a pattern that matches nothing yields0, not a failure. A stale metric name is indistinguishable from a genuinely idle proxy.This PR corrects both, and adds
tests/test_metric_names.shwhich fails 5 of its 6 assertions before the change.How these were found
By cross-checking every
telemt_*name this script matches against everytelemt_*name the engine actually emits (grep -rhoE '"telemt_[a-zA-Z_]+' src/in the engine repo), rather than by reading the scrape code and assuming it was current.That sweep is what surfaced change 2, which the more obvious approach misses: change 1 involves names matched as
/^name\{/, but the gauges in change 2 are matched as/^name /— with a trailing space. Any audit that greps fortelemt_*{patterns will not see them.Change 1 — the conventional
_totalsuffix on the user octet countersede3314bee356339dca4ca1b378c251ebac15358Fix name metric countersrc/metrics/render/users.rsThe upstream change, verbatim:
The same commit renamed the
to_clientpair, and addedtelemt_user_msgs_from_client_total/_to_client_total. This script references nomsgscounter, so those need nothing.Release evidence
git grepat each tag:..._from_client{..._from_client_total{A clean switch with no overlap. Note this means the affected range starts at 3.5.4, not 3.5.6 as first reported — the counter has been unreadable since 3.5.4.
The scrape-side defect
The patterns required
{immediately afterclient:awk '/^telemt_user_octets_from_client\{/{s+=$NF}END{printf "%.0f",s}'and the per-user form:
With
_totalinserted betweenclientand{, neither can match. Measured on a live engine, seconds apart:Consequences:
secret listshowedTRAFFIC IN/OUT = 0 Bfor every secret;metrics,traffic,status --jsonand the per-user breakdowns all reported zero.Fix
All 34 sites across both syntactic forms now match the
_totalspelling.Why the exact
_totalspelling, not(_total)?Because the two spellings never coexisted — the same commit removed the old names, so no telemt release ever published both. A tolerant pattern would therefore work today, but it would silently double-count if a future release ever emitted both during a transition. The test pins the exclusive behaviour with a payload containing a legacy-named line and asserts it is not counted.
Change 2 — the aggregate connection gauges were deleted
c07b600acb6bb59762bd96af6ce5b7fa90ec9de1Integration hardening: reconcile main+flow-sec API drift and restore green suiteThe upstream change, verbatim (removals only — nothing replaced them):
Release evidence
telemt_connections_currentis absent at every tag from 3.5.0 through 3.5.7. Whatever engine version this script supports, these three have never existed for it.The scrape-side defect
show_connections()andshow_metrics()read them with a trailing space:/^telemt_connections_current / { total=$NF } /^telemt_connections_me_current / { c_me = $NF } /^telemt_connections_direct_current / { c_dir = $NF }Because the removed names are matched by space rather than
{, a sweep oftelemt_*{patterns does not find them — which is why an earlier audit of this same code reported only the two octet counters as drifted.Consequences:
mtproxymax connectionsprintedTotal active: 0regardless of load, and the metrics view carried a permanent(ME: 0 direct: 0).Fix
telemt_user_connections_current, which the engine still publishes. This needs no assumption about a replacement name: it is the same quantity (active connections), just summed per user.(ME: 0 direct: 0)would assert a number that was never measured. Happy to keep a placeholder instead if you would rather the line stay visually stable.Testing
New
tests/test_metric_names.shdrivesget_proxy_stats,get_user_statsandshow_connectionsagainst a payload shaped like a real scrape.Before this change — 5 of 6 assertions fail:
After — 6 of 6 pass. Note the first line: the traffic columns are
0 0, which is exactly the production symptom.The test also carries both upstream commits as comments with links and dates, so whoever next sees a metric name go stale has the history in front of them instead of rediscovering it.
Verified on Debian 12, Ubuntu 22.04, Ubuntu 24.04, Alpine 3.20 and Fedora 41.