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

buddyinfo: Add support for /proc/buddyinfo for linux free memory fragmentation. #454

Merged
merged 7 commits into from
Feb 16, 2017

Conversation

thorhs
Copy link

@thorhs thorhs commented Feb 6, 2017

/proc/buddyinfo returns data on the free blocks fragments available
for use from the kernel. This data is useful when diagnosing
possible memory fragmentation.

More info can be found in:

@mdlayher
Copy link
Contributor

mdlayher commented Feb 6, 2017

This may be a good subsystem to add to: https://github.com/prometheus/procfs.

That way, the core parsing, tests, and logic can remain there, while node_exporter can simply use the appropriate functions from procfs.

That said, this is just my suggestion, and I'll review this under the assumption that the code will remain here. Can always move it around later.

Copy link
Contributor

@mdlayher mdlayher left a comment

Choose a reason for hiding this comment

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

You'll also want to run the node_exporter and add your new metrics to the e2e-output.txt to verify that all the metrics expected are received.

@@ -0,0 +1,114 @@
// Copyright 2015 The Prometheus Authors
Copy link
Contributor

Choose a reason for hiding this comment

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

@@ -0,0 +1,40 @@
// Copyright 2015 The Prometheus Authors
Copy link
Contributor

Choose a reason for hiding this comment

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

var err error
line := scanner.Text()
parts := strings.Fields(string(line))
node := strings.TrimRight(parts[1], ",")
Copy link
Contributor

Choose a reason for hiding this comment

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

You'll need a bounds-check on parts to avoid panics here in case of malformed file. I know it's quite unlikely but better to add a couple safeguards (and tests to ensure they work) than to have node_exporter start panicking later.

Copy link
Author

Choose a reason for hiding this comment

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

I fixed this when I moved it over to the procfs library.

@mdlayher
Copy link
Contributor

mdlayher commented Feb 6, 2017

Oh! This should also be documented in the README under "disabled by default".

@thorhs
Copy link
Author

thorhs commented Feb 6, 2017

Thanks for the feedback, I'll look into it and resubmit.

@mdlayher
Copy link
Contributor

mdlayher commented Feb 7, 2017

Cool, I'll review this again once the new version of procfs is vendored and build is green.

@mdlayher
Copy link
Contributor

Hey @thorhs , now that #465 is merged, mind rebasing this on master?

@thorhs
Copy link
Author

thorhs commented Feb 15, 2017

Done, should I update any other files, like AUTHORS.md or CHAGELOG.md?

@mdlayher
Copy link
Contributor

If this is your first contribution, just go ahead and update AUTHORS. The maintainers will take care of the rest!

Copy link
Contributor

@mdlayher mdlayher left a comment

Choose a reason for hiding this comment

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

LGTM.

@SuperQ SuperQ changed the title Adding support for /proc/buddyinfo for linux free memory fragmentation. buddyinfo: Add support for /proc/buddyinfo for linux free memory fragmentation. Feb 16, 2017
Copy link
Member

@SuperQ SuperQ left a comment

Choose a reason for hiding this comment

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

LGTM

@SuperQ SuperQ merged commit 6bf0409 into prometheus:master Feb 16, 2017
@grobie grobie mentioned this pull request Mar 7, 2017
tamcore pushed a commit to gitgrave/node_exporter that referenced this pull request Oct 22, 2024
* Update minimum supported version to 1.17.
* Update Go modules.
* Enable dependabot.

Signed-off-by: SuperQ <superq@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants