Expand description
Sensor report building for cockpit integration.
This crate provides the SensorReportBuilder for wrapping a PerfgateReport
into a sensor.report.v1 envelope suitable for cockpit integration.
§Overview
The sensor report is a standardized envelope format for CI/CD cockpit systems. It wraps performance benchmark results with:
- Tool metadata (name, version)
- Run metadata (timestamps, duration)
- Capabilities (baseline availability, engine features)
- Verdict (pass/warn/fail with counts)
- Findings (individual check results with fingerprints)
- Artifacts (links to detailed reports)
§Example
use perfgate_sensor::{SensorReportBuilder, sensor_fingerprint, default_engine_capability};
use perfgate_types::{ToolInfo, PerfgateReport, SensorReport, CapabilityStatus};
let tool = ToolInfo {
name: "perfgate".to_string(),
version: "0.1.0".to_string(),
};
// Build a fingerprint for a finding
let fp = sensor_fingerprint(&["perfgate", "perf.budget", "metric_fail", "wall_ms"]);
assert_eq!(fp.len(), 64); // SHA-256 hex
// Check default engine capability (varies by platform)
let cap = default_engine_capability();
if cfg!(unix) {
assert_eq!(cap.status, CapabilityStatus::Available);
} else {
assert_eq!(cap.status, CapabilityStatus::Unavailable);
}
// Build a sensor report (with a minimal PerfgateReport)
// See SensorReportBuilder documentation for full example.Structs§
- Sensor
Report Builder - Builder for constructing a SensorReport from a PerfgateReport.
Enums§
- Bench
Outcome - A single bench’s outcome for aggregation into a sensor report.
Functions§
- default_
engine_ capability - Build a default engine capability based on the current platform.
- sensor_
fingerprint - Build a fleet-standard fingerprint from semantic parts.