fix: ensure old namespce data to be filterred out correctly in metrics
Signed-off-by: huanggze <loganhuang@yunify.com>
This commit is contained in:
@@ -480,7 +480,7 @@ func collectWorkspaceMetric(monitoringRequest *client.MonitoringRequestParams, w
|
||||
wg.Add(1)
|
||||
go func(metricName string) {
|
||||
|
||||
queryType, params := AssembleSpecificWorkspaceMetricRequestInfo(monitoringRequest, namespaceArray, "", metricName)
|
||||
queryType, params := AssembleSpecificWorkspaceMetricRequestInfo(monitoringRequest, namespaceArray, ".*", metricName)
|
||||
metricsStr := client.SendMonitoringRequest(client.PrometheusEndpoint, queryType, params)
|
||||
ch <- ReformatJson(metricsStr, metricName, map[string]string{ResultItemMetricResourceName: ws})
|
||||
wg.Done()
|
||||
|
||||
@@ -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