Skip to content

Commit

Permalink
fix: check assertion for operator
Browse files Browse the repository at this point in the history
  • Loading branch information
nityanandagohain committed Sep 20, 2024
1 parent 1f3aa8a commit 3722ed7
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions pkg/query-service/app/dashboards/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,11 +540,14 @@ func checkLogPanelAttrContains(data map[string]interface{}) int {
for _, item := range items {
itemMap, ok := item.(map[string]interface{})
if ok {
if slices.Contains([]string{"contains", "ncontains", "like", "nlike"}, itemMap["op"].(string)) {
// check if it's not body
key, ok := itemMap["key"].(map[string]string)
if ok && key["key"] != "body" {
logsPanelsWithAttrContains++
opStr, ok := itemMap["op"].(string)
if ok {
if slices.Contains([]string{"contains", "ncontains", "like", "nlike"}, opStr) {
// check if it's not body
key, ok := itemMap["key"].(map[string]string)
if ok && key["key"] != "body" {
logsPanelsWithAttrContains++
}
}
}
}
Expand Down

0 comments on commit 3722ed7

Please sign in to comment.