Merge pull request #14117 from ninjadq/fix_quota_metric_name

Chagne quota usage metric name
This commit is contained in:
Qian Deng 2021-01-29 10:36:55 +08:00 committed by GitHub
commit 6d78189dff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 5 deletions

View File

@ -41,7 +41,7 @@ var (
valueType: prometheus.GaugeValue,
}
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,
}
projectQuote = typedDesc{

View File

@ -9,14 +9,13 @@ import testutils
class TestMetricsExist(unittest.TestCase):
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",
"harbor_core_http_inflight_requests"],
'registry': golang_basic_metrics + ["registry_http_in_flight_requests"],
'exporter': golang_basic_metrics + ["artifact_pulled",
"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):
@ -28,7 +27,7 @@ class TestMetricsExist(unittest.TestCase):
def testMetricsExist(self):
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))
self.assertTrue(metric_name in metric_text)