-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(filter): loose tag regex and compatibility (#924)
by @lordvidex
- Loading branch information
1 parent
488b89f
commit 015eb55
Showing
12 changed files
with
362 additions
and
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/moira-alert/moira/filter" | ||
) | ||
|
||
// Compatibility struct contains feature-flags that give user control over | ||
// features supported by different versions of graphit compatible with moira | ||
type compatibility struct { | ||
// Controls how regices in tag matching are treated | ||
// If false (default value), regex will match start of the string strictly. 'tag~=foo' is equivalent to 'tag~=^foo.*' | ||
// If true, regex will match start of the string loosely. 'tag~=foo' is equivalent to 'tag~=.*foo.*' | ||
AllowRegexLooseStartMatch bool `yaml:"allow_regex_loose_start_match"` | ||
// Controls how absent tags are treated | ||
// If true (default value), empty tags in regices will be matched | ||
// If false, empty tags will be discarded | ||
AllowRegexMatchEmpty bool `yaml:"allow_regex_match_empty"` | ||
} | ||
|
||
func (compatibility *compatibility) toFilterCompatibility() filter.Compatibility { | ||
return filter.Compatibility{ | ||
AllowRegexLooseStartMatch: compatibility.AllowRegexLooseStartMatch, | ||
AllowRegexMatchEmpty: compatibility.AllowRegexMatchEmpty, | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package filter | ||
|
||
// See cmd/filter/compatibility for usage examples | ||
type Compatibility struct { | ||
AllowRegexLooseStartMatch bool | ||
AllowRegexMatchEmpty bool | ||
} |
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
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
Oops, something went wrong.