Business Metrics
Gateway services emit Micrometer business metrics for operational dashboards,
SLO investigation, and certification/runbook evidence. The source of truth for
exact metric names and tag values is the BusinessMetrics class in each
service, backed by executable BusinessMetricsTest coverage.
Metric Families
| Service | Metrics | Required bounded tags | Optional high-cardinality tags |
|---|---|---|---|
| Auth | gateway.auth.tokens.issued.total | outcome, reason | client_id |
| Processing | gateway.transactions.total, gateway.transactions.latency, gateway.refunds.total, gateway.gift_card.refund_reroutes.total, gateway.gift_card.refund_rerouted_amount_cents.total | outcome, type, reason | merchant_id |
| Online transaction | gateway.checkout.sessions.total, gateway.webhooks.deliveries.total | outcome, event_type, source | merchant_id |
Card-present reuses the processing transaction engine for in-person transaction metrics, so its transaction counters follow the processing metric contract.
Cardinality Gates
High-cardinality identity tags are disabled by default:
| Env var | Config property | Adds tag | Services |
|---|---|---|---|
METRICS_INCLUDE_CLIENT_ID | gateway.metrics.include-client-id | client_id | Auth |
METRICS_INCLUDE_MERCHANT_ID | gateway.metrics.include-merchant-id | merchant_id | Processing, online-txn, card-present |
Keep these flags off unless the dashboard or incident explicitly needs the identity dimension and the expected series count is understood. Prefer joining metrics with structured request logs in Cloud Monitoring when investigating a single merchant or client.
Executable Coverage
The following targets prove the canonical names, bounded tags, and cardinality gates:
bazel test //services/auth:business_metrics_test \
//services/processing:business_metrics_test \
//services/online-txn:business_metrics_test
These tests should change in the same commit as any metric name, tag key, tag value, or cardinality gate change.