Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metric harbor_artifact_pulled should be Counter type, not Gauge #20334

Open
Gypsying opened this issue Apr 23, 2024 · 4 comments
Open

Metric harbor_artifact_pulled should be Counter type, not Gauge #20334

Gypsying opened this issue Apr 23, 2024 · 4 comments
Assignees

Comments

@Gypsying
Copy link

  • harbor version: [2.5.3]
@Gypsying
Copy link
Author

@phin1x
Copy link
Contributor

phin1x commented Apr 24, 2024

the definition of a counter (from https://prometheus.io/docs/concepts/metric_types/#counter):
A counter is a cumulative metric that represents a single monotonically increasing counter whose value can only increase or be reset to zero on restart. For example, you can use a counter to represent the number of requests served, tasks completed, or errors.

the pulled values never goes down (why should it), so counter is the correct type. mabye you missing the rate or irate function.

@Gypsying
Copy link
Author

the definition of a counter (from https://prometheus.io/docs/concepts/metric_types/#counter): A counter is a cumulative metric that represents a single monotonically increasing counter whose value can only increase or be reset to zero on restart. For example, you can use a counter to represent the number of requests served, tasks completed, or errors.

the pulled values never goes down (why should it), so counter is the correct type. mabye you missing the rate or irate function.

Of course, harbor_artifact_pulled should be counter type,
but the metric harbor exposed is Gauge, code definition

@Gypsying Gypsying changed the title Metric harbor_artifact_pulled is Counter type, not Gauge Metric harbor_artifact_pulled should be Counter type, not Gauge Apr 25, 2024
@wy65701436 wy65701436 self-assigned this Apr 29, 2024
@chlins
Copy link
Member

chlins commented May 3, 2024

You may notice that the harbor_artifact_pulled is a metric crawled by the harbor exporter component, so the value is fetched from the database query, and the Counter type we should call the Inc() method if the artifact to be pulled each time, here the scenario is not that case, as the value in fact is a momentary value queried from database, so here this type we used the Guage type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants