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

ProcessCollector: rework #219

Closed
beorn7 opened this issue Aug 4, 2016 · 2 comments
Closed

ProcessCollector: rework #219

beorn7 opened this issue Aug 4, 2016 · 2 comments
Assignees
Milestone

Comments

@beorn7
Copy link
Member

beorn7 commented Aug 4, 2016

In particular, see https://github.com/prometheus/client_golang/blob/master/prometheus/process_collector.go#L106

However, even if we can handle errors gracefully now, it will not be the case with the DefaultRegistry. Since a process collector is often added as a best-effort collector to a collections that is otherwise critical to be complete, the process collector should only report errors when requested so. To not have a proliferation of constructors, have just one with ProcessCollectorOpts (pudFn, reportErrors, namespace, with default behavior to not report errors, empty string as namespace, and os.GetPid as pidFn).

Also, the collector should use const metrics.

@beorn7 beorn7 added the v0.9 label Aug 16, 2016
@beorn7 beorn7 added this to the v0.9 milestone Aug 19, 2016
@beorn7 beorn7 removed the v0.9 label Aug 19, 2016
@grobie grobie self-assigned this Oct 14, 2016
@grobie
Copy link
Member

grobie commented Oct 24, 2016

@beorn7 These will be breaking changes. I believe the ProcessCollector is rarely used manually, but if you want to be super strict about it, we'd need to wait until 0.10, right?

@beorn7
Copy link
Member Author

beorn7 commented Oct 24, 2016

No, “mild” breaking changes are OK for 0.9, i.e. those that affect only rare usage patterns.

0.10 is for those breaking changes that will affect almost everybody.

beorn7 pushed a commit that referenced this issue 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]>
beorn7 pushed a commit that referenced this issue Sep 7, 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants