Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scollector: include slab as free mem for linux os.mem #2250

merged 2 commits into from May 16, 2018


Copy link

This mimics the free command: "cache Memory used by the page cache and slabs (Cached and Slab in /proc/meminfo)"

This mimics the free command: "cache Memory used by the page cache and slabs (Cached and Slab in /proc/meminfo)"
Add(&md, osMemTotal, int(mem["MemTotal"])*1024, nil, metadata.Gauge, metadata.Bytes, osMemTotalDesc)
Add(&md, osMemFree, (int(mem["MemFree"])+int(mem["Buffers"])+int(mem["Cached"]))*1024, nil, metadata.Gauge, metadata.Bytes, osMemFreeDesc)
Add(&md, osMemUsed, (int(mem["MemTotal"])-(int(mem["MemFree"])+int(mem["Buffers"])+int(mem["Cached"])))*1024, nil, metadata.Gauge, metadata.Bytes, osMemUsedDesc)
bufferCacheSlab := mem["Buffers"] + mem["Cached"] + mem["Slab"]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of repetition of mem["stringConstant"] here. Would it make sense to define a few variables and reuse them?

@kylebrandt kylebrandt merged commit 98f88d6 into master May 16, 2018
@kylebrandt kylebrandt deleted the linux_mem branch June 28, 2018 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants