peimanja / artifactory_exporter

JFrog Artifactory Prometheus Exporter written in Go
Apache License 2.0
141 stars 37 forks source link

Artifact create/download per repo metrics #33

Closed ggatward closed 4 years ago

ggatward commented 4 years ago

Would it be possible to include metrics for the number of artifacts created and downloaded per repo?
This would round out the metrics requirements for a project we are working on using your exporter... For example (from https://github.com/petrjurasek/artifactory-prometheus-exporter)

# HELP artifactory_artifacts_downloaded Downloaded artifacts
# TYPE artifactory_artifacts_downloaded gauge
artifactory_artifacts_downloaded{key="example-repo-local",minutes_ago="1"} 0.0
artifactory_artifacts_downloaded{key="example-repo-local",minutes_ago="60"} 0.0
artifactory_artifacts_downloaded{key="example-repo-local",minutes_ago="5"} 0.0
# HELP artifactory_artifacts_created Created artifacts
# TYPE artifactory_artifacts_created gauge
artifactory_artifacts_created{key="example-repo-local",minutes_ago="1"} 0.0
artifactory_artifacts_created{key="example-repo-local",minutes_ago="60"} 0.0
artifactory_artifacts_created{key="example-repo-local",minutes_ago="5"} 0.0
peimanja commented 4 years ago

Thanks for the suggestion. Initially we were looking at adding this metric but found out it is a very heavy API call to Artifactory since you have to make separate call for each repository and for each time range. I will look at this when I get a chance this weekend and maybe add it to the exporter with a flag to enable those metrics.

ggatward commented 4 years ago

That'd be great ... probably don't need to query ALL the time ranges, perhaps only the last 5 minutes and then let the visualisation layer (Grafana) roll that up to other ranges may be enough. Really just looking for a method to identify repos that may be no longer in use - no uploads or downloads in x period makes it a candidate for deletion :-)

peimanja commented 4 years ago

@ggatward I managed to add them using AQL which has a very good performance with a few API calls. Let me know how that works out for you.