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

ref!: convert linux meminfo implementation to use procfs lib #3049

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

tjhop
Copy link

@tjhop tjhop commented Jun 12, 2024

Part of #2957

Prometheus' procfs lib supports collecting memory info and we're using a
new enough version of the lib that has it available, so this converts
the meminfo collector for Linux to use data from procfs lib instead. The
bits I've touched for darwin/openbsd/netbsd are with intent to preserve
the original struct implementation/backwards compatibility.

Signed-off-by: TJ Hoplock t.hoplock@gmail.com

@tjhop
Copy link
Author

tjhop commented Jun 12, 2024

Looking at the failing tests

@tjhop
Copy link
Author

tjhop commented Jun 13, 2024

@SuperQ would you mind taking a look when you get time? Lemme know your thoughts 👍

collector/collector.go Outdated Show resolved Hide resolved
@tjhop
Copy link
Author

tjhop commented Jun 13, 2024

Ah, good point, I appreciate the forethought. I'll rework it to not coerce nils and leave them out 👍

Part of prometheus#2957

Prometheus' procfs lib supports collecting memory info and we're using a
new enough version of the lib that has it available, so this converts
the meminfo collector for Linux to use data from procfs lib instead. The
bits I've touched for darwin/openbsd/netbsd are with intent to preserve
the original struct implementation/backwards compatibility.

Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>
Fixes:

```
ts=2024-06-11T19:04:55.591Z caller=meminfo.go:44 level=debug collector=meminfo msg="Set node_mem" memInfo="unsupported value type"
```

Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>
Nil entries in procfs.Meminfo fields indicate that the value isn't
present on the system. Coercing those nil values to `0` introduces new
metrics on systems that should not be present and can break some
queries.

Addresses PR feedback:
prometheus#3049 (comment)
prometheus#3049 (comment)

Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>
@tjhop tjhop force-pushed the feat/meminfo-collector-procfs-lib branch from 4ee485e to d088970 Compare June 14, 2024 04:33
@tjhop
Copy link
Author

tjhop commented Jun 14, 2024

@SuperQ is this more in line with what you were thinking?

@SuperQ
Copy link
Member

SuperQ commented Jun 16, 2024

Yes, this is looking much better. I'll try and do a deeper review soon.

@tjhop
Copy link
Author

tjhop commented Jul 1, 2024

Friendly bump. @SuperQ please lemme know if you have any further thoughts 👍

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.

None yet

2 participants