elastic / opentelemetry-lib

Apache License 2.0
0 stars 6 forks source link

[Hostmetrics: Memory] Difference in values of cached memory #21

Open ishleenk17 opened 2 weeks ago

ishleenk17 commented 2 weeks ago

There is a difference in the values being fetched for cached memory.

OTEL reports this metric using system.memory.usage, attribute: cached. On checking the logic, it fetches the cached value from /proc/meminfo and also add the reclaimed memory to it. https://github.com/shirou/gopsutil/blob/master/mem/mem_linux.go#L297

System Integration: Uses the cached memory directly from /proc/meminfo.

The difference in values seen is exactly equal to the reclaimed memory:

Eg: [OTEL] system.memory.usage, attr: cached= 6681276416 [OTEL] system.memory.usage, attr: slab_reclaimable = 372350976

[System Integration] = system.memory.cached = 6308524032 = 6681276416-372350976