-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support unique steps by using a unique field for each step
- Loading branch information
Showing
9 changed files
with
112 additions
and
94 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 |
---|---|---|
@@ -1,15 +1,22 @@ | ||
alert_pipelines: | ||
- alert_name: NOOP_ALERT | ||
enrichments: | ||
- enrichment_name: UPPER_CASE | ||
- step_name: ENRICHMENT_STEP_1 | ||
enrichment_name: UPPER_CASE | ||
enrichment_args: arg1,arg2 | ||
- step_name: ENRICHMENT_STEP_2 | ||
enrichment_name: NOOP_ENRICHMENT | ||
enrichment_args: arg1,arg2 | ||
actions: | ||
- action_name: NOOP_ACTION | ||
- step_name: ACTION_STEP_1 | ||
action_name: NOOP_ACTION | ||
action_args: ARG1,ARG2 | ||
- alert_name: KubePodCrashLooping | ||
enrichments: | ||
- enrichment_name: GetMetric | ||
- step_name: ENRICHMENT_STEP_1 | ||
enrichment_name: GET_DATA | ||
enrichment_args: "promql" | ||
actions: | ||
- action_name: NotifySLack | ||
- step_name: ACTION_STEP_1 | ||
action_name: NotifySLack | ||
action_args: "url" |
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,17 @@ | ||
package enrichment | ||
|
||
import ( | ||
"alertmanager/logging" | ||
"alertmanager/types" | ||
"fmt" | ||
) | ||
|
||
func GetPromQLEnrichment(alert types.Alert, e types.Enrichment) (interface{}, error) { | ||
logr := logging.GetLogger() | ||
|
||
rs := fmt.Sprintf("noop enrichment called: \nalert: %s\nenrichment: %s\nwith args: %s", alert.AlertName, e.EnrichmentName, e.EnrichmentArgs) | ||
|
||
logr.Debug(rs) | ||
|
||
return rs, nil | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
package types | ||
|
||
type Action struct { | ||
StepName string `yaml:"step_name"` | ||
ActionName string `yaml:"action_name"` | ||
ActionArgs string `yaml:"action_args"` | ||
} | ||
|
||
func GetDefaultAction() Action { | ||
return Action{ActionName: "NOOP_ACTION", ActionArgs: "ARG1,ARG2"} | ||
return Action{ | ||
StepName: "ACTION_STEP_1", | ||
ActionName: "NOOP_ACTION", | ||
ActionArgs: "ARG1,ARG2"} | ||
} |
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 |
---|---|---|
@@ -1,10 +1,14 @@ | ||
package types | ||
|
||
type Enrichment struct { | ||
StepName string `yaml:"step_name"` | ||
EnrichmentName string `yaml:"enrichment_name"` | ||
EnrichmentArgs string `yaml:"enrichment_args"` | ||
} | ||
|
||
func GetDefaultEnrichment() Enrichment { | ||
return Enrichment{EnrichmentName: "NOOP_ENRICHMENT", EnrichmentArgs: "ARG1,ARG2"} | ||
return Enrichment{ | ||
StepName: "ENRICHMENT_STEP_1", | ||
EnrichmentName: "NOOP_ENRICHMENT", | ||
EnrichmentArgs: "ARG1,ARG2"} | ||
} |