-
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.
use diffiernt LUT for actions and enrichments
support different fuction args pass enrichment resutls to actions
- Loading branch information
Showing
8 changed files
with
41 additions
and
43 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package action | ||
|
||
type ActionLut map[string]func(Action, map[string]interface{}) error | ||
|
||
func (flut ActionLut) Add(fname string, f func(Action, map[string]interface{}) error) { | ||
flut[fname] = f | ||
} |
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,19 +1,16 @@ | ||
package enrichment | ||
|
||
import "alertmanager/utils" | ||
|
||
type Enrichment struct { | ||
EnrichmentName string `yaml:"enrichment_name"` | ||
EnrichmentArgs string `yaml:"enrichment_args"` | ||
EnrichmentResult string `yaml:"-"` | ||
EnrichmentName string `yaml:"enrichment_name"` | ||
EnrichmentArgs string `yaml:"enrichment_args"` | ||
} | ||
|
||
func GetDefaultEnrichment() Enrichment { | ||
return Enrichment{EnrichmentName: "NOOP_ENRICHMENT", EnrichmentArgs: "ARG1,ARG2"} | ||
} | ||
|
||
var enrichmentMap = make(utils.FunctionLut) | ||
var enrichmentMap = make(EnrichmentLut) | ||
|
||
func GetEnrichmentMap() *utils.FunctionLut { | ||
func GetEnrichmentMap() *EnrichmentLut { | ||
return &enrichmentMap | ||
} |
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 enrichment | ||
|
||
type EnrichmentLut map[string]func(Enrichment) (interface{}, error) | ||
|
||
func (flut EnrichmentLut) Add(fname string, f func(Enrichment) (interface{}, error)) { | ||
flut[fname] = f | ||
} |
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 was deleted.
Oops, something went wrong.