---
id: w8/m5/t001
title: Design meter-applicability matrix for Database/KeyValue
worker: worker8
status: todo
estimate: 30m
depends_on: []
---

## Objective

Decide and document which of the three usage meters (`instance_seconds`, `egress_bytes`, `build_seconds`) apply to managed `Database` (Postgres) and `KeyValue` instances, before touching the rollup pipeline.

## Context

- `docs/ADR023-usage-metering.md` documents the three meters and their Prometheus/k8s sources for `App` services only.
- `Database`/`KeyValue` CRs have a billable `Plan`/tier (`DatabaseSpec.Plan`: `free`/`basic-256mb`/`basic-1gb`; KeyValue: `free`/`starter`/`standard`) but no Traefik egress route by default and no build Jobs — `instance_seconds` is the only meter that clearly applies.
- `egress_bytes` only applies to instances with a public Traefik TCP/SNI route (`BEX_DB_DOMAIN`/`BEX_KV_DOMAIN`) — decide whether to meter that now or explicitly defer it.
- `build_seconds` has no equivalent for managed data stores — explicitly out of scope.

## Steps

1. Write the applicability matrix (meter × resource kind → applies/deferred/N-A, with rationale) into `docs/ADR023-usage-metering.md`.
2. Decide the `service_id`/`kind` shape for the new rows (reuse the resource's own id, e.g. `db-…`/`kv-…`, as `ServiceID`).
3. Get the egress-for-public-DB/KV question explicitly resolved (apply now vs. deferred follow-up) rather than left implicit.

## Files

- `docs/ADR023-usage-metering.md`

## Acceptance criteria

- [ ] `docs/ADR023-usage-metering.md` states, per resource kind, which meters apply and why.
- [ ] The public-egress question has an explicit decision (not silently skipped).

## Out of scope

- Implementing the rollup changes (t002).
