diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 35ec720aab9..20b2cff3758 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -338,6 +338,8 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - Fix GCP not able to request Cloudfunctions metrics if a region filter was set {pull}24218[24218] - Fix type of `uwsgi.status.worker.rss` type. {pull}24468[24468] - Accept text/plain type by default for prometheus client scraping. {pull}24622[24622] +- Use working set bytes to calculate the pod memory limit pct when memory usage is not reported (ie. Windows pods). {pull}25428[25428] +- Fix copy-paste error in libbeat docs. {pull}25448[25448] *Packetbeat* diff --git a/metricbeat/module/kubernetes/pod/data.go b/metricbeat/module/kubernetes/pod/data.go index 306ba1c06b3..bb24d31905c 100644 --- a/metricbeat/module/kubernetes/pod/data.go +++ b/metricbeat/module/kubernetes/pod/data.go @@ -118,16 +118,26 @@ func eventMapping(content []byte, perfMetrics *util.PerfMetricsCache) ([]common. podEvent.Put("cpu.usage.node.pct", float64(usageNanoCores)/1e9/nodeCores) } - if nodeMem > 0 { - podEvent.Put("memory.usage.node.pct", float64(usageMem)/nodeMem) - } - if coresLimit > 0 { podEvent.Put("cpu.usage.limit.pct", float64(usageNanoCores)/1e9/coresLimit) } - if memLimit > 0 { - podEvent.Put("memory.usage.limit.pct", float64(usageMem)/memLimit) + if usageMem > 0 { + if nodeMem > 0 { + podEvent.Put("memory.usage.node.pct", float64(usageMem)/nodeMem) + } + if memLimit > 0 { + podEvent.Put("memory.usage.limit.pct", float64(usageMem)/memLimit) + } + } + + if workingSet > 0 && usageMem == 0 { + if nodeMem > 0 { + podEvent.Put("memory.usage.node.pct", float64(workingSet)/nodeMem) + } + if memLimit > 0 { + podEvent.Put("memory.usage.limit.pct", float64(workingSet)/memLimit) + } } events = append(events, podEvent)