MATIH Platform is in active MVP development. Documentation reflects current implementation status.
10. Data Catalog & Governance
Semantic Layer
Metric Versioning

Metric Versioning

Metric Versioning tracks changes to metric definitions over time, providing a complete history of modifications with the ability to compare versions and rollback to previous definitions. This ensures that changes to business metrics are auditable and reversible. All versioning endpoints are served at the base path /api/v1/metrics/versions.


How Versioning Works

Every time a metric definition is modified (expression, type, filters, or configuration), a new version is created. The system maintains the full history of versions, allowing users to review changes, compare definitions, and restore previous versions.

Version 1: SUM(order_total)
    |
    v (updated expression)
Version 2: SUM(order_total) WHERE status = 'completed'
    |
    v (added filter)
Version 3: SUM(order_total) WHERE status = 'completed' AND region IS NOT NULL
    |
    v (rollback to version 1)
Version 4: SUM(order_total) [restored from v1]

Endpoints

MethodPathDescription
GET/api/v1/metrics/versions/:metricId/historyGet full version history
GET/api/v1/metrics/versions/:metricId/versions/:versionGet a specific version
GET/api/v1/metrics/versions/:metricId/currentGet current version number
GET/api/v1/metrics/versions/:metricId/compareCompare two versions
POST/api/v1/metrics/versions/:metricId/rollbackRollback to a previous version

Version History

Retrieves the complete list of versions for a metric, ordered from most recent to oldest.

Request:

GET /api/v1/metrics/versions/550e8400-.../history
X-Tenant-ID: tenant-uuid

Response: A list of MetricVersion objects, each containing the version number, metric definition snapshot, change description, author, and timestamp.


Get Specific Version

Retrieves a specific version by number.

Request:

GET /api/v1/metrics/versions/550e8400-.../versions/2
X-Tenant-ID: tenant-uuid

Returns a 404 Not Found if the version number does not exist.


Current Version

Returns the current (latest) version number for a metric.

Request:

GET /api/v1/metrics/versions/550e8400-.../current
X-Tenant-ID: tenant-uuid

Response:

3

Version Comparison

Compares two versions of a metric to identify what changed between them.

ParameterTypeRequiredDescription
fromVersionIntegerYesEarlier version number
toVersionIntegerYesLater version number

Request:

GET /api/v1/metrics/versions/550e8400-.../compare?fromVersion=1&toVersion=3
X-Tenant-ID: tenant-uuid

Response: A MetricVersionDiff object containing the differences between the two versions, including changed fields, added filters, modified expressions, and metadata changes.


Rollback

Restores a metric to a previous version by creating a new version with the old definition. This does not delete intermediate versions; it creates a new version entry that references the target version.

ParameterTypeRequiredDescription
targetVersionIntegerYesVersion number to restore

Headers:

HeaderRequiredDescription
X-Tenant-IDYesTenant identifier
X-User-IDYesUser performing the rollback

Request:

POST /api/v1/metrics/versions/550e8400-.../rollback?targetVersion=1
X-Tenant-ID: tenant-uuid
X-User-ID: user-uuid

Response: The newly created MetricVersion with the restored definition and an incremented version number.


Version Record Fields

Each version record stores the following information.

FieldDescription
versionNumberSequential version identifier
metricDefinitionComplete snapshot of the metric at this version
changeDescriptionHuman-readable description of what changed
changedByUser who made the change
createdAtTimestamp when the version was created
isRollbackWhether this version was created by a rollback operation
rollbackSourceIf a rollback, the version number that was restored

Best Practices

  • Review the version diff before rolling back to understand what will change
  • Use meaningful change descriptions when updating metrics
  • Monitor the current version number to detect unexpected changes
  • Combine versioning with governance audit policies for complete metric change tracking
  • Coordinate metric changes with downstream dashboard and report consumers