Draft
Conversation
a83624a to
9949284
Compare
daandemeyer
suggested changes
Oct 16, 2025
daandemeyer
left a comment
There was a problem hiding this comment.
Can you split the commit introducing the metrics and the report CLI into two separate commits?
ikruglov
suggested changes
Oct 16, 2025
ikruglov
suggested changes
Oct 16, 2025
9949284 to
3b31a87
Compare
YapingLi04
commented
Oct 17, 2025
Owner
Author
YapingLi04
left a comment
There was a problem hiding this comment.
Addressed all the comments.
There are few unresolved comments which I had follow up questions or comments.
I made changes in the topmost commit and didn't do it in the two commits where the comments were. This way I can test the code still works. I will split the changes in the local units in the upstream PR.
daandemeyer
reviewed
Oct 17, 2025
ikruglov
suggested changes
Oct 17, 2025
3b31a87 to
3ab5a85
Compare
Owner
Author
|
Added type specific will address remaining comment in the next around. |
ikruglov
suggested changes
Oct 17, 2025
158998c to
deeed86
Compare
ikruglov
suggested changes
Oct 21, 2025
fd59672 to
025abeb
Compare
ikruglov
reviewed
Oct 22, 2025
025abeb to
0633618
Compare
0633618 to
86865e4
Compare
067174f to
f4f0de4
Compare
65a4874 to
77b819c
Compare
00668ef to
14626bc
Compare
cb45273 to
7ae31ca
Compare
This commit introduces the shared code for the metrics API framework: - Metrics API definitions - Code to set up the varlink server - The describe method which shows all the metrics families - The list method which lists all the metrics - Type definitions related to MetricFamily - Common code to build json objects
This commit adds some basic metrics and integration tests.
System wide metrics:
- units_by_type_total: target/device/automount etc.
- units_by_state_total: active/reloading/inactive etc.
Two per unit metrics which shows the current state of a unit:
- unit_active_state
- unit_load_state
A metric for service state:
- nrestarts
Here are some sample outputs:
units_by_type_total:
{
"name" : "io.systemd.Manager.units_by_type_total",
"value" : 52,
"fields" : {
"type" : "target"
}
}
{
"name" : "io.systemd.Manager.units_by_type_total",
"value" : 82,
"fields" : {
"type" : "device"
}
}
{
"name" : "io.systemd.Manager.units_by_type_total",
"value" : 2,
"fields" : {
"type" : "automount"
}
}
units_by_state_total:
{
"name" : "io.systemd.Manager.units_by_state_total",
"value" : 216,
"fields" : {
"state" : "active"
}
}
{
"name" : "io.systemd.Manager.units_by_state_total",
"value" : 0,
"fields" : {
"state" : "reloading"
}
}
{
"name" : "io.systemd.Manager.units_by_state_total",
"value" : 120,
"fields" : {
"state" : "inactive"
}
}
unit_active_state:
{
"name" : "io.systemd.Manager.unit_active_state",
"object" : "multi-user.target",
"value" : "active"
}
{
"name" : "io.systemd.Manager.unit_active_state",
"object" : "systemd-sysusers.service",
"value" : "inactive"
}
unit_load_state:
{
"name" : "io.systemd.Manager.unit_load_state",
"object" : "multi-user.target",
"value" : "loaded"
}
nrestarts:
{
"name" : "io.systemd.Manager.nrestarts",
"object" : "user@0.service",
"value" : 0
}
{
"name" : "io.systemd.Manager.nrestarts",
"object" : "user-runtime-dir@0.service",
"value" : 0
}
systemd-report will list all the metrics.
7ae31ca to
56eeda4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.