fix PromQL construction

Signed-off-by: huanggze <loganhuang@yunify.com>
This commit is contained in:
huanggze
2019-06-30 19:53:42 +08:00
parent 7b81d24e13
commit fa3d09b880
2 changed files with 13 additions and 4 deletions

View File

@@ -27,12 +27,16 @@ func MakeWorkloadPromQL(metricName, nsName, resources_filter, wkKind string) str
wkKind = DaemonSet
case "statefulset":
wkKind = StatefulSet
default:
wkKind = "(.*)"
}
if resources_filter == "" {
resources_filter = ".*"
if wkKind == "" {
resources_filter = Any
} else if resources_filter == "" {
if strings.Contains(metricName, "pod") {
resources_filter = wkKind + ":" + Any
} else if strings.Contains(metricName, strings.ToLower(wkKind)) {
resources_filter = Any
}
} else {
var prefix string