From 31de14024da0a54a693c02d83cd0aa1125af4b28 Mon Sep 17 00:00:00 2001 From: Vadim Bauer <1492007+Vad1mo@users.noreply.github.com> Date: Sat, 18 Nov 2023 16:26:24 +0100 Subject: [PATCH 1/2] Description for export Harbor statistics as Prometheus metric for PR https://github.com/goharbor/harbor/pull/18679/ Signed-off-by: Vadim Bauer <1492007+Vad1mo@users.noreply.github.com> --- docs/administration/metrics/_index.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/administration/metrics/_index.md b/docs/administration/metrics/_index.md index e1a48ecdd..6d482e722 100644 --- a/docs/administration/metrics/_index.md +++ b/docs/administration/metrics/_index.md @@ -51,6 +51,22 @@ Name | Description | Labels (Values) | Metric type `harbor_core_http_request_total` | The total number of requests | method (`GET`, `POST`, `HEAD`, `PATCH`, `PUT`), operation (values from `operationId` in [Harbor API](https://github.com/goharbor/harbor/blob/main/api/v2.0/swagger.yaml). Some legacy endpoints do not have an `operationId`, so the label value is `unknown`) | counter {{< /table >}} +## Harbor Statistics Metrics +Get the statistic information about the projects and repositories +The data exposed as metrics are 1:1 taken from the statistics API `/api/v2.0/statistics`. + +{{< table caption="Statistics Metrics exposed by Harbor Core" >}} +Name | Description | Labels (Values) | Metric type +:---------|:------------|:-------|:------- +`harbor_statistics_private_project_amount` "Amount of private projects" || gauge +`harbor_statistics_private_repo_amount` | "Amount of private repositories" || gauge +`harbor_statistics_public_project_amount` | "Amount of public projects" || gauge +`harbor_statistics_public_repo_amount` | "Amount of public repositories" || gauge +`harbor_statistics_total_project_amount` | Total amount of projects || gauge +`harbor_statistics_total_repo_amount` | "Total amount of repositories" || gauge +`harbor_statistics_total_storage_consumption` | Total storage used | | gauge +{{< /table >}} + ## Registry Metrics The following are metrics pulled from the Docker distribution and are available at `:/?comp=registry`. From b6b58edf4eb6968320e2f91f35ddf65cf02e77aa Mon Sep 17 00:00:00 2001 From: Vadim Bauer <1492007+Vad1mo@users.noreply.github.com> Date: Mon, 20 Nov 2023 12:14:38 +0100 Subject: [PATCH 2/2] add bytes Signed-off-by: Vadim Bauer <1492007+Vad1mo@users.noreply.github.com> --- docs/administration/metrics/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/administration/metrics/_index.md b/docs/administration/metrics/_index.md index 6d482e722..aee96f194 100644 --- a/docs/administration/metrics/_index.md +++ b/docs/administration/metrics/_index.md @@ -64,7 +64,7 @@ Name | Description | Labels (Values) | Metric type `harbor_statistics_public_repo_amount` | "Amount of public repositories" || gauge `harbor_statistics_total_project_amount` | Total amount of projects || gauge `harbor_statistics_total_repo_amount` | "Total amount of repositories" || gauge -`harbor_statistics_total_storage_consumption` | Total storage used | | gauge +`harbor_statistics_total_storage_consumption` | Total storage used in bytes | | gauge {{< /table >}} ## Registry Metrics