harbor icon indicating copy to clipboard operation
harbor copied to clipboard

Feature export Harbor statistics as Prometheus metric

Open tpoxa opened this issue 1 year ago • 5 comments

This PR exposes the Harbor statistics as Prometheus metric.

The data exposed as metrics are 1:1 taken from thestatistics API, including the name.

New Metrics

  • harbor_statistics_private_project_amount
  • harbor_statistics_private_repo_amount
  • harbor_statistics_public_project_amount
  • harbor_statistics_public_repo_amount
  • harbor_statistics_total_project_amount
  • harbor_statistics_total_repo_amount
  • harbor_statistics_total_storage_consumption

Please indicate you've done the following:

  • [x] Well-Written Title and Summary of the PR
  • [x] Label the PR as needed. release-note/enhancement
  • [x] Accepted the DCO. Commits without the DCO will delay acceptance.
  • [x] Made sure tests are passing and test coverage is added if needed.
  • [x] Considered the docs impact and opened a new docs issue or PR with docs changes if needed in website repository.

tpoxa avatar May 15 '23 19:05 tpoxa

Codecov Report

Attention: Patch coverage is 58.88889% with 37 lines in your changes are missing coverage. Please review.

Project coverage is 70.65%. Comparing base (a3e1b1e) to head (6bc12b5). Report is 27 commits behind head on main.

:exclamation: Current head 6bc12b5 differs from pull request most recent head 5c949c1. Consider uploading reports for the commit 5c949c1 to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #18679      +/-   ##
==========================================
+ Coverage   67.45%   70.65%   +3.19%     
==========================================
  Files         996      748     -248     
  Lines      109773    95932   -13841     
  Branches     2720        0    -2720     
==========================================
- Hits        74044    67776    -6268     
+ Misses      31747    24484    -7263     
+ Partials     3982     3672     -310     
Flag Coverage Δ
unittests 70.65% <58.88%> (+3.19%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
src/pkg/exporter/exporter.go 6.66% <0.00%> (-0.23%) :arrow_down:
src/pkg/exporter/statistics_collector.go 60.91% <60.91%> (ø)

... and 272 files with indirect coverage changes

codecov[bot] avatar May 15 '23 19:05 codecov[bot]

This PR is being marked stale due to a period of inactivty. If this PR is still relevant, please comment or remove the stale label. Otherwise, this PR will close in 30 days.

github-actions[bot] avatar Jul 21 '23 09:07 github-actions[bot]

This PR was closed because it has been stalled for 30 days with no activity. If this PR is still relevant, please re-open a new PR against main.

github-actions[bot] avatar Aug 21 '23 09:08 github-actions[bot]

@Vad1mo since we've reached the FC of v2.10 this week, I just put it into the v2.11 candidate.

wy65701436 avatar Nov 28 '23 06:11 wy65701436

@wy65701436 any chance we can get this merged into 2.11?

Vad1mo avatar Apr 09 '24 18:04 Vad1mo