logwarden v0.12.0¶
Status: Planned.
Outcome: a go/no-go decision on metrics, backed by real services. Logs and metrics have the
same problem: names and labels drift away from the standard. Before building a full metrics
workflow (planned as v0.13.0), this version ships the smallest check that can
show whether logwarden finds problems in metrics that matter and that other tools miss. It runs
on the saved /metrics output of real services, and the result decides whether v0.13.0 starts.
No user has asked for metrics checks yet. Weaver already reports wrong names, units and
instrument types, and promtool check metrics reports Prometheus naming mistakes. What nothing
reports is the expensive part: labels with unbounded values, personal data in labels, and label
names that differ from the log fields. That is what this version has to prove useful.
Spike results (2026-11-21)¶
Weaver v0.28 live-check with semconv 1.45, fed six metrics from the OTel Python SDK over
OTLP gRPC: one correct, five with typical mistakes
(tests/data/metrics_spike/emit.py).
| Mistake | Found by | Finding |
|---|---|---|
Custom name where semconv has one (api_latency_ms) |
Weaver | missing_metric (no hint to the semconv name) |
Semconv metric with unit ms instead of s |
Weaver | unit_mismatch |
| Duration as a counter instead of a histogram | Weaver | unexpected_instrument |
Label status |
logwarden Rego, unchanged | adr_banned_synonym |
| Email address in a label value | logwarden Rego, unchanged | adr_sensitive_data (message says "don't log it") |
300 distinct user.id values on one counter |
nothing | user.id is valid semconv, so nothing flags it |
payments_total_count (suffixes in the name) |
Weaver, partly | only missing_metric, no naming hint |
| Missing resource attributes | nothing | resources aren't checked |
Also found:
- Weaver accepts metric samples from a JSON file (--input-source file), the way logwarden
already feeds it logs. Scraped Prometheus text can be converted to samples, with no OTLP
listener needed.
- Weaver's OTLP listener is gRPC only; logwarden capture is OTLP/HTTP.
- One finding per data point: 300 series gave 300 identical findings. Findings need grouping
per metric and attribute.
So the existing pipeline carries over. New work: input conversion, cardinality, resource checks, naming hints and grouping.
What's new¶
logwarden check --signal metrics(experimental) on Prometheus or OpenMetrics text, such as a savedcurl :8000/metrics.- Prometheus names are translated back to OTel names for Weaver
(
http_server_request_duration_seconds→http.server.request.duration, units;_total,_ratioand unit suffixes per the OTel compatibility spec). Dotted UTF-8 names from Prometheus 3 are read as they are.# TYPEgives the instrument. - Weaver's findings (
missing_metric,unit_mismatch,unexpected_instrument,required_attribute_not_present) get hints anddocs/rules.mdentries. - The label rules run on metric labels unchanged:
adr_banned_synonym,adr_semconv_prefix,adr_sensitive_data. - New rule
adr_metric_cardinality: a label from the unbounded list (IDs, emails,url.full,url.path, …), or a metric over its series budget (default 1,000 per metric). - One finding per metric and label, with the number of series, instead of one per series.
- Outputs: the text summary,
--jsonand--markdown. Exit codes as for logs. - Experimental: rule ids, messages and options for metrics may still change, unlike those for logs. The help and docs say so.
- The trial (the point of this version). The check runs on the
/metricsoutput of five real services:aihub,databridge,yallmp-sync,clickstreamandmeta-evaluator(ai-suite), and of the GitLab team's services if they agree.promtool check metricsruns on the same files. Each finding is reviewed with the service's owner and marked worth fixing or not. The results go into a table in these notes, with no metric values or label values.
Decision rule¶
Go (v0.13.0 starts, re-scoped by what the trial found) if both hold:
- in at least 3 of the 5 services, logwarden finds at least one problem the owner agrees is
worth fixing and that neither promtool nor Weaver alone reports usefully (a raw
missing_metric without a hint counts as not useful);
- at most 30% of all findings are judged not worth fixing.
No-go otherwise: v0.13.0 is dropped from the roadmap, --signal metrics stays
experimental (or is removed in the next release if it found nothing), and the metrics standard
stays a document for code review.
Not in this version¶
Everything that only matters once metrics checks are known to be useful moves to v0.13.0:
OTLP input and capture /v1/metrics, naming hints (adr_metric_name), resource checks,
required metrics, domain metrics in the fields file, baseline and --compare, SARIF, Code
Quality, HTML, the GitLab template, the Action and MCP.
Breaking changes¶
None. Nothing changes for logs.
Verification¶
| # | Claim | How it will be checked | Result |
|---|---|---|---|
| 1 | Input | Tests: every translation case in the compatibility spec (_seconds, _bytes, _total, _ratio, no unit, dotted UTF-8 names) maps back to the OTel name; # TYPE counter, gauge, histogram and summary give the instrument; the real /metrics output of the five trial services is read without errors |
⏳ |
| 2 | Findings | The spike's six metrics as a Prometheus text fixture: missing_metric, unit_mismatch, unexpected_instrument, required_attribute_not_present with hints; status and email labels give adr_banned_synonym and adr_sensitive_data; the correct metric gives nothing; no label value in any output |
⏳ |
| 3 | Cardinality and grouping | user.id label → adr_metric_cardinality; 1,001 series on one metric → over budget, 1,000 → not; the 300-series spike case gives one finding with the count 300 |
⏳ |
| 4 | Trial | The table of the five services (findings per rule, worth fixing or not, found by promtool/Weaver alone or not) is filled in these notes, and the decision rule is applied and written down: go or no-go |
⏳ |
| 5 | Docs, CI, release | docs/metrics-standard.md marks the checked rules [checked]; docs/rules.md, docs/integration.md (marked experimental), README, AGENTS.md, roadmap updated with the decision; CI on Linux, macOS and Windows; dry run to TestPyPI; after the tag, uvx logwarden==0.12.0 check --signal metrics on the fixture from PyPI and the image |
⏳ |