{
  "$id": "https://schemas.mapi.dev/v1/api-MetricSeries.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "description": "Summary of one metric series (key + labels) of a run; the newest attempt that logged it.",
  "examples": [
    {
      "attempt": 1,
      "count": 1400,
      "first_ts": "2026-10-15T09:30:00Z",
      "key": "step_size",
      "labels": {
        "chain": "0"
      },
      "last": 0.31,
      "last_step": 1400,
      "last_ts": "2026-10-15T09:31:00Z",
      "max": 1.2,
      "min": 0.02
    },
    {
      "attempt": 1,
      "count": 1,
      "first_ts": "2026-10-15T09:30:00Z",
      "key": "rmse",
      "last": 12.7,
      "last_step": null,
      "last_ts": "2026-10-15T09:30:00Z",
      "max": 12.7,
      "min": 12.7
    }
  ],
  "properties": {
    "attempt": {
      "minimum": 1,
      "title": "Attempt",
      "type": "integer"
    },
    "count": {
      "description": "Stored points",
      "minimum": 0,
      "title": "Count",
      "type": "integer"
    },
    "first_ts": {
      "format": "date-time",
      "title": "First Ts",
      "type": "string"
    },
    "key": {
      "pattern": "^[a-z][a-z0-9_]{0,63}$",
      "title": "Key",
      "type": "string"
    },
    "labels": {
      "additionalProperties": {
        "type": "string"
      },
      "title": "Labels",
      "type": "object"
    },
    "last": {
      "description": "Value of the newest point (by time, then step)",
      "title": "Last",
      "type": "number"
    },
    "last_step": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Step of the newest point; null for a scalar",
      "title": "Last Step"
    },
    "last_ts": {
      "format": "date-time",
      "title": "Last Ts",
      "type": "string"
    },
    "max": {
      "title": "Max",
      "type": "number"
    },
    "min": {
      "title": "Min",
      "type": "number"
    }
  },
  "required": [
    "key",
    "attempt",
    "count",
    "last",
    "min",
    "max",
    "first_ts",
    "last_ts"
  ],
  "title": "MetricSeries",
  "type": "object",
  "x-mapi-contract-version": "0.2"
}
