-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: use modifier for topk to improve dashboard performance #2590
Conversation
cmd/tools/grafana/dashboard_test.go
Outdated
t.Errorf(`%s should not have unit=%s expected=%s %s path=%s title="%s"`, | ||
metric, unit, defaultLatencyUnit, location[0].dashboard, location[0].path, location[0].title) | ||
if unit != expectedGrafanaUnit && !v.skipValidate { | ||
if !(strings.EqualFold(metric, "qos_detail_resource_latency") || strings.EqualFold(metric, "qos_detail_service_time_latency")) && unit == "percent" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can reuse the map with something like this:
// Check if this metric is in the allowedSuffix map and has a matching unit
if slices.Contains(allowedSuffix[metric], unit) {
continue
}
cmd/tools/grafana/dashboard_test.go
Outdated
@@ -783,6 +780,10 @@ func checkTopKRange(t *testing.T, path string, data []byte) { | |||
} | |||
} | |||
} | |||
|
|||
if strings.Contains(expr.expr, "$__range") && strings.Contains(expr.expr, "@ end()") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the query does not require whitespace, probably safer to go with this check to reduce false positives
noWhitespace := strings.ReplaceAll(expr.expr, " ", "")
if strings.Contains(noWhitespace, "$__range@end()") {
hasRange = true
}
Below is the summary of changes
Below are the pending topk queries which are using hidden vars: