-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ adding incident label selector CLI option (#445)
First thing to complete the incident filtering on packages from the UI, is to have the CLI option. This CLI option is responsible for filtering incidents based on selectors applied to the stringified version of the variables Signed-off-by: Shawn Hurley <[email protected]>
- Loading branch information
1 parent
b8c1df0
commit 391775e
Showing
4 changed files
with
85 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package internal | ||
|
||
import "fmt" | ||
|
||
type VariableLabelSelector map[string]interface{} | ||
|
||
func (v VariableLabelSelector) GetLabels() []string { | ||
if len(v) == 0 { | ||
// adding a single empty string will allow for Not selectors to match | ||
// incidents that have no variables | ||
return []string{""} | ||
} | ||
s := []string{} | ||
for k, v := range v { | ||
s = append(s, fmt.Sprintf("%s=%s", k, v)) | ||
} | ||
return s | ||
} |
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