Skip to content

feat(pricing): Convert usage into the pricing unit - #124

Merged
JoseSzycho merged 3 commits into
mainfrom
feat/servicepricing-unit-conversion
Oct 16, 2026
Merged

JoseSzycho merged 3 commits into
mainfrom
feat/servicepricing-unit-conversion

Conversation

@JoseSzycho

Copy link
Copy Markdown
Contributor

Why

Meters count raw units: bytes, byte-seconds, millicore-seconds. ServicePricings price per GiB, GiB-second or vCPU-second. pricingUnit is only a label, so nothing tells a provider how to get from one to the other.

openmeter-provider sends the rate as is, so OpenMeter charges the per-GiB rate per byte. Datum's staging bill for the current period is about $1.97B, and invoices go to Stripe on Nov 10.

How

ServicePricing.spec.unitConversion (Usage charges only):

unitConversion:
  meterUnitsPerPricingUnit: "1073741824"
  description: "Memory is metered in byte-seconds and priced per GiB-second; 1 GiB = 2^30 bytes"
  • meterUnitsPerPricingUnit: how many meter units make one pricing unit. A positive decimal, checked in the CRD.
  • description: required, so the reason for a conversion is always written down for whoever maintains the pricing.
  • Omitted means usage is already in the pricing unit.
  • Offers snapshot it with the rest of the ServicePricing spec.

The provider will pass it to OpenMeter's unit_config (divide by the factor), so usage is converted rather than the price. Invoices then read 3600 GiB-s x $0.0000045 instead of byte counts times a tiny per-byte price. I verified this on a kind cluster: 3,600 GiB-s plus 300 GiB of egress (200 GiB free) invoiced exactly $5.02.

Follow-ups: service-catalog passes the field through its fan-out, and openmeter-provider applies it.

🤖 Generated with Claude Code

Meters count raw units (bytes, byte-seconds, millicore-seconds) while
ServicePricings price per GiB, GiB-second or vCPU-second, and nothing
said how to get from one to the other. Providers billed the per-GiB rate
per byte.

ServicePricing.spec.unitConversion states how many meter units make one
pricing unit, with a required description of why. Offers snapshot it
with the rest of the spec.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Offer CRD repeats the ServicePricing spec in its unbounded
servicePricings list, so the regex rule's estimated cost exceeded the
CEL budget 8.4x and the API server refused the CRD. A pattern that
excludes zero checks the same thing at no CEL cost.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JoseSzycho

Copy link
Copy Markdown
Contributor Author

uppppp!!! 🚀

@JoseSzycho
JoseSzycho merged commit 564e273 into main Oct 16, 2026
7 of 8 checks passed
@JoseSzycho
JoseSzycho deleted the feat/servicepricing-unit-conversion branch October 16, 2026 16:59
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.

2 participants