Hi! I’m trying to add custom Prometheus metrics to my Rails app, but I can’t quite get my configuration right. I’m trying to use the prometheus_exporter
gem (GitHub - discourse/prometheus_exporter: A framework for collecting and aggregating prometheus metrics). I’ve got the setup working in development, but I can’t quite get the pieces together in production.
Here’s my current fly.toml
:
app = "my-app"
primary_region = "iad"
console_command = "/rails/bin/rails console"
[processes]
app = "bin/rails server"
worker = "bundle exec good_job start"
metrics = "bundle exec prometheus_exporter -b 0.0.0.0"
[metrics]
port = 9394
path = "/metrics" # default for most prometheus exporters
processes = ["app", "worker"]
[build]
[http_service]
internal_port = 3000
force_https = true
auto_start_machines = true
min_machines_running = 1
processes = ["app"]
[[statics]]
guest_path = "/rails/public"
url_prefix = "/"
I tried to add a new process for the metrics exporter, and it seems to have properly started a new machine, but the problem is, my app process can’t find the metrics exporter. The logs have this:
app[...] ERROR -- : Prometheus Exporter, failed to send message Connection refused - connect(2) for "0.0.0.0" port 9394
So, I think it’s trying to find the right IP and port, but for some reason, it’s not finding anything. Can anyone suggest a way I might update my configuration to make this work?
Thanks!