Conversation
f3f0f23 to
a58483a
Compare
a58483a to
6bb9605
Compare
a08c235 to
d752c3d
Compare
dcf9f85 to
22c1de9
Compare
fb58f07 to
d522db9
Compare
435e127 to
0d405ec
Compare
067174f to
f4f0de4
Compare
ed64627 to
9d0b19e
Compare
7ae31ca to
56eeda4
Compare
56eeda4 to
561078a
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.
561078a to
c498f37
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.
See the design doc by @ikruglov
This PR introduces the metrics API framework, adds some basic system wide and per unit metrics, and a basic CLI. The PR is broken into two commits as described below.
First commit
The first commit includes:
Second commit
The second commit adds some basic metrics, a basic CLI (systemd-report) which
lists the metrics, and integration tests.
System wide metrics:
Two per unit metrics:
A service state metric:
Deviations from the original design
fields: { unit: "foo", unit_type: "service" }, we now haveobject: foo.serviceas the top level field.Sample outputs
units_by_type_total:
units_by_state_total:
unit_active_state:
unit_load_state:
nrestarts: