Skip to content

add artifacts pushed metric

Currently harbor does not expose this: https://goharbor.io/docs/2.3.0/administration/metrics/

only harbor_artifact_pulled and harbor_project_artifact_total.

Looking at the code the pull count is tracked explicitly and comes from this query: https://github.com/goharbor/harbor/blob/63b61d6995a7cc3ae3141ccd28837e9c8ab5fea0/src/pkg/exporter/project_collector.go#L44

The total artifacts comes from this query: https://github.com/goharbor/harbor/blob/63b61d6995a7cc3ae3141ccd28837e9c8ab5fea0/src/pkg/exporter/project_collector.go#L48

I though i saw a soft delete for artifacts but it's only for projects it seems.

The repository table keeps a pull_count that is used for the first metric. We likely need a similar mechanism upstream to calculate a push_count based on the push_time column in the artifact table.