Exposing prometheus metric collection for machines?

I’m wondering how I can tell the provided prometheus to collect metrics from machines created via the API. There does not seem to be any configuration for that in the docs.

Thanks!

I believe that you can do this by adding metrics to your config like this:

{
  ...
  "config": {
    ...
    "metrics": {
      "port": 9187,
      "path": "/metrics"
    }
  }
}

(This particular example is from a Fly Postgres machine—I pulled the config down with fly machines status -d.)

Will try this out, thanks!

I’ve got this in my config for machine creation, but I do not see the custom metrics being pulled into grafana

"services": [
          {
            "ports": [
              {
                "port": 80,
                "handlers": ["http"]
              }
            ],
            "protocol" : "tcp",
            "internal_port" : 8190
          },
          {
            "ports": [
              {
                "port": 8191,
                "handlers": ["http"]
              }
            ],
            "protocol" : "tcp",
            "internal_port" : 8191
          },
        ],
        "metrics": {
          "port": 8191,
          "path": "/metrics"
        }

And I can query it through the load balancer, so it’s definitely serving on 0.0.0.0:8191

Seems like after a while it has started to pick them up, but I still don’t see all of them…

Ok, after a long while they all started showing!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.