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

Add bcache collector #597

Merged
merged 17 commits into from
Jul 7, 2017
Merged

Add bcache collector #597

merged 17 commits into from
Jul 7, 2017

Conversation

ideaship
Copy link
Contributor

@ideaship ideaship commented Jun 8, 2017

Rebased version of PR #594.

@SuperQ SuperQ changed the title Bcache 08 Add bcache collector Jun 8, 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 requested a review from grobie June 8, 2017 13:52
@ideaship
Copy link
Contributor Author

This changeset needs an update because some of its fixture filenames break Windows the same way they did for procfs.

Copy link
Member

@grobie grobie left a comment

Choose a reason for hiding this comment

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

Sorry for the late review. This looks good.

How many metrics can be created with the collector in a real production system? Specifically, how many label values for the UUID label are realistic? Below 10 per node?

I don't really care how we solve the filename issue for windows. I'm not entirely happy with the rename approach, but all approaches have drawbacks. I think my favorite would still be something like a plaintext tarball / yaml file. Use whatever is easiest, but it must not break tests when someone changes the fixture files.

@SuperQ
Copy link
Member

SuperQ commented Jun 18, 2017

We were talking about dropping windows support for the node_exporter anyway. Now that the WMI exporter is a much better replacement.

@grobie
Copy link
Member

grobie commented Jun 18, 2017 via email

@ideaship
Copy link
Contributor Author

Specifically, how many label values for the UUID label are realistic? Below 10 per node?

Several per node is realistic. I have never seen 10 or more. In my limited experience having a few caching SSDs and one bcache device (i.e., one UUID) per SSD is typical. YMMV.

@ideaship
Copy link
Contributor Author

Needs rebasing.

ideaship added 17 commits July 6, 2017 12:08
This collector gathers metrics related to the Linux block cache
(bcache) from sysfs.
Rename:
- metric -> bcacheMetric
- periodStatsToMetrics -> bcachePeriodStatsToMetric
This changeset moves the collector/fixtures/sys directory into
collector/fixtures/sys.tar.gz and tweaks the Makefile to unpack the
tarball before tests are run.

The reason for this change is that Windows does not allow colons in a
path (colons are present in some of the bcache fixture files), nor can
it (out of the box) deal with pathnames longer than 260 characters
(which we would be increasingly likely to hit if we tried to replace
colons with longer codes that are guaranteed not the turn up in regular
file names).
This changeset adds ttar, a plain text replacement for tar, and uses it
for the sysfs fixture archive. The syntax is loosely based on tar(1).

Using a plain text archive makes it possible to review changes without
downloading and extracting the archive. Also, when working on the repo,
git diff and git log become useful again, allowing a committer to verify
and track changes over time.

The code is written in bash, because bash is available out of the box on
all major flavors of Linux and on macOS. The feature set used is
restricted to bash version 3.2 because that is what Apple is still
shipping.

The programm also works on Windows if bash is installed. Obviously, it
does not solve the Windows limitations (path length limited to 260
characters, no symbolic links) that prompted the move to an archive
format in the first place.
@ideaship
Copy link
Contributor Author

ideaship commented Jul 6, 2017

I have added ttar (like in procfs). The changeset is also rebased against current master. @grobie, @SuperQ, can you take another look?

@SuperQ
Copy link
Member

SuperQ commented Jul 7, 2017

Great, thanks!

@SuperQ SuperQ merged commit 8d90276 into prometheus:master Jul 7, 2017
@ideaship ideaship deleted the bcache_08 branch July 7, 2017 06:04
@sathieu
Copy link

sathieu commented Sep 20, 2017

Can someone publish a new release including bcache?

Thanks

oblitorum pushed a commit to shatteredsilicon/node_exporter that referenced this pull request Apr 9, 2024
* Add bcache collector for Linux

This collector gathers metrics related to the Linux block cache
(bcache) from sysfs.

* Removed commented out code

* Use project comment style

* Add _sectors to metric name to indicate unit

* Really use project comment style

* Rename bcache.go to bcache_linux.go

* Keep collector namespace clean

Rename:
- metric -> bcacheMetric
- periodStatsToMetrics -> bcachePeriodStatsToMetric

* Shorten slice initialization

* Change label names to backing_device, cache_device

* Remove five minute metrics (keep only total)

* Include units in additional metric names

* Enable bcache collector by default

* Provide metrics in seconds, not nanoseconds

* remove metrics with label "all"

* Add fixtures, update end-to-end for bcache collector

* Move fixtures/sys into tar.gz

This changeset moves the collector/fixtures/sys directory into
collector/fixtures/sys.tar.gz and tweaks the Makefile to unpack the
tarball before tests are run.

The reason for this change is that Windows does not allow colons in a
path (colons are present in some of the bcache fixture files), nor can
it (out of the box) deal with pathnames longer than 260 characters
(which we would be increasingly likely to hit if we tried to replace
colons with longer codes that are guaranteed not the turn up in regular
file names).

* Add ttar: plain text archive, replacement for tar

This changeset adds ttar, a plain text replacement for tar, and uses it
for the sysfs fixture archive. The syntax is loosely based on tar(1).

Using a plain text archive makes it possible to review changes without
downloading and extracting the archive. Also, when working on the repo,
git diff and git log become useful again, allowing a committer to verify
and track changes over time.

The code is written in bash, because bash is available out of the box on
all major flavors of Linux and on macOS. The feature set used is
restricted to bash version 3.2 because that is what Apple is still
shipping.

The programm also works on Windows if bash is installed. Obviously, it
does not solve the Windows limitations (path length limited to 260
characters, no symbolic links) that prompted the move to an archive
format in the first place.
tamcore pushed a commit to gitgrave/node_exporter that referenced this pull request Oct 22, 2024
Signed-off-by: Thomas Barrett <[email protected]>
Co-authored-by: Thomas Barrett <[email protected]>
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.

4 participants