[Backport 7.81.x] Add group_per_user_services option to windows_service#24176
Merged
Conversation
* Add group_per_user_services option to windows_service Strip the per-session LUID suffix from Windows per-user service instances so they report under their template name, reducing windows_service and display_name tag cardinality. Detection gates on the SERVICE_USERSERVICE_INSTANCE type flag plus a trailing _<LUID> suffix. Defaults to false. * Address review: type hints, comment, filter-mode test Add type hints to _group_per_user_service_name and drop the redundant suffix-search guard. Document the grouped-instance behavior (instances collapse to one series; last-emitted state wins) as a code comment. Add a test covering grouping when services are selected by name filter. * Add changelog entry * Reuse ServiceAssertion in group_per_user tests Use the existing ServiceAssertion / assert_service_check_and_metrics helpers in the group_per_user tests for consistency with the rest of the suite; this also asserts the uptime/state/restarts metrics, not just the service check. (cherry picked from commit 9212de9)
|
steveny91
approved these changes
Jun 25, 2026
Contributor
Author
Validation Report
Run Passed validations (20)
|
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.
Backport 9212de9 from #24087.
What does this PR do?
Adds an opt-in
group_per_user_servicesinstance option (defaultfalse) to thewindows_servicecheck. When enabled, Windows per-user service instances — named<template>_<LUID>(e.g.OneSyncSvc_443f50) — are reported under their template name in thewindows_service,display_name, and legacyservicetags. Detection gates on theSERVICE_USERSERVICE_INSTANCEservice-type flag plus a trailing_<LUID>suffix, so regular services are never rewritten.Motivation
The OS derives a unique LUID for each user logon session, and that LUID is appended to every per-user service name. Because the LUID differs per host (and per session), a single per-user service like
OneSyncSvcbecomes a distinctwindows_servicetag value on every host reporting it. Across a fleet, that is up to one unique tag value per host × ~15-20 per-user services, which explodeswindows_service/display_nametag cardinality in the backend — most visibly withservices: [ALL]. Grouping collapses all of those into a single template-named series org-wide.Review checklist (to be filled by reviewers)
qa/requiredif this PR needs QA validation, orqa/skip-qaif it does not. Exactly one of the two is required.backport/<branch-name>label to the PR and it will automatically open a backport PR once this one is merged