-
Notifications
You must be signed in to change notification settings - Fork 3.1k
[receiver/hostmetrics] add process.handles metric #22813
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[receiver/hostmetrics] add process.handles metric #22813
Conversation
17d2f55
to
2ad4bf5
Compare
2ad4bf5
to
3f54a09
Compare
receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper.go
Outdated
Show resolved
Hide resolved
receiver/hostmetricsreceiver/internal/scraper/processscraper/metadata.yaml
Outdated
Show resolved
Hide resolved
Please take a look at the failing CI |
6f8f077
to
a3ce3db
Compare
CI looks to be in a healthy state (one test failure but it's some kind of timeout test, we can run again before submission just to make sure). |
receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper.go
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Can you also please submit an issue for the new metric name in semantic conventions and link it to open-telemetry/opentelemetry-specification#3556?
Please rebase |
d5ee3ab
to
c2903c9
Compare
Thanks for the review @dmitryax! I've rebased and will wait to ensure CI checks pass again. I opened a semantic conventions PR and linked it to the working group issue. I've heard that these metrics are being moved to being generated from YAML instead of written directly in the markdown document, so I may delay that PR until that work is done and move it to a YAML definition. |
Adds a new Windows-exclusive metric called process.handles, which represents the handle count of the given process. When enabled, the receiver will make an additional syscall, specifically `NtQuerySystemInformation` at the beginning of each scrape to update the handle count for all processes on the system. If the metric is enabled on a platform other than Windows, an error will be produced when attempting to refresh handle counts. This matches the rough behaviour of the Linux exclusive `process.open_file_descriptors`.
I put the handle count refresh after all the metrics scrapes instead of after collecting all process handles, which meant the first scrape would always be empty.
NtQuerySystemInformation is an unsupported internal API. This means it can be subject to change. This commit swaps handle count retrieval to use Windows Management Instrumentation to get the counts instead.
Introduces a more generic interface for handle count querying than what was there before. This makes it easier to reason about when using an implementation with different syscalls, so the handleCountManager implementation can remain the way it was. Fixed the test to reflect the changes.
The argument needs to be there to implement the interface but it doesn't need to be named because it's unused.
Changing the process.handles metric from a gauge to a cumulative non-monotonic sum.
The `handles` package name actually clashed with a ton of other places that had variables called `handles`. This commit renames the package to `handlecount`.
Description:
Adds a new Windows-exclusive metric called process.handles, which represents the handle count of the given process. When enabled, the receiver will make a WMI Query at the beginning of each scrape to update the handle count for all processes on the system. If the metric is enabled on a platform other than Windows, an error will be produced when attempting to refresh handle counts. This matches the rough behaviour of the Linux exclusive
process.open_file_descriptors
.Link to tracking Issue:
#21379
#12482
Testing:
Ran the binary with the following configuration:
The following is an example result of a scrape with this configuration.
https://gist.github.com/braydonk/c97996272574319e03111dc79076a1bd
Documentation:
documentation.md
was generated bymdatagen
from themetadata.yaml
updates.