Summary
pkg/rules/types.go defines a Signal struct that drives the inline request ████░░░░ limit ratio bars shown in the ASCII report. Of the 15 cost detectors, 7 already emit Signal; 8 still return an empty Signal{}. Without Signal data the bar is omitted and the finding is less actionable.
Detectors that need Signal wired up
| Detector file |
Ratio to surface |
oversized_limits_cpu.go |
request CPU / limit CPU |
oversized_limits_memory.go |
request memory / limit memory |
excessive_replicas.go |
current replicas / recommended max |
tiny_request_cpu.go |
request CPU / practical minimum |
tiny_request_memory.go |
request memory / practical minimum |
incomplete_request_cpu.go |
n/a — show Have/Want string labels |
incomplete_request_memory.go |
n/a — show Have/Want string labels |
What to do
For each detector listed above, populate the Signal field on every Finding it emits:
Signal: rules.Signal{
Label: "CPU",
Have: float64(w.Requests.CPU.Value),
Want: float64(w.Limits.CPU.Value),
HaveDisplay: w.Requests.CPU.String(),
WantDisplay: w.Limits.CPU.String(),
// Note: optional clarification shown under the bar
},
For incomplete_request_* detectors where one side is unset, use HaveDisplay/WantDisplay string labels (e.g., "unset") rather than numeric bars.
Acceptance criteria
- All 8 detectors above emit a non-zero
Signal on their Finding.
optiqor demo shows ratio bars for every cost finding.
- Existing golden tests pass without modification, or golden files are updated with
go test ./... -update.
make lint test passes.
References
Signal definition: pkg/rules/types.go
- Example detector with Signal already wired:
pkg/rules/cpu_overprovisioned.go
- Renderer that consumes Signal:
internal/render/text.go (search for Signal)
Summary
pkg/rules/types.godefines aSignalstruct that drives the inlinerequest ████░░░░ limitratio bars shown in the ASCII report. Of the 15 cost detectors, 7 already emitSignal; 8 still return an emptySignal{}. Without Signal data the bar is omitted and the finding is less actionable.Detectors that need Signal wired up
oversized_limits_cpu.gooversized_limits_memory.goexcessive_replicas.gotiny_request_cpu.gotiny_request_memory.goincomplete_request_cpu.goincomplete_request_memory.goWhat to do
For each detector listed above, populate the
Signalfield on everyFindingit emits:For
incomplete_request_*detectors where one side is unset, useHaveDisplay/WantDisplaystring labels (e.g.,"unset") rather than numeric bars.Acceptance criteria
Signalon theirFinding.optiqor demoshows ratio bars for every cost finding.go test ./... -update.make lint testpasses.References
Signaldefinition:pkg/rules/types.gopkg/rules/cpu_overprovisioned.gointernal/render/text.go(search forSignal)