Skip to main content

euv_performance/observability/
enum.rs

1use super::*;
2
3/// Supported target platforms enumerated in `schemas/report-v1.schema.json`.
4#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
5#[serde(rename_all = "lowercase")]
6pub enum ObservabilityPlatform {
7    /// Browser Web / WASM host.
8    Web,
9    /// Android mobile host.
10    Android,
11    /// Apple iOS phone host.
12    Ios,
13    /// Apple iPadOS tablet host.
14    Ipados,
15    /// Microsoft Windows desktop host.
16    Windows,
17    /// Apple macOS desktop host.
18    Macos,
19    /// Linux desktop/server host.
20    Linux,
21    /// Huawei HarmonyOS / OpenHarmony host.
22    Harmonyos,
23    /// Wearable watch/band host.
24    Wearable,
25    /// MiniApp container host.
26    Miniapp,
27    /// QuickApp container host.
28    Quickapp,
29    /// Terminal PTY / CLI host.
30    Terminal,
31}
32
33/// Execution environment honesty tag for an observability report.
34#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
35#[serde(rename_all = "snake_case")]
36pub enum ObservabilityExecutionKind {
37    /// Physical target device or real OS desktop session.
38    RealDevice,
39    /// Android/HarmonyOS/Wearable emulator.
40    Emulator,
41    /// Apple iOS/iPadOS simulator.
42    Simulator,
43    /// In-process headless software renderer.
44    Headless,
45    /// Pseudo-terminal (PTY) character grid host.
46    Pty,
47    /// Piped stdin/stdout CLI host.
48    CliPipe,
49}
50
51/// Four-state observability report verdict (`pass`, `fail`, `inconclusive`, `unsupported`).
52#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
53#[serde(rename_all = "snake_case")]
54pub enum ObservabilityStatus {
55    /// Every required scope measured, every threshold met, and zero blocking findings.
56    Pass,
57    /// Confirmed regression, threshold breach, or confirmed leak.
58    Fail,
59    /// Required coverage missing, permission denied, or insufficient samples.
60    Inconclusive,
61    /// Target platform or metric family not supported by the active backend.
62    Unsupported,
63}
64
65/// Per-scope measurement coverage classification.
66#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
67#[serde(rename_all = "snake_case")]
68pub enum ObservabilityCoverageStatus {
69    /// Scope was actively collected and verified.
70    Measured,
71    /// Scope could not be collected on this run.
72    Missing,
73    /// Scope is not supported on this platform/host.
74    Unsupported,
75    /// Scope does not apply to this platform/backend.
76    NotApplicable,
77}
78
79/// Per-metric measurement availability classification.
80#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
81#[serde(rename_all = "snake_case")]
82pub enum ObservabilityMetricStatus {
83    /// Metric was validly measured.
84    Measured,
85    /// Metric was not measured (numeric fields must be null).
86    Unmeasured,
87    /// Metric is unsupported on this host.
88    Unsupported,
89    /// Metric is not applicable to this platform/backend.
90    NotApplicable,
91    /// OS or container permissions blocked collection.
92    PermissionDenied,
93    /// Too few samples collected for a statistically valid result.
94    InsufficientSamples,
95}
96
97/// Canonical metric units allowed by `schemas/report-v1.schema.json`.
98#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
99#[serde(rename_all = "snake_case")]
100pub enum ObservabilityUnit {
101    /// Raw byte count.
102    Bytes,
103    /// Discrete dimensionless count.
104    Count,
105    /// Milliseconds.
106    Ms,
107    /// Microseconds.
108    Us,
109    /// Percentage in `[0.0, 100.0]`.
110    Percent,
111    /// Frequency in Hertz.
112    Hz,
113    /// Throughput in bytes per second.
114    BytesPerSec,
115    /// Ratio in `[0.0, 1.0]`.
116    Ratio,
117    /// Temperature in degrees Celsius.
118    Celsius,
119}
120
121/// Canonical summary statistic tag for an observability metric sample.
122#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
123#[serde(rename_all = "snake_case")]
124pub enum ObservabilityStatistic {
125    /// Point scalar observation.
126    Value,
127    /// Median (50th percentile).
128    P50,
129    /// 95th percentile.
130    P95,
131    /// 99th percentile.
132    P99,
133    /// Maximum observed value.
134    Max,
135    /// Arithmetic mean.
136    Mean,
137    /// Minimum observed value.
138    Min,
139    /// Event rate over window.
140    Rate,
141    /// Live object/allocation count.
142    LiveCount,
143    /// Cumulative window total.
144    Total,
145    /// Linear slope per lifecycle cycle.
146    Slope,
147}
148
149/// Threshold evaluation rule attached to a metric.
150#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
151#[serde(rename_all = "snake_case")]
152pub enum ObservabilityThresholdRule {
153    /// Observed scalar value must be `<= threshold`.
154    Max,
155    /// Observed scalar value must be `>= threshold`.
156    Min,
157    /// Observed `slope_per_cycle` must be `<= threshold`.
158    MaxSlopePerCycle,
159    /// Observed destroyed-owner `after_drain` count must be `<= threshold`.
160    MaxDestroyedOwnerCount,
161    /// Observed `after_drain` value must be `<= threshold`.
162    MaxAfterDrain,
163    /// Observed value must match `threshold` within tolerance.
164    Exact,
165}
166
167/// Forensic classification for an entry in `findings`.
168#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
169#[serde(rename_all = "snake_case")]
170pub enum ObservabilityFindingClass {
171    /// Intentionally retained bounded cache or frozen page within budget.
172    ExpectedRetained,
173    /// Confirmed resource or memory leak attributed to an owner.
174    UnexpectedLeak,
175    /// Performance or parity budget violation.
176    BudgetViolation,
177    /// Monotonic resource growth lacking owner attribution.
178    UnattributedGrowth,
179}