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

adds whitelist for exchange collectors #642

Merged
merged 5 commits into from
Nov 1, 2020

Conversation

fischerman
Copy link
Contributor

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.

Copy link
Contributor

@breed808 breed808 left a 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.

@@ -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.
Copy link
Contributor

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.

Comment on lines 635 to 642
func find(slice []string, val string) (int, bool) {
for i, item := range slice {
if item == val {
return i, true
}
}
return -1, false
}
Copy link
Contributor

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]>
@fischerman
Copy link
Contributor Author

@breed808 I've implemented your feedback.

Copy link
Contributor

@breed808 breed808 left a 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?

Copy link
Collaborator

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

Comment on lines 635 to 642
func find(slice []string, val string) bool {
for _, item := range slice {
if item == val {
return true
}
}
return false
}
Copy link
Collaborator

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.

@@ -82,10 +82,17 @@ var (
"RpcClientAccess",
}

collectorWhitelist = make([]string, 0, len(exchangeAllCollectorNames))
Copy link
Collaborator

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.

@fischerman
Copy link
Contributor Author

@carlpett Done! I've moved the whitelist in the struct. I don't have permissions to merge.

@carlpett
Copy link
Collaborator

carlpett commented Nov 1, 2020

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 enabled in similar places (eg collectors.enabled and collector.mssql.enabled)
Sorry for not thinking about it in the previous check!

Signed-off-by: Björn Fischer <[email protected]>
@fischerman
Copy link
Contributor Author

Agreed! I've renamed it. Ready to merge from my side. Looking forward to v0.15 :)

Copy link
Collaborator

@carlpett carlpett left a comment

Choose a reason for hiding this comment

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

🎉 Thanks!

@carlpett carlpett merged commit a4aef9b into prometheus-community:master Nov 1, 2020
@rmyhren
Copy link
Contributor

rmyhren commented Nov 20, 2020

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 👍

anubhavg-icpl pushed a commit to anubhavg-icpl/windows_exporter that referenced this pull request Sep 22, 2024
adds enable flag for exchange collectors

Signed-off-by: Björn Fischer <[email protected]>
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.

4 participants