{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/amplerun-com/json-schema/amplerun-com-telemetry-sample-schema.json",
  "title": "TelemetrySample",
  "description": "Task A machine telemetry sample, mirroring telemetry.schema.json (the cross-language authority). EVERY measurement is optional: a probe that failed or was absent omits its field entirely. An absent field means \"not measured\", never 0 and never the previous reading. Byte/second counters are decimal strings; percentages and temperatures are bounded numbers.",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/amplerun-com-openapi.json#/components/schemas/TelemetrySample",
  "type": "object",
  "required": [
    "devices"
  ],
  "properties": {
    "devices": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "pci_address"
        ],
        "properties": {
          "pci_address": {
            "type": "string"
          },
          "temperature_c": {
            "type": "number"
          },
          "utilization_pct": {
            "type": "number",
            "minimum": 0,
            "maximum": 100
          },
          "memory_used_bytes": {
            "$ref": "#/$defs/DecimalString"
          },
          "power_watts": {
            "type": "number",
            "minimum": 0
          },
          "fan_pct": {
            "type": "number",
            "minimum": 0,
            "maximum": 100
          },
          "vendor": {
            "type": "string",
            "enum": [
              "nvidia",
              "amd",
              "intel",
              "apple"
            ]
          },
          "uuid": {
            "type": "string",
            "description": "Normalised device UUID (GPU-/MIG- prefix stripped, lowercase)."
          },
          "memory_total_bytes": {
            "$ref": "#/$defs/DecimalString"
          },
          "unified_memory_used_bytes": {
            "$ref": "#/$defs/DecimalString"
          },
          "health": {
            "type": "object",
            "description": "Absent = this vendor gives no health signal. ok=false carries the reason.",
            "required": [
              "ok"
            ],
            "properties": {
              "ok": {
                "type": "boolean"
              },
              "reason": {
                "type": "string"
              }
            }
          },
          "source": {
            "type": "string",
            "enum": [
              "lib",
              "cli",
              "sysfs"
            ]
          }
        }
      }
    },
    "host": {
      "type": "object",
      "properties": {
        "cpu_utilization_pct": {
          "type": "number",
          "minimum": 0,
          "maximum": 100
        },
        "memory_used_bytes": {
          "$ref": "#/$defs/DecimalString"
        },
        "disk_free_bytes": {
          "$ref": "#/$defs/DecimalString"
        },
        "uptime_s": {
          "$ref": "#/$defs/DecimalString"
        },
        "load1": {
          "type": "number",
          "minimum": 0
        }
      }
    }
  },
  "$defs": {
    "DecimalString": {
      "type": "string",
      "pattern": "^(0|[1-9][0-9]*)$",
      "description": "Unsigned base-10 integer as string; never a float."
    }
  }
}