Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Reporter ¶
Reporter periodically inspects the process's memory and, once it crosses a threshold, logs where that memory is going.
It exists because a container that is OOMKilled at its cgroup limit is otherwise opaque: the process dies without saying what grew, and the runtime metrics on /metrics say only *how much*, never *which code*. A heap profile would answer that, but only if something can reach the debug endpoint — which is exactly what is unavailable when the pod is crash-looping behind a cluster-internal Service. This reporter writes the same information to the service log, which is readable with nothing but `kubectl logs`.
func New ¶
New returns a Reporter that ticks every interval and, when the Go heap in use or the container's cgroup usage reaches thresholdBytes, logs a breakdown.
Both signals are checked because they fail independently: the cgroup figure includes page cache, so a container can sit at its limit with a tiny heap, while a runaway allocation can exceed the threshold long before the cgroup notices. Reporting only one would miss the other's failure mode.
topN bounds how many allocation sites are logged per report, largest first.