What does the job label mean in Prometheus?
Learn how job_name sets the default job label, how job differs from instance, and when relabeling or honor_labels changes the result.
The job label normally comes from job_name in a Prometheus scrape configuration. It identifies a group of targets collected under that configuration, such as Node Exporter instances or an application's metrics endpoints.
Job identifies the group; instance identifies the target
scrape_configs:
- job_name: node
static_configs:
- targets: ['10.0.0.1:9100', '10.0.0.2:9100']
The targets normally produce samples labeled job="node", with instance="10.0.0.1:9100" or instance="10.0.0.2:9100" respectively.
Use the job label to select that group:
up{job="node"}
For an application counter with consistent meaning across its jobs, compare rates by job:
topk(5, sum by (job) (rate(http_requests_total[5m])))
This ranks request rates, not a generic measure of server load. Choose a metric whose semantics match the comparison.
Choose stable, descriptive names
Names such as mysql, node, or api_gateway make queries readable. A consistent lowercase convention is useful, but underscores are a team convention rather than a requirement for job label values.
Use additional labels such as environment="production" when you want to compare the same component across environments. Environment-specific job names can also work if the team uses them consistently. Avoid mixing unrelated purposes in one job when they require different scrape settings or make queries ambiguous.
Understand overrides and conflicts
Target relabeling can rewrite job, so the final label is not guaranteed to equal the original job_name.
If an exporter supplies its own job label, the default honor_labels: false keeps the target-side value and renames the conflicting scraped label with an exported_ prefix. Setting honor_labels: true preserves the exporter's conflicting label instead. This matters for federation and Pushgateway use cases.
FAQ
Can I omit job_name? A scrape configuration requires a job_name, and job names must be unique within the configuration. That configuration requirement is distinct from the final sample labels, which relabeling can transform.
Can one job scrape different ports? Yes. Each target can specify its own port. Split jobs when the endpoints need different scrape behavior or represent unrelated kinds of data, rather than solely because their port numbers differ.
Sources
This guide is based on the documentation below; the examples have not been tested against a live deployment.
Contact us
Join the community
to join the community
Try Guance
Start online and pay only for what you use.
Get startedChoose a Guance plan