From 0e83717914c27c0e7ef5cc24e9f55e021436cac4 Mon Sep 17 00:00:00 2001 From: huanggze Date: Mon, 25 May 2020 17:44:23 +0800 Subject: [PATCH] monitor: fix platform-level statistics Signed-off-by: huanggze --- pkg/models/monitoring/monitoring.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/models/monitoring/monitoring.go b/pkg/models/monitoring/monitoring.go index 9261afdfe..4aa1ef811 100644 --- a/pkg/models/monitoring/monitoring.go +++ b/pkg/models/monitoring/monitoring.go @@ -142,7 +142,7 @@ func (mo monitoringOperator) GetKubeSphereStats() Metrics { }) } - wkList, err := mo.ks.Tenant().V1alpha1().Workspaces().Lister().List(labels.Everything()) + wkList, err := mo.ks.Tenant().V1alpha2().WorkspaceTemplates().Lister().List(labels.Everything()) if err != nil { res.Results = append(res.Results, monitoring.Metric{ MetricName: KubeSphereWorkspaceCount, @@ -182,7 +182,13 @@ func (mo monitoringOperator) GetKubeSphereStats() Metrics { }) } - tmpls, err := mo.op.ListApps(¶ms.Conditions{}, "", false, 0, 0) + cond := ¶ms.Conditions{ + Match: map[string]string{ + openpitrix.Status: openpitrix.StatusActive, + openpitrix.RepoId: openpitrix.BuiltinRepoId, + }, + } + tmpls, err := mo.op.ListApps(cond, "", false, 0, 0) if err != nil { res.Results = append(res.Results, monitoring.Metric{ MetricName: KubeSphereAppTmplCount,