ReportMetric report.metric@1

Generated at from openvibe-contracts v0.419.0 and openvibe-sdk v0.161.0.

Version
1.0.0
Owner
report
Visibility
public
Status
active
Compatibility
backward
Schema
https://openvibe.network/contracts/report/metric.v1.json

report.metric@1: one count computed or ingested by Report, with a UTC day or a window. Money values come from Billing's API; Report does not derive them. Mirrors OpenVibe.Report docs/report.metric.v1.json on origin/main.

Fields

FieldTypeRequiredDescriptionConstraints
metricstringyes
  • pattern ^[a-z][a-z0-9_]{1,60}$
scopeenumyes
  • one of "network", "site", "channel", "stream"
scope_idstringyes
  • minLength 1
  • maxLength 200
daystring
  • format date
window_daysenum
  • one of 7, 30, 90
valuenumberyes
unitenumyes
  • one of "count", "seconds", "minutes", "bits", "cents", "milliseconds", "percent"
sourcestringyes
  • minLength 1
  • maxLength 40

Examples

From the contract's own test fixtures: valid ones validate, rejected ones must fail.

Valid: day
{
  "metric": "pageviews",
  "scope": "site",
  "scope_id": "network",
  "day": "2026-10-28",
  "value": 147,
  "unit": "count",
  "source": "network-stats"
}
Valid: window
{
  "metric": "watch_minutes",
  "scope": "channel",
  "scope_id": "carol",
  "window_days": 7,
  "value": 312.5,
  "unit": "minutes",
  "source": "live"
}
Rejected: both-periods
{
  "metric": "pageviews",
  "scope": "network",
  "scope_id": "network",
  "day": "2026-10-28",
  "window_days": 7,
  "value": 147,
  "unit": "count",
  "source": "network-stats"
}

Validate

const contracts = require('openvibe-contracts');
contracts.validate('report.metric@1', value);   // { valid, errors: [{ path, message }] }