fix: ensure old namespce data to be filterred out correctly in metrics
Signed-off-by: huanggze <loganhuang@yunify.com>
This commit is contained in:
@@ -119,13 +119,9 @@ func MakeAllWorkspacesPromQL(metricsName, nsFilter string) string {
|
||||
func MakeSpecificWorkspacePromQL(metricsName, nsFilter string, workspace string) string {
|
||||
|
||||
var promql = RulePromQLTmplMap[metricsName]
|
||||
nsFilter = "=~\"" + nsFilter + "\""
|
||||
|
||||
if workspace == "" {
|
||||
workspace = "=~\".*\""
|
||||
} else {
|
||||
workspace = "=\"" + workspace + "\""
|
||||
}
|
||||
nsFilter = "=~\"" + nsFilter + "\""
|
||||
workspace = "=~\"^(" + workspace + ")$\""
|
||||
|
||||
promql = strings.Replace(promql, "$1", nsFilter, -1)
|
||||
promql = strings.Replace(promql, "$2", workspace, -1)
|
||||
|
||||
Reference in New Issue
Block a user