Skip to content

Make ServiceStats fields nullable to avoid zero-filled output (#183)#184

Open
aleivag wants to merge 1 commit into
cooperlees:mainfrom
aleivag:nullable-service-stats
Open

Make ServiceStats fields nullable to avoid zero-filled output (#183)#184
aleivag wants to merge 1 commit into
cooperlees:mainfrom
aleivag:nullable-service-stats

Conversation

@aleivag
Copy link
Copy Markdown
Collaborator

@aleivag aleivag commented May 13, 2026

The varlink path creates ServiceStats entries for every service unit via NRestarts metrics, but only populates nrestarts — the remaining 15 fields were emitted as zeros. On a system with ~390 services this produced ~6,270 useless and false JSON keys.

Making all ServiceStats fields Option with skip_serializing_if means only fields with actual data are emitted. The D-Bus path wraps all values in Some(), so its output is unchanged. The varlink path now emits only nrestarts per service instead of 16 fields.

now we only produce 3224 metrics but they all are true

…lees#183)

The varlink path creates ServiceStats entries for every service unit
via NRestarts metrics, but only populates nrestarts — the remaining
15 fields were emitted as zeros. On a system with ~390 services this
produced ~6,270 useless JSON keys.

Making all ServiceStats fields Option<T> with skip_serializing_if
means only fields with actual data are emitted. The D-Bus path wraps
all values in Some(), so its output is unchanged. The varlink path
now emits only nrestarts per service instead of 16 fields.
@aleivag aleivag marked this pull request as ready for review May 13, 2026 21:34
Copy link
Copy Markdown
Owner

@cooperlees cooperlees left a comment

Choose a reason for hiding this comment

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

As discussed, I think I'd rather fix or revert the change for this to try and use varlink if we can't fix it in the near term and just use dbus ...

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.

2 participants