Skip to content

HTTP usage metering: attribution is by project name — harden docs/e2e (#287) + investigate malformed subjects #286

Description

@ecv

Corrected understanding

Important

An earlier version of this issue claimed gateway usage metering emitted unresolvable subjects and that "all usage is rejected." That was wrong. Confirmed against the consumer code (milo-os/billing, internal/controller/consumer).

  • The consumer attributes usage by project name: consumer.go strips projects/ from the CloudEvent subject and matches the remainder against BillingAccountBinding.spec.projectRef.name (billingaccountbinding_cache.go).
  • The NSO VRL already builds the subject as projects/<project-name>correct, no change needed.
  • attribution_failure fires when a project has no active BillingAccountBinding (or its account isn't Ready). So the high reject volume on prod is dominated by unbilled / test projects — expected, not a derivation bug. Accepted usage is republished to billing.usage.<project>.valid (no success counter), which is why "no accepted metric" looked like total failure but isn't.
  • The production broker outage (datum-cloud/infra#3448) is a separate problem — event volume against an unsized single-replica stream, independent of attribution.

What's actually actionable

  1. Harden the model against silent regression — done in test(billing): pin usage subject to project name + fix metering doc #287: pins the billing e2e subject to projects/<project-name> (it previously accepted any subject) and corrects the design doc, which called project_name a mere "dimension."
  2. Investigate malformed subjects. A subset of rejected project values are malformed — leading-underscore _datum-cloud, 0-datum-internal-anchor. These are a real (smaller) derivation/injection bug: is idx.ProjectNames[dsNS] returning a malformed name, or does a specific route class produce it?
  3. Confirm no billable project is wrongly rejected. Cross-check the rejected project set against projects that do have an active BillingAccountBinding; any overlap is a real attribution bug beyond the malformed set.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions