Replace --collectors.enabled with per-collector flags#640
Replace --collectors.enabled with per-collector flags#640discordianfish merged 14 commits intoprometheus:masterfrom
Conversation
|
Working on the bash-fu to fix the e2e test script... |
5c18ebc to
061842c
Compare
end-to-end-test.sh
Outdated
There was a problem hiding this comment.
Minor bash style thing here, for consistency I prefer to use ${var_name}.
|
This is great, thanks for taking care of this. |
061842c to
936c184
Compare
|
Overall looking good, thanks! |
|
@discordianfish Either way, the user has to track collectors between releases. I'd rather keep this simple if possible. I suggest we file an issue for "disable everything flag" and see if anyone really needs it. |
|
I have similar concerns to @discordianfish and I'm not sure the current change is a clear win in usability. Given PromCon and related preparations, I won't have time to research for ideas in similar setups and comment before next week. |
|
For what it's worth, this is the same style as we use on the To, me, there are some clear usability wins. The reasoning is detailed in #216. |
|
@SuperQ But as right now, without this PR you can explicitly set the collectors you want to use. With this change this isn't possible anymore which is why I believe we need to change this before merging this PR. Otherwise I would agree that such improvements could be made later. The mysql-exporter is IMO a different story where the need to explicitly enable a specific set of option isn't as important. |
@discordianfish Yes, pretty much. Which is the inverse of the current issue - if I just want to run with the defaults and add a few more, I will have to pull out the defaults, add the optional ones I need, and then keep that list up to date as I update the exporter. Empirically, this need is more common requirement (the defaults are fairly uncontroversial, but I want to add one or two of the non-defaults), but maybe the groups I've worked with are outliers in this? Anyway, I don't think it is unreasonable to have a "disable all" flag which then lets the user enable the specific ones with |
They shouldn't if they really cause trouble. The most common use case to disable default collectors is to reduce the amount of metrics produced in space limited setups. |
|
+1 for having a way to enable only specific collectors. We enable almost
all new collectors by default these days. Multiple people have spoken up
here with a need to contain this, so I don't see the need for a separate
issue.
…On Tue, Aug 15, 2017, 09:58 Tobias Schmidt ***@***.***> wrote:
although if one of the default collectors are troublesome in some cases,
should it really be default?
They shouldn't if they really cause trouble. The most common use case to
disable default collectors is to reduce the amount of metrics produced in
space limited setups.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#640 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAICBrPq8nr3b4BpQzWiX-AwJbmemAm8ks5sYU-LgaJpZM4O1qSn>
.
|
|
Yes, also thinking about limit-number-of-metrics usecase. So we agree about a flag like |
|
How about |
|
I like this one better. no-collector.defaults.enabled is really hard to
parse.
…On Tue, Aug 15, 2017 at 9:28 AM Ben Kochie ***@***.***> wrote:
How about --disable-collector-defaults, with the default of false.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#640 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAICBvDgteHFklgvxIdeWORfzOfj9Rs7ks5sYWTHgaJpZM4O1qSn>
.
|
|
I liked the consistency but sure that name work |
|
@carlpett Would you add a flag |
|
@SuperQ Sorry for not responding! I've been travelling without internet access since submitting the PR, but I'll fix that flag as soon as I have access to laptop and wifi again :)
|
|
No worries, I was just wanting to ping. 😃 |
|
Hm, so actually this isn't as easy as I would have first thought. Currently the "enabledness" of collectors is tracked in a |
|
I realized that too when looking at this. Don't really have a better answer. Maybe we should check out how others are doing this. |
|
Finally got my laptop back... I split the bool into two, so it is possible to track if the user has chosen to enable it and the default state separately. |
|
Huh, and apparently I broke some of the previous functionality when implementing it. Whoops. I even added tests, but forgot this case. |
82e7a0e to
f8dc13a
Compare
|
Rebased now. |
|
We should have fixed the windows filename issues with the |
|
Oh, sorry, I was confused. We fixed the code so you can check it out, but tests will still not run on windows because it needs to unpack the |
Agreed, we should find a better name for these. I'd say either Beside that, LGTM! |
|
That naming seems fine to me! |
|
No objection to the naming. |
|
What about just |
|
@grobie Good idea, I like that one best. |
|
If we still want some namespace, how about |
|
@carlpett I like that, let's go with |
|
@SuperQ Guess you're fine with that too? IMO better than no namespace. We might have more path options in the future so IMO this makes sense. |
|
SG.
…On Thu, Sep 28, 2017 at 11:38 AM discordianfish ***@***.***> wrote:
@SuperQ <https://github.com/superq> Guess you're fine with that too? IMO
better than no namespace. We might have more path options in the future so
IMO this makes sense.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#640 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAANaG0j0ufrKymz2TFJaYw1nIz6TObvks5sm2kxgaJpZM4O1qSn>
.
|
|
Yes, |
grobie
left a comment
There was a problem hiding this comment.
Thanks! I'd drop the print command, but looks great otherwise!
README.md
Outdated
|
|
||
| Which collectors are used is controlled by the `--collectors.enabled` flag. | ||
| Collectors are enabled by providing a `--collector.<name>` flag. | ||
| Collectors that are enabled by default can be disabled by providing a `--no-collector.name` flag. |
There was a problem hiding this comment.
For consistency, this should be <name>
| type NodeCollector struct { | ||
| Collectors map[string]Collector | ||
| } | ||
|
|
There was a problem hiding this comment.
NewNodeCollector should have a docstring as it's exported.
There was a problem hiding this comment.
Hm, perhaps it shouldn't be exported? Not much point to it?
There was a problem hiding this comment.
Eh, I meant that the NodeCollector struct possibly shouldn't be exported. I'll add a doc string to NewNodeCollector.
node_exporter.go
Outdated
| printCollectors = kingpin.Flag("collectors.print", "If true, print available collectors and exit.").Bool() | ||
| listenAddress = kingpin.Flag("web.listen-address", "Address on which to expose metrics and web interface.").Default(":9100").String() | ||
| metricsPath = kingpin.Flag("web.telemetry-path", "Path under which to expose metrics.").Default("/metrics").String() | ||
| printCollectors = kingpin.Flag("collectors.print", "If true, print available collectors and exit.").Bool() |
There was a problem hiding this comment.
Do we still need this? All available collectors are already visible when showing --help.
There was a problem hiding this comment.
Agree, that should be dropped.
There was a problem hiding this comment.
Yes, I thought we had talked about dropping this previously.
|
LGTM beside @grobie's comments. |
|
Awesome, thanks @carlpett for the contribution! |
* Move NodeCollector into package collector * Refactor collector enabling * Update README with new collector enabled flags * Fix out-of-date inline flag reference syntax * Use new flags in end-to-end tests * Add flag to disable all default collectors * Track if a flag has been set explicitly * Add --collectors.disable-defaults to README * Revert disable-defaults flag * Shorten flags * Fixup timex collector registration * Fix end-to-end tests * Change procfs and sysfs path flags * Fix review comments
Deprecate TCP APIs in favor of `github.com/mdlayher/netlink`. Refer: prometheus/procfs#622 (review). Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>
@SuperQ mentioned that after the switch to kingpin, now would be a good time to also replace
--collectors.enabledwith individual flags for each collector, since there is a breaking change anyway.This PR does that. The flags are now
--collector.<name>.enabled(or--no-collector.<name>.enabledto disable a default collector), but if there are shorter alternatives that might be good to consider.This PR also moves the
NodeExportertype into the collector package, as suggested by @SuperQ to follow mysqld_exporter #209.It is possible to remove a few more exported symbols from the
collectorpackage, but I'd like some opinions on if that would be positive or not. MakingFactoriesinternal seems like a reasonable thing, for instance, but then we'd need to make--collectors.printcall into some new function.