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

Rework process collector #456

Merged
merged 1 commit into from
Sep 7, 2018
Merged

Rework process collector #456

merged 1 commit into from
Sep 7, 2018

Conversation

beorn7
Copy link
Member

@beorn7 beorn7 commented Sep 6, 2018

This unifies both constructors in one with an options argument.

The options argument allows to switch on error reporting, as discussed
in #219.

The change of the contructor signature is breaking, but only mildly
so. Plus, the process collector is rarely used explicitly. I used
Sourcegraph to search for public usages, with the following results:

  • 2 occurrences of NewProcessCollectorPIDFn, once in @discordianfish's
    glimpse, once in @fabxc's etcd_exporter (deprecated anyway). Both
    are Prom veterans and will simply do the one line change if needed.
  • 8 occurrences of NewProcessCollector, of which 7 are of the form
    NewProcessCollector(os.Getpid(), "")
    Thus, it's a very easy change, which I even hinted at in the doc
    comment.

Signed-off-by: beorn7 [email protected]

Fixes #219.

@beorn7 beorn7 requested a review from grobie September 6, 2018 19:22
close(ch)
}()
for m := range ch {
fmt.Println("feep")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Errr… probably just to test the reviewer. :o)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will remove before merging.

This unifies both constructors in one with an options argument.

The options argument allows to switch on error reporting, as discussed
in #219.

The change of the contructor signature is breaking, but only mildly
so. Plus, the process collector is rarely used explicitly. I used
Sourcegraph to search for public usages, with the following results:

- 2 occurrences of NewProcessCollectorPIDFn, once in @discordianfish's
  glimpse, once in @fabxc's etcd_exporter (deprecated anyway). Both
  are Prom veterans and will simply do the one line change if needed.
- 8 occurrences of NewProcessCollector, of which 7 are of the form
    NewProcessCollector(os.Getpid(), "")
  Thus, it's a very easy change, which I even hinted at in the doc
  comment.

Signed-off-by: beorn7 <[email protected]>
@beorn7 beorn7 force-pushed the beorn7/process_collector branch from 1b36154 to 773f502 Compare September 7, 2018 10:09
@beorn7 beorn7 merged commit 7858729 into master Sep 7, 2018
@beorn7 beorn7 deleted the beorn7/process_collector branch September 7, 2018 10:25
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