Add per_user services filter to windows_service#24088
Merged
steveny91 merged 5 commits intoJun 25, 2026
Merged
Conversation
Contributor
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: a1ef409 | Docs | Datadog PR Page | Give us feedback! |
clarkb7
force-pushed
the
branden.clark/windows-service-exclude-per-user
branch
from
June 17, 2026 16:50
840d15d to
72af051
Compare
Base automatically changed from
branden.clark/windows-service-group-per-user
to
master
June 24, 2026 21:30
Add a per_user (true/false) match criterion to the services filter, mirroring trigger_start, to select services by whether they are Windows per-user service instances. Configure per_user: false to exclude per-user services from collection. Warn when grouping is enabled alongside a per_user: false filter, since excluded services cannot be grouped.
Use the existing ServiceAssertion / assert_service_check_and_metrics helpers in the per_user tests for consistency with the rest of the suite; this also asserts the uptime/state/restarts metrics, not just the service check.
Pass the enumeration's ServiceType into ServiceView and have ServiceFilter.match read service_view.service_type, consistent with how it reads the other service properties, rather than threading service_type through match() as an argument.
Read service_type from the service config when it was not provided to the constructor, caching like the other ServiceView properties, and include it in __str__.
clarkb7
force-pushed
the
branden.clark/windows-service-exclude-per-user
branch
from
June 24, 2026 21:47
5aa01ad to
a1ef409
Compare
clarkb7
marked this pull request as ready for review
June 24, 2026 22:03
steveny91
approved these changes
Jun 24, 2026
jack0x2
approved these changes
Jun 25, 2026
Contributor
|
The backport to To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-7.80.x 7.80.x
# Navigate to the new working tree
cd .worktrees/backport-7.80.x
# Create a new branch
git switch --create backport-24088-to-7.80.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 3ca0f7de0a36adad7275e9761b189bda21c41524
# Push it to GitHub
git push --set-upstream origin backport-24088-to-7.80.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-7.80.xThen, create a pull request where the |
Contributor
|
The backport to To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-7.81.x 7.81.x
# Navigate to the new working tree
cd .worktrees/backport-7.81.x
# Create a new branch
git switch --create backport-24088-to-7.81.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 3ca0f7de0a36adad7275e9761b189bda21c41524
# Push it to GitHub
git push --set-upstream origin backport-24088-to-7.81.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-7.81.xThen, create a pull request where the |
3 tasks
steveny91
pushed a commit
that referenced
this pull request
Jun 25, 2026
* Add per_user services filter criterion to windows_service Add a per_user (true/false) match criterion to the services filter, mirroring trigger_start, to select services by whether they are Windows per-user service instances. Configure per_user: false to exclude per-user services from collection. Warn when grouping is enabled alongside a per_user: false filter, since excluded services cannot be grouped. * Add changelog entry * Reuse ServiceAssertion in per_user tests Use the existing ServiceAssertion / assert_service_check_and_metrics helpers in the per_user tests for consistency with the rest of the suite; this also asserts the uptime/state/restarts metrics, not just the service check. * Read service_type from ServiceView instead of a match() parameter Pass the enumeration's ServiceType into ServiceView and have ServiceFilter.match read service_view.service_type, consistent with how it reads the other service properties, rather than threading service_type through match() as an argument. * Make ServiceView.service_type lazy with config fallback Read service_type from the service config when it was not provided to the constructor, caching like the other ServiceView properties, and include it in __str__. (cherry picked from commit 3ca0f7d) Co-authored-by: Branden Clark <branden.clark@datadoghq.com>
3 tasks
Contributor
Validation ReportAll 21 validations passed. Show details
|
Kyle-Neale
pushed a commit
that referenced
this pull request
Jun 26, 2026
* Add per_user services filter criterion to windows_service Add a per_user (true/false) match criterion to the services filter, mirroring trigger_start, to select services by whether they are Windows per-user service instances. Configure per_user: false to exclude per-user services from collection. Warn when grouping is enabled alongside a per_user: false filter, since excluded services cannot be grouped. * Add changelog entry * Reuse ServiceAssertion in per_user tests Use the existing ServiceAssertion / assert_service_check_and_metrics helpers in the per_user tests for consistency with the rest of the suite; this also asserts the uptime/state/restarts metrics, not just the service check. * Read service_type from ServiceView instead of a match() parameter Pass the enumeration's ServiceType into ServiceView and have ServiceFilter.match read service_view.service_type, consistent with how it reads the other service properties, rather than threading service_type through match() as an argument. * Make ServiceView.service_type lazy with config fallback Read service_type from the service config when it was not provided to the constructor, caching like the other ServiceView properties, and include it in __str__. (cherry picked from commit 3ca0f7d) Co-authored-by: Branden Clark <branden.clark@datadoghq.com>
3 tasks
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.
What does this PR do?
Adds a
per_userboolean criterion to thewindows_serviceservicesfilter, mirroring the existingtrigger_startcriterion. A filter item can match services by whether they are Windows per-user service instances (named<template>_<LUID>, e.g.OneSyncSvc_443f50). To exclude per-user services from collection, configureper_user: falseto collect only non-per-user services:per_usercomposes withname,startup_type, andtrigger_startin any filter item. Whengroup_per_user_servicesis enabled alongside aper_user: falsefilter, a warning is logged since excluded services are never collected and cannot be grouped.Motivation
Per-user services are often pure noise on monitored hosts, and each carries a per-session/per-host LUID suffix that inflates
windows_servicetag cardinality. This complements thegroup_per_user_servicesoption (parent PR) by letting users drop per-user services from collection entirely rather than grouping them.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