And I’m able to query the metrics with curl https://my.custom.domain/metrics ( I also tried with a separate handler on :9090 but that didn’t work).
In my fly.toml I have the following config:
[metrics]
port = 80
path = "/metrics"
I have set up the data source in Grafana, and I can see the default Fly metrics, so that integration works, but I don’t see the metrics exported by caddy anywhere in the prometheus instance.
I also connected via ssh to see what’s going on, looks like Caddy is binding on :::80 and :::9091 instead of 0.0.0.0 ? Not sure if that could be the issue…
/ # netstat -ltnup
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:2019 0.0.0.0:* LISTEN 515/caddy
tcp 0 0 fdaa:0:5c86:a7b:88dc:80ab:7419:2:22 :::* LISTEN 516/hallpass
tcp 0 0 :::9091 :::* LISTEN 515/caddy
tcp 0 0 :::80 :::* LISTEN 515/caddy
yeah that’s what I think too, I also curled locally on 0.0.0.0 and it works so that’s a good sign
I tried a few things since I posted this, latest try I have metrics served on :9091 so it’s probably not accessible externally, but the metrics are there, that much I’m sure.
mhm, interesting, so I know that Caddy is kinda picky there, if the host isn’t the same as defined in the Caddyfile, it won’t serve the content (I’m not actually sure what’s the behavior there, still pretty new to Caddy). Since my config is set to serve on localhost:9091 I’m guessing Caddy doesn’t recognize that IP and that’s why it’s not serving the content?
I think I’ll need to ask on the Caddy discourse then, not sure how I can have it pick up the host IP
Hey @wperron , I’m also setting this up but having trouble – I’m able to ssh into the caddy instance and access /metrics however nothing seems to have changed on Fly.io / Grafana’s side. Perhaps it cannot access it, but unsure how to debug that.
With this connected were you able to see HTTP status codes reflected in the Metrics page in Fly?
Hey @tomm , You won’t see your own metrics in the Fly console, you’ll need to add it as a datasource to Grafana (or whatever dashboarding tool you like) and then you’ll be able to query your metrics.
Thanks for jumping in on this old issue, this was the clue I needed. For anyone that ends up here in the future – Head over to the fly-hosted Grafana and click on Explore in the left menu
From there you should be able to see that your caddy_ metrics are being ingested and can clone and modify the existing dashboards to include them or create a new one.