Monitoring Gitlab Runner through /metrics endpoint

Hello,
I’m trying to expose the native prometheus metrics endpoint as mentioned in the documentation but it does not seem to work, no HTTP endpoint is exposed after configuring the .toml file.

Here’s my configuration file

concurrent = 1
check_interval = 0
shutdown_timeout = 0
log_level = "warning"
[session_server]
  session_timeout = 1800

[[runners]]
  name = "Gitlab-runner-test"
  url = "**************"
  id = 129
  token = "************"
  token_obtained_at = 2023-06-09T09:53:41Z
  token_expires_at = 0001-01-01T00:00:00Z
  executor = "shell"
  [runners.cache]
    MaxUploadedArchiveSize = 0
  [runners.prometheus]
    enabled = true
    listen_address = ":9252"

Are there any aditional steps that i am missing or that i have misconfigured? the documentation is really lacking in the metrics part imo

It works here, where it is configured for all runners on a server:

listen_address = "0.0.0.0:9252"
concurrent = 7
check_interval = 3
shutdown_timeout = 0

[session_server]
  session_timeout = 1800

[[runners]]
...

(it’s from a test server, so concurrent and check_interval have strange values). I don’t know if it will work without specifying an ip (I have a vague recollection of getting some errors (re-)starting the runner when I had syntax errors in that value), but (although I can see what it would do) I don’t think it can be configured pr. runner it has to be global.

3 Likes

Thank you so much! the metrics are now exposed. It does work without the ip (it’s the same as writing 0.0.0.0:port i guess according to the docs)

1 Like