-
Notifications
You must be signed in to change notification settings - Fork 700
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
adds whitelist for exchange collectors #642
adds whitelist for exchange collectors #642
Conversation
Signed-off-by: Björn Fischer <[email protected]>
ce2044a
to
faea886
Compare
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.
Hi Björn, thanks for submitting this PR! I've added a couple review comments, have a look at them and let me know if there's any issues.
Whitelisting of the Exchange collectors might assist with performance in some scenarios, so this is welcome.
docs/collector.exchange.md
Outdated
@@ -15,6 +15,9 @@ Enabled by default? | No | |||
### `--collectors.exchange.list` | |||
Lists the Perflib Objects that are queried for data along with the perlfib object id | |||
|
|||
### `--collectors.exchange.whitelist` | |||
Comma-separated list of collectors to use. Depending on the exchange installation not all performance counters are available. Use `--collectors.exchange.list` to obtain a list of available collectors. |
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.
An example of the flag would be good. E.G. --collectors.exchange.list=AvailabilityService,OutlookWebAccess
.
Mentioning case-sensitivity of collectors would be good too.
collector/exchange.go
Outdated
func find(slice []string, val string) (int, bool) { | ||
for i, item := range slice { | ||
if item == val { | ||
return i, true | ||
} | ||
} | ||
return -1, false | ||
} |
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.
This function could be changed to return a bool
only, as the slice index is never used.
Signed-off-by: Björn Fischer <[email protected]>
Signed-off-by: Björn Fischer <[email protected]>
@breed808 I've implemented your feedback. |
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.
Looks good! @carlpett do you want to have a look at this before it's merged?
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! Looks good functionally, just some structural comments
collector/exchange.go
Outdated
func find(slice []string, val string) bool { | ||
for _, item := range slice { | ||
if item == val { | ||
return true | ||
} | ||
} | ||
return false | ||
} |
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.
Bit of a nit, but we've tried to keep generic utility functions in collector.go, since they are shared across the entire package.
collector/exchange.go
Outdated
@@ -82,10 +82,17 @@ var ( | |||
"RpcClientAccess", | |||
} | |||
|
|||
collectorWhitelist = make([]string, 0, len(exchangeAllCollectorNames)) |
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.
Could we make this a field on the exchangeCollector
type? If not, it at least needs a more exchange-specific name, since it is a package level var.
Signed-off-by: Björn Fischer <[email protected]>
@carlpett Done! I've moved the whitelist in the struct. I don't have permissions to merge. |
Great! One minor thing that struck me now that I took a final pass was if whitelist is the right term here, since there is no corresponding blacklist? I think we usually just have |
Signed-off-by: Björn Fischer <[email protected]>
Agreed! I've renamed it. Ready to merge from my side. Looking forward to v0.15 :) |
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!
Wow, this is great. Thanks for the work, @fischerman. We have not had the time to dig into this yet. Another benefit of providing upstream commits 👍 |
adds enable flag for exchange collectors Signed-off-by: Björn Fischer <[email protected]>
related to #614 and #569
The flag enables the windows_exporter to work with different exchange installations where not all performance counters are available. Detecting the installed roles would be even nicer, but is much more work. Either way this is a nice way of customizing the exporter.
As a side effect of this PR, the order in which the collectors are called is now fixed. As a result, if one of the sub collectors fails the returned metrics are now consistent.