Skip to content

Commit

Permalink
refactor(internal/circonus): Metric filters parsing defaults to v1.20…
Browse files Browse the repository at this point in the history
…+, checks errors

Refactor metric filters parsing to be simpler and check all errors

issue #CIRC-8497

This change refactors code to be simpler (more easily readable) and
check all errors

* Tags: errors metric filters v1.20+ parse
  • Loading branch information
aesca1er committed Jul 13, 2022
1 parent 8b8935a commit 70216e5
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions internal/circonus/metric_filters.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,19 +140,15 @@ func (c *Check) defaultFilters() [][]string {

var defaultMetricFiltersData []byte

currversion, err := version.NewVersion(c.clusterVers)
v120, err := version.NewVersion(v120str)
if err != nil {
c.log.Warn().Err(err).Msg("parsing api version")
currversion, _ = version.NewVersion(v120str)
c.log.Warn().Err(err).Msg("parsing " + v120str)
}

v120, err := version.NewVersion(v120str)
currversion, err := version.NewVersion(c.clusterVers)
if err != nil {
c.log.Warn().Err(err).Msg("parsing" + v120str)
return [][]string{
{"deny", "^$", "empty"},
{"allow", "^.+$", "all"},
}
c.log.Warn().Err(err).Msg("parsing api version")
currversion = v120
}

if currversion.LessThan(v120) {
Expand Down

0 comments on commit 70216e5

Please sign in to comment.