From 3722ed7f1aa0f7882164ca37abafa3aa073f4e1e Mon Sep 17 00:00:00 2001 From: nityanandagohain Date: Fri, 20 Sep 2024 17:48:26 +0530 Subject: [PATCH] fix: check assertion for operator --- pkg/query-service/app/dashboards/model.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pkg/query-service/app/dashboards/model.go b/pkg/query-service/app/dashboards/model.go index 5087867f7e..21d39fcbe4 100644 --- a/pkg/query-service/app/dashboards/model.go +++ b/pkg/query-service/app/dashboards/model.go @@ -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++ + } } } }