gregg-protocol 1.0.3

Versioned JSON wire types, metric capabilities, and identity structures shared by the gregg daemon and client.
Documentation

gregg-protocol

Versioned JSON wire types, metric capabilities, and identity structures shared by the gregg daemon and client.

Usage

use gregg_protocol::StatusSnapshot;

let json = r#"{
  "schema_version": 1,
  "observed_at_unix_ms": 1716460800000,
  "sample_interval_ms": 1000,
  "capabilities": {"cpu_iowait": true},
  "system": {
    "name": "deadpool", "hostname": "deadpool.local",
    "os_name": "linux", "os_version": "Ubuntu 24.04",
    "kernel_name": "Linux", "kernel_release": "6.8.0-31-generic",
    "architecture": "x86_64"
  },
  "cpu": {"logical_cores": 8, "usage_pct": 25.2, "iowait_pct": 0.4},
  "load": {"one": 1.32, "five": 0.91, "fifteen": 0.62},
  "memory": {"used_bytes": 5900000000, "total_bytes": 15600000000, "usage_pct": 37.8},
  "swap": {"used_bytes": 0, "total_bytes": 4000000000, "usage_pct": 0.0}
}"#;

let snapshot: StatusSnapshot = serde_json::from_str(json).unwrap();
assert!(snapshot.validate().is_ok());

Intentionally dependency-light: only serde, serde_json, and thiserror. No runtime, HTTP, or terminal libraries are included.

Version 2 status responses use a flat StatusPayloadV2 wrapper. Its optional drives field carries bounded numeric capacity records; missing means unavailable/legacy and an empty list means successful empty enumeration.

Links

License

MIT