-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
process_collector: Add Platform-Specific Describe for processCollector #1625
process_collector: Add Platform-Specific Describe for processCollector #1625
Conversation
bc2ac02
to
acd48a9
Compare
Signed-off-by: Ying WANG <ying.wang@grafana.com>
acd48a9
to
1a1b860
Compare
Signed-off-by: Ying WANG <ying.wang@grafana.com>
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.
Thanks, amazing work! 💪🏽 One nit, otherwise LGTM
CHANGELOG.md
Outdated
@@ -1,5 +1,7 @@ | |||
## Unreleased | |||
|
|||
* [ENHANCEMENT] process_collector: Add Platform-Specific Describe for processCollector. #1625 |
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.
Is it really a customer visible change? It might be mostly our tech-debt removal, right?
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.
removed in 0bfbc37
prometheus/process_collector.go
Outdated
ch <- c.startTime | ||
ch <- c.inBytes | ||
ch <- c.outBytes | ||
func (c *processCollector) defaultCollectFn(ch chan<- Metric) { |
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.
Should we name this and below something like errorCollectFn
and errorDescribeFn
given what they do?
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.
renamed in 0bfbc37
@@ -20,7 +20,14 @@ func canCollectProcess() bool { | |||
return false | |||
} | |||
|
|||
// describe returns all descriptions of the collector for js. |
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.
Nice! I'm not sure why we have files for js and wasip1 that explicitly say "false" in can collect function, but other potentially also non supported environments will go through _other file. Maybe we can find the source of the file/blame to see why it was added vs going through _other
file flow 🤔
We can do in other PR
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.
I think this may caused by below function is not available in js and wasip1 PR, but I think you are still right, we can at least merge those 2 since they are exactly the same today. Just left them now as they are, let me know what do you think, I can open a follow PR.
func canCollectProcess() bool {
_, err := procfs.NewDefaultFS()
return err == nil
}
Signed-off-by: Ying WANG <ying.wang@grafana.com>
de6aff8
to
0bfbc37
Compare
could you take another look at this PR @bwplotka @ArthurSens @kakkoyun? thank you. |
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.
Thanks!
prometheus#1625) * process_collector: Add Platform-Specific Describe for processCollector Signed-off-by: Ying WANG <ying.wang@grafana.com> * add changelog entry Signed-off-by: Ying WANG <ying.wang@grafana.com> * Address comments Signed-off-by: Ying WANG <ying.wang@grafana.com> --------- Signed-off-by: Ying WANG <ying.wang@grafana.com> Signed-off-by: Eugene <eugene@amberpixels.io>
This PR addresses the issue described in #1591.
Given the clarity of the ticket, I proceeded directly with the fix rather than engaging in further discussion, but please let me know if there are any questions or concerns.
In this PR, I've refactored the Describe function to be platform-specific and added tests to ensure alignment between Describe and ProcessCollect for Linux and Windows. I've also included comments to help ensure future alignment between these functions. Also defaultCollectFn and defaultDescribeFn are added to standardise behaviour for unsupported platforms.
As this is my first contribution, I would really appreciate any feedback you may have. Thank you. @bwplotka @ArthurSens @kakkoyun