Open source · Data & Analytics

Metric Definition Registry

Keep metric definitions, owners, filters and calculation versions together.

v0.1.0 · Node.js 22+ · MIT

Browse the public repository · View releases

Validate a registry of metric definitions — formula, grain, filters, unit, aggregation, owner and semantic dependencies — and compare it with the registry that came before. It refuses to call a dependency graph acyclic when one of its edges leaves the evidence, and it never fills in a unit, an aggregation or a dependency list that nobody declared.

This walkthrough uses the tool's public README and checked-in example files. Run the command from a repository checkout with Node.js 22+.

Run the checked-in example

# A registry that is in order, compared with the one before it.
node bin/metric-definition-registry.mjs \
  --root examples/valid \
  --registry metrics.2026-07.json \
  --previous metrics.2026-04.json
# exit 0

# A registry with a name two definitions disagree about and a dependency cycle.
node bin/metric-definition-registry.mjs \
  --root examples/conflicts \
  --registry metrics.json
# exit 1

Read the result

stdout carries the JSON report and nothing else, so it pipes straight into a parser. stderr carries the human summary; --json silences it.

Scope

Each is enforced before the work it bounds, so a legal-sized input cannot exhaust memory. Exceeding one is an incomplete result with a finding naming the limit — never a silent truncation, never a pass. Every one is tested from both sides: that it fires at N+1, and that it stays silent at exactly N.