GitLab Runner Prometheus Metrics

Published
Length
3 min read

Luis Felipe Dias

All posts

You turn on gitlab runner prometheus metrics by enabling the built-in metric server on each runner host. The runner then serves live job and system counts over a local web port for scraping. Teams often set up this endpoint to watch build queues and spot slow jobs. Still, opening network ports and sharing host keys across teams creates security risks. Broad host roles let too many people log in and change runner settings. How gitlab runner prometheus metrics work Each runner process includes

GitLab CI Security + Security Metrics & KPIs: the complete guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free white paper. No spam. Unsubscribe anytime.

You turn on gitlab runner prometheus metrics by enabling the built-in metric server on each runner host. The runner then serves live job and system counts over a local web port for scraping. Teams often set up this endpoint to watch build queues and spot slow jobs. Still, opening network ports and sharing host keys across teams creates security risks. Broad host roles let too many people log in and change runner settings.

How gitlab runner prometheus metrics work

Each runner process includes an internal web server that tracks runner health and job stats. When you turn on this feature in the runner file, the service listens on a set address. A metric collector then connects to that port on a regular schedule to read the data. The runner reports how many jobs are active, queued, or failing at any moment. It also shares basic details about API errors, concurrent limits, and process memory use.

To set this up well, you bind the metric listener to an internal network interface. Your monitoring tool reaches out to each runner host and pulls the latest numbers. Teams then build charts and alerts from those numbers to catch stuck builds early. When queues grow too large, engineers can add more runner hosts to handle the load. This setup keeps build pipelines moving without forcing engineers to check every host by hand.

Why metric ports need strict network rules

A metric port does not let a user run build jobs or edit source code. Still, the data on that port reveals how your build system works under the hood. Anyone who can read the endpoint can see job volume, project activity, and runner state. If you bind the listener to a public address, outside actors can map your build workload. Good network rules restrict that port so only your metric collector can reach it.

Teams also run into trouble when debugging a runner that reports bad metrics. When an alert fires, an engineer usually logs in to the runner host to check logs. If the team shares one static admin key for all runner hosts, everyone gets full control. A mistake during a live check can stop active builds or expose stored build secrets.

GitLab CI Security + Security Metrics & KPIs: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

What native runner metrics solve and what they miss

Native runner metrics do a great job of showing high-level build health and host load. They tell you when a runner goes offline or hits its max job limit. They also show when network calls back to the main code server start to fail. This helps platform teams plan capacity and keep wait times low for developers.

Still, metrics and host login rules only cover the surface of runner safety. Host roles decide who can log in to a runner box to fix a problem. They do not track or control which commands an engineer runs once inside that host. If an engineer inspects a broken job, static host access leaves no detailed command trail. Also, if a runner talks to production databases during deployment, metrics cannot inspect those queries. Teams still need a way to govern live commands and protect sensitive data in flight.

Add runtime guardrails and masking beside your databases and APIs

Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits beside the service as an open-source proxy, a sidecar for your database or API.

Before a query runs, hoop.dev guardrails check the statement against your rules. An AI Analyzer you configure can score intent or hold risky calls for human review. Next, hoop.dev data masking rewrites sensitive fields in responses, and each verdict is logged per listener. Explore the MIT-licensed project on GitHub.

Frequently asked questions

What data do runner metrics expose to a collector?

The runner shares counts for running jobs, failed builds, queued tasks, and API request statuses. It also exports process details like memory use, CPU load, and open file handles.

Do I need to install extra tools on the runner host for metrics?

No, the runner binary includes a native metric server right out of the box. You only need to turn on the listen address in the main runner file and restart.

How should teams secure the runner metric port?

Bind the metric port to a private network address instead of a public interface. Use firewall rules so only your central metric collector can reach that specific port.

Save the open-source gateway.

hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.