-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a threshold validation function to cmd/config
This commit adds a `validateThresholdConfig` function to `cmd/config`. This function validates that any thresholds defined in the config apply to existing metrics, and use methods that are valid for the metrics they apply to. As a side effect, this commit adds both a `Get` and `Has` methods to `metrics.Registry` in order to be able to query registered metrics, regardless of whether they are custom or builtin metrics. Note that the `validateThresholdConfig` function makes the assumption that the passed in `metrics.Registry` has been loaded with builtin metrics. As another side effect, this commit introduces a `lib.Contains` helper function allowing to check if a slice of strings contains a given string. This is used to simplify the matching of supported aggregation methods on metrics in the `validateThresholdConfig` function. ref #2330
- Loading branch information
Showing
4 changed files
with
233 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters