expose more accounting metrics #172
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR follows up on #87.
systemd_exporter
already collects Task and IP Accounting metrics from systemd via dbus. This PR goes a step further to also collect IO, CPU, and Memory Accounting metrics.The new metric names are noted in the README.
In my environment, this is preferable to deploying cAdvisor for at least a couple reasons:
unit, rather than service
Since systemd has accounting metrics for more units than just services, these new metrics are collected for all relevant unit types. They are accordingly named
systemd_unit_*
instead ofsystemd_service_*
. The unit types this data is collected for are those noted insystemd.resource-control(5)
.While this broader scope (no systemd .scope pun intended) for Accounting metrics would be relevant to the existing Task and IP Accounting metrics, I decided to leave them as-is to keep this PR's scope limited to adding new functionality. In the future, I do think it would make sense to modifycollectServiceTasksMetrics()
andcollectIPAccountingMetrics()
to work for these other unit types as well. Presumably, those metrics would keep their existing names (systemd_service_*
) rather than changing the names; hard to imagine that breaking backwards compatibility would be worth the increased accuracy of a new name.Task and IP Accounting metrics are now also collected for these unit types. The IP Accounting metrics are still called
systemd_service_*
instead of being changed tosystemd_unit_*
in order to preserve backwards compatibility.minor tweak
The only change I've made to existing functionality is to not collect IP Accounting metrics that are null/unset (i.e. set to
MaxUint64
). This accords with existing behavior in the codebase, and seems like clearly the right thing to do--rather than creating useless/irrelevant labelsets.dashboard
I've also taken a crack at adding these metrics to the dashboard that was mentioned here: https://grafana.com/grafana/dashboards/23844-systemd-exporter/
Edit: also added a multiselect dropdown for filtering units
other
I have a release with linux-amd64 built on my fork. It's just for my own use, but if anyone wants to quickly try out these changes without needing to build themselves, feel free to use it.