Skip to content

Populate Signal bars on 8 remaining cost detectors #13

@oksaumya

Description

@oksaumya

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions