Chagne quota usage metric name

from `harbor_project_usage_byte` to `harbor_project_quota_usage_byte`

Signed-off-by: DQ <dengq@vmware.com>
This commit is contained in:
DQ 2021-01-28 18:00:19 +08:00
parent 3ba0d5a590
commit eb5e31a442
2 changed files with 4 additions and 5 deletions

View File

@ -41,7 +41,7 @@ var (
valueType: prometheus.GaugeValue, valueType: prometheus.GaugeValue,
} }
projectUsage = typedDesc{ projectUsage = typedDesc{
desc: newDescWithLables("", "project_usage_byte", "The used resource of a project", "project_name"), desc: newDescWithLables("", "project_quota_usage_byte", "The used resource of a project", "project_name"),
valueType: prometheus.GaugeValue, valueType: prometheus.GaugeValue,
} }
projectQuote = typedDesc{ projectQuote = typedDesc{

View File

@ -9,14 +9,13 @@ import testutils
class TestMetricsExist(unittest.TestCase): class TestMetricsExist(unittest.TestCase):
golang_basic_metrics = ["go_gc_duration_seconds", "go_goroutines", "go_info", "go_memstats_alloc_bytes"] golang_basic_metrics = ["go_gc_duration_seconds", "go_goroutines", "go_info", "go_memstats_alloc_bytes"]
eigen_metrics = { metrics = {
'core': golang_basic_metrics + ["harbor_core_http_request_total", "harbor_core_http_request_duration_seconds", 'core': golang_basic_metrics + ["harbor_core_http_request_total", "harbor_core_http_request_duration_seconds",
"harbor_core_http_inflight_requests"], "harbor_core_http_inflight_requests"],
'registry': golang_basic_metrics + ["registry_http_in_flight_requests"], 'registry': golang_basic_metrics + ["registry_http_in_flight_requests"],
'exporter': golang_basic_metrics + ["artifact_pulled", 'exporter': golang_basic_metrics + ["artifact_pulled",
"harbor_project_artifact_total", "harbor_project_member_total", "harbor_project_quota_byte", "harbor_project_artifact_total", "harbor_project_member_total", "harbor_project_quota_byte",
"harbor_project_repo_total", "harbor_project_total" "harbor_project_repo_total", "harbor_project_total", "project_quota_usage_byte"]
]
} }
def get_metrics(self): def get_metrics(self):
@ -28,7 +27,7 @@ class TestMetricsExist(unittest.TestCase):
def testMetricsExist(self): def testMetricsExist(self):
for k, metric_text in self.get_metrics(): for k, metric_text in self.get_metrics():
for metric_name in self.eigen_metrics[k]: for metric_name in self.metrics[k]:
print("Metric {} should exist in {} ".format(metric_name, k)) print("Metric {} should exist in {} ".format(metric_name, k))
self.assertTrue(metric_name in metric_text) self.assertTrue(metric_name in metric_text)