peimanja / artifactory_exporter

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

Enable artifactory_artifacts* metrics #62

Closed DmytroBilanKaReen closed 2 years ago

DmytroBilanKaReen commented 2 years ago

Hi I'm using Artifactory enterprise 7.21.12 and want to use your exporter for artifactory monitoring. I run exporter from binary and get all metrics excluding artifactory_artifacts* metrics. Haw to enable it?

peimanja commented 2 years ago

Hey @DmytroBilanKaReen that should be available by default. can set the log level to debug --log.level=debug and see if anything shows up there?

redecor-integration commented 2 years ago

Hi @peimanja, are you about?:

level=debug ts=2021-10-28T05:31:40.251Z caller=storage.go:128 msg="Registering metric" metric=repoPercentage repo=rapid-mobile-client type=local package_type=generic value=0.01
level=debug ts=2021-10-28T05:31:40.251Z caller=artifacts.go:23 msg="Finding all artifacts" period=1minutes queryType=created
level=debug ts=2021-10-28T05:31:40.251Z caller=utils.go:86 msg="Running AQL query" path=http://localhost:8081/artifactory/api/search/aql
level=debug ts=2021-10-28T05:36:39.519Z caller=system.go:66 msg="Fetching license stats"

I think I have an issue because my artifactory Items Count is: 14,943,747. How can I fix it?

peimanja commented 2 years ago

@redecor-integration so that metrics shows if anything is created/downloaded during that time.

are you publishing any artifacts or downloading anything during the time you are running this exporter?

DmytroBilanKaReen commented 2 years ago

@peimanja yes: items.find({"stat.downloaded" : {"$last" : "1minutes"}}).include("name", "repo") result

    "range": {
        "start_pos": 0,
        "end_pos": 95,
        "total": 95
    }

this is results in non-working hours.

martinm82 commented 2 years ago

I have the same problem. We have 3 times more artifacts than @redecor-integration and I believe the problem is that it takes just longer to calculate the metrics.

peimanja commented 2 years ago

Interesting. Normally AQL is super fast and should handle that without any issue. any increment in API error in metrics? or anything in the logs?

you can increase the Artifactory timeout (default is 5s) and see if that helps

martinm82 commented 2 years ago

We have in total 350 repositories and roughly 40 million artifacts. The problem seems to be with the artifactory_artifacts_created_Xm metrics.

peimanja commented 2 years ago

We have in total 350 repositories and roughly 40 million artifacts. The problem seems to be with the artifactory_artifacts_created_Xm metrics.

so yes, I'm saying for these artifactory_artifacts_created_ metrics maybe it's taking more than 5 sec hence the exporter is timing out on those requests. increasing the Artifactory timeout might resolve the issue if you really want those metrics.

optionally we can provide a way to disable these metrics if that’s what you want.

martinm82 commented 2 years ago

We have now reduced the scraping interval and as well implemented caching on nginx side to avoid overloading Artifactory with the queries.

DmytroBilanKaReen commented 2 years ago

@martinm82 can you share your solution for resolv?

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

martinmigasiewicz-tomtom commented 2 years ago

@DmytroBilanKaReen this is a snippet of our nginx configuration we added for caching prometheus results. We use Ansible for provisioning the configuration onto the server.

upstream artifactory-metrics-exporter {
  server {{ ansible_default_ipv4.address }}:{{ artifactory_metrics_port }};
}

[...]

location /prometheus/ {
        proxy_cache prometheus-cache;
        proxy_cache_valid 60s;
        proxy_read_timeout  2400s;
        proxy_pass http://artifactory-metrics-exporter/prometheus/;
   }
github-actions[bot] commented 2 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.