package analyzer // Severity is the heuristic finding severity. type Severity string const ( SeverityInfo Severity = "info" SeverityWarning Severity = "warning" SeverityCritical Severity = "critical" ) // Finding is a single triggered heuristic rule. type Finding struct { Rule string `json:"rule"` Severity Severity `json:"severity"` Stage string `json:"stage,omitempty"` Evidence map[string]any `json:"evidence"` Message string `json:"message"` } // Thresholds holds analyzer thresholds injected at runtime. type Thresholds struct { DataSkewRatio float64 GCPressureRatio float64 BottleneckShuffleGB float64 } // Input is the data passed to the heuristic rules. type Input struct { StageMetrics map[string]StageMetric `json:"stage_metrics"` ExecutorMetrics map[string]ExecutorMetric `json:"executor_metrics"` } // StageMetric contains per-stage measurements. type StageMetric struct { DurationMS int64 `json:"duration_ms"` ShuffleReadBytes int64 `json:"shuffle_read_bytes"` ShuffleWriteBytes int64 `json:"shuffle_write_bytes"` MaxPartitionBytes int64 `json:"max_partition_bytes"` MinPartitionBytes int64 `json:"min_partition_bytes"` } // ExecutorMetric contains per-executor measurements. type ExecutorMetric struct { GCTimeMS int64 `json:"gc_time_ms"` CPUTimeMS int64 `json:"cpu_time_ms"` }