Prometheus configuration¶
The prometheus section in paas-config.yaml allows you to define custom
Prometheus scrape targets for metrics collection. This configuration is useful when the default
framework metrics are insufficient for your use case or you want to
expose additional metrics endpoints.
The custom scrape configurations are merged with the default framework metrics job (if defined), so both can be active when you integrate with Prometheus.
Configuration schema¶
prometheus¶
The optional top-level prometheus section contains scrape configuration.
Field |
Type |
Description |
|---|---|---|
|
List |
List of scrape job configurations. Optional. |
scrape_configs¶
Each item in scrape_configs defines a Prometheus scrape job.
Field |
Type |
Description |
|---|---|---|
|
String |
Unique name for this scrape job. Required. Must be unique across all jobs. |
|
String |
HTTP path to scrape for metrics. Optional. Default: |
|
List |
List of static target configurations. Required. |
static_configs¶
Each static configuration defines a set of targets and optional labels.
Field |
Type |
Description |
|---|---|---|
|
List of strings |
List of target endpoints to scrape. Required. Supports wildcards and placeholders. |
|
Dictionary |
Key-value pairs of labels to attach to all metrics from these targets. Optional. |
Target formats¶
The targets field supports several formats:
Wildcard targets¶
Use *:PORT to target all units in the application on the specified port:
targets:
- "*:8081" # Scrapes all units on port 8081
This target expands to the pod IP addresses of all units.
Scheduler-only targets¶
Use @scheduler:PORT to target only the scheduler services:
targets:
- "@scheduler:8082" # Scrapes only scheduler service on port 8082
Scheduler services are guaranteed to run in only one unit. See Worker and Scheduler Services.
The @scheduler placeholder resolves to the fully qualified domain name (FQDN)
of the scheduler unit.
Specific hosts¶
You can also specify exact hostnames or IP addresses in the targets section. For example:
prometheus:
scrape_configs:
# Application metrics from all units
- job_name: "flask-app-custom"
metrics_path: "/metrics"
static_configs:
- targets:
- "*:8081"
labels:
app: "flask"
env: "example"
# Scheduler-specific metrics
- job_name: "flask-scheduler-metrics"
metrics_path: "/metrics"
static_configs:
- targets:
- "@scheduler:8082"
labels:
role: "scheduler"
Validation rules¶
The Prometheus configuration validates the following rules:
No extra fields are allowed in the schema.
Each
job_namemust be unique across all scrape configs.Targets using the
@scheduler:PORTformat will require a numeric port.
See also