Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ying-jeanne
Copy link

@ying-jeanne ying-jeanne commented Sep 15, 2024

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

Signed-off-by: Ying WANG <ying.wang@grafana.com>
Signed-off-by: Ying WANG <ying.wang@grafana.com>
Copy link
Member

@bwplotka bwplotka left a 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

@@ -1,5 +1,7 @@
## Unreleased

* [ENHANCEMENT] process_collector: Add Platform-Specific Describe for processCollector. #1625
Copy link
Member

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?

ch <- c.startTime
ch <- c.inBytes
ch <- c.outBytes
func (c *processCollector) defaultCollectFn(ch chan<- Metric) {
Copy link
Member

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?

@@ -20,7 +20,14 @@ func canCollectProcess() bool {
return false
}

// describe returns all descriptions of the collector for js.
Copy link
Member

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

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