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

"Application metrics" not being exported after setting ENABLE_METRICS #713

Open
davidpellcb opened this issue Aug 15, 2023 · 4 comments
Open

Comments

@davidpellcb
Copy link

davidpellcb commented Aug 15, 2023

Chart version: 3.6.2

We've set ENABLE_METRICS:

/ $ strings /proc/1/environ | grep -i metrics
ENABLE_METRICS=true

...however, the metrics chartmuseum_charts_served_total and chartmuseum_chart_versions_served_total documented here aren't being exported.

❯ curl -s localhost:8080/metrics | grep -v "#" | grep chartmuseum_chart | wc -l
       0

The "general global metrics" are being exported:

❯ curl -s localhost:8080/metrics | grep -v "#" | grep -i chartmuseum
chartmuseum_request_duration_seconds_sum 11.347815388000111
chartmuseum_request_duration_seconds_count 330745
chartmuseum_request_size_bytes_sum 2.8782004e+07
chartmuseum_request_size_bytes_count 330745
chartmuseum_requests_total{code="200",handler="helm.sh/chartmuseum/pkg/chartmuseum/router.(*Router).rootHandler-fm",host="x:8080",method="GET",url="/health"} 330192
chartmuseum_requests_total{code="200",handler="helm.sh/chartmuseum/pkg/chartmuseum/router.(*Router).rootHandler-fm",host="x:8080",method="GET",url="/:repoindex.yaml"} 553
chartmuseum_response_size_bytes_sum 4.34963519e+08
chartmuseum_response_size_bytes_count 330745
@cbuto
Copy link
Contributor

cbuto commented Aug 21, 2023

@davidpellcb do you see any logs that might help identify the issue? or maybe share your full configuration (redacted) so we can try to reproduce?

I ran ChartMuseum v0.14.0 locally and saw the metrics being exported.

@mzupan
Copy link

mzupan commented Oct 31, 2023

@cbuto did you test against an object store like s3? it works fine if i have local storage but fails for s3

@mzupan
Copy link

mzupan commented Oct 31, 2023

ok metrics work fine in my testing on s3.. the issue is if app dies there no cache or state. If you do another push for a chart the metrics come back.

@jlm0x017
Copy link

jlm0x017 commented Nov 2, 2023

Did some poking at this. It's not just "chart/version served total" metrics that are delayed. "Requests total" is delayed as well; not showing in /metrics until after the first call is made.

$ curl -s http://localhost:8080/metrics | grep -v '^#' | grep -E '^chartmuseum'
chartmuseum_request_duration_seconds_sum 0
chartmuseum_request_duration_seconds_count 0
chartmuseum_request_size_bytes_sum 0
chartmuseum_request_size_bytes_count 0
chartmuseum_response_size_bytes_sum 0
chartmuseum_response_size_bytes_count 0
$ curl -s http://localhost:8080/metrics | grep -v '^#' | grep -E '^chartmuseum.*total'
$ curl  http://localhost:8080/api/charts | jq '.' | head -5
{
  "redacted": [
    {
      "name": "redacted",
      "version": "0.2.2",
$ curl -s http://localhost:8080/metrics | grep -v '^#' | grep -E '^chartmuseum.*total'
chartmuseum_requests_total{code="200",handler="helm.sh/chartmuseum/pkg/chartmuseum/router.(*Router).rootHandler-fm",host="localhost:8080",method="GET",url="/:repoapi/charts"} 1

I'm suspicious that this upstream bug is related: zsais/go-gin-prometheus#55

I was hoping that forcing a cache or index refresh would trigger the stats to appear; I ran chartmuseum alternatively with --cache-interval=30s and --always-regenerate-chart-index but neither was getting the chart/version totals to appear.

Finally, I'll add, @mzupan already notes a POST will cause the metrics to start appearing. So will a DELETE. This is perhaps easier to trigger:

$ curl -X "DELETE" http://localhost:8080/api/charts/nonexistant/0.1.0
{"deleted":true}

testing was done with the v0.16.0 docker container on my local machine, but pointed at our s3 bucket.

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

No branches or pull requests

4 participants