Overview
Metrics deserve API discipline
Once a metric has more than two consumers, it stops being a convenience and becomes an API. Every API discipline applies:
- Versioning (semver) —
revenue@2.1.0. Bug fixes bump patch, additive dimensions bump minor, definition changes bump major and keep@1running for a deprecation window. - Ownership — every metric has a single human-team owner (
finance@example.com). Alerts route there, review-requests block on them. - Freshness SLA —
metric: revenue, slo: 24h freshness. Monitored as a first-class signal next to uptime. - Lineage — every metric carries a back-pointer to the semantic models, dbt models and source tables it depends on. OpenLineage events let you trace a board number back to a Fivetran sync.
The metric_contract.yaml shape
metric: revenue
version: 2.1.0
owner: finance@example.com
description: Net revenue in USD; refunds & VAT excluded.
slo:
freshness: 24h
pct_query_under_500ms: 95
supported_grains: [day, week, month, quarter, year]
supported_dimensions: [country, plan_tier, channel]
deprecation_policy:
major_change_notice: 60d
parallel_versions: true
Cross-link: see data-management-governance Level 4 for full data-contract patterns; this lesson is the metric-specific specialisation.