Skip to content

fix(obs): awsemf was billing nine series where the registry declares four - #615

Merged
athvin merged 1 commit into
mainfrom
bm/obs-awsemf-no-dimension-rollup
Nov 6, 2026
Merged

athvin merged 1 commit into
mainfrom
bm/obs-awsemf-no-dimension-rollup

Conversation

@athvin

@athvin athvin commented Nov 5, 2026

Copy link
Copy Markdown
Owner

The one calculation the metric registry exists to keep honest was wrong — in
the direction of understating cost.

Measured, not reasoned

er.db.query.duration declares two dimensions and registry.rs states 4
series
. In ER/Dev on 2026-11-05 it had become four dimension sets:

dimension set series
db.system.name, OTelLib, outcome 4
OTelLib, outcome 2
OTelLib 1
db.system.name, OTelLib 2
9

By default awsemf rolls dimensions up — one series per subset — and
injects OTelLib as a dimension of its own. Nine billable CloudWatch custom
metrics, not four: a small absolute number, and a 2.25× error in exactly the
arithmetic P12 used
to justify keeping statement_name off the metric.

The fix

dimension_rollup_option: NoDimensionRollup makes the bill equal the
declaration. It is also where the exporter is going anyway — it logs

"the default value for DimensionRollupOption will be changing to
NoDimensionRollup in a future release"

on every start. That line was in the log the whole time: I saw it while
diagnosing something else, read it as a deprecation notice, and moved on. It
was the answer.

What the registry now says

series is the OTel-side cardinality, and equals the CloudWatch bill only
while that exporter setting holds
.

Worth writing down because tests/cardinality.rs cannot check it: the
inflation happens in the collector, after the process that declared the number.
That is the one part of this calculation a Rust test cannot hold.

How it was found

By asking what the four series in ER/Dev actually were, rather than taking a
count of four as agreement with a declaration of four. The count matched;
nothing else did.

make check → exit 0.

🤖 Generated with Claude Code

…four

The one calculation the metric registry exists to keep honest was wrong, in
the direction of understating cost.

`er.db.query.duration` declares two dimensions, `db.system.name` x `outcome`,
and `registry.rs` states four series. Measured in ER/Dev on 2026-11-05 it had
become four dimension SETS:

    db.system.name, OTelLib, outcome   -> 2 x 2 = 4 series
    OTelLib, outcome                   ->         2
    OTelLib                            ->         1
    db.system.name, OTelLib            ->         2

Nine billable CloudWatch custom metrics, not four. By default awsemf rolls
dimensions up — one series per SUBSET of the dimensions — and injects
`OTelLib` as a dimension of its own. A small absolute number and a 2.25x
error in exactly the arithmetic P12 used to justify keeping `statement_name`
off the metric.

`dimension_rollup_option: NoDimensionRollup` makes the bill equal the
declaration, and is where the exporter is going anyway: it logs "the default
value for DimensionRollupOption will be changing to NoDimensionRollup in a
future release" on every start. That line was in the log the whole time —
visible while I was diagnosing something else, skimmed as a deprecation
notice, and it was the answer.

`registry.rs` now says that `series` is the OTel-side cardinality and equals
the CloudWatch bill ONLY while that exporter setting holds. Worth stating
because `tests/cardinality.rs` cannot check it: the inflation happens in the
collector, after the process that declared the number. That is the one part of
this calculation a Rust test cannot hold, so it is written down instead.

Found by asking what the four series in ER/Dev actually WERE rather than
taking a count of four as agreement with a declaration of four. The count
matched; nothing else did.

make check exit 0.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@athvin athvin added the merge-bus eligible for the merge bus label Nov 6, 2026
@athvin
athvin merged commit c74a69a into main Nov 6, 2026
39 checks passed
@athvin
athvin deleted the bm/obs-awsemf-no-dimension-rollup branch November 6, 2026 01:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-bus eligible for the merge bus

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants