Fix 1737 (#1738)
* add GetMeta to *types.Event Co-authored-by: sabban <15465465+sabban@users.noreply.github.com>
This commit is contained in:
parent
9d199fd4a9
commit
b2130b1593
2 changed files with 28 additions and 0 deletions
|
@ -41,6 +41,15 @@ func (e *Event) GetMeta(key string) string {
|
|||
return ""
|
||||
}
|
||||
|
||||
func (a *Alert) GetMeta(key string) string {
|
||||
for _, meta := range a.Meta {
|
||||
if meta.Key == key {
|
||||
return meta.Value
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (s Source) GetValue() string {
|
||||
if s.Value == nil {
|
||||
return ""
|
||||
|
|
|
@ -52,6 +52,25 @@ func (e *Event) GetType() string {
|
|||
}
|
||||
}
|
||||
|
||||
func (e *Event) GetMeta(key string) string {
|
||||
if e.Type == OVFLW {
|
||||
for _, alert := range e.Overflow.APIAlerts {
|
||||
for _, event := range alert.Events {
|
||||
if event.GetMeta(key) != "" {
|
||||
return event.GetMeta(key)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if e.Type == LOG {
|
||||
for k, v := range e.Meta {
|
||||
if k == key {
|
||||
return v
|
||||
}
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
//Move in leakybuckets
|
||||
const (
|
||||
Undefined = ""
|
||||
|
|
Loading…
Reference in a new issue