I am using Prometheus to query metrics from Apache Flink. I want to measure the number of records In and Out per second of a Map function. When I query two different metrics in Prometheus, the chart only shows one of them.
flink_taskmanager_job_task_operator_numRecordsInPerSecond{operator_name="Map"}
or flink_taskmanager_job_task_operator_numRecordsOutPerSecond{operator_name="Map"}
Does not matter if I change the operator
or
to and
. The chart shows only the first (flink_taskmanager_job_task_operator_numRecordsInPerSecond
). I also have tried to edit the Prometheus config file /etc/prometheus/prometheus.yml
but I don't have too much experience on Prometheus and there is something wrong in my configuration. I was basing my solution on this post.
global:
scrape_interval: 15s
scrape_configs:
- job_name: 'prometheus'
scrape_interval: 5s
static_configs:
- targets: ['localhost:9090']
- job_name: 'node_exporter'
scrape_interval: 5s
static_configs:
- targets: ['localhost:9100']
- job_name: 'flink'
scrape_interval: 5s
static_configs:
- targets: ['localhost:9250', 'localhost:9251', '192.168.56.20:9250']
metrics_path: /
# HOW TO ADD THE OPERATOR NAME ON THE METRIC NAME?
metric_relabel_configs:
- source_labels: [__name__]
regex: '(flink_taskmanager_job_task_operator)_(\w+)'
replacement: '${2}'
target_label: pool
- source_labels: [__name__]
regex: '(flink_taskmanager_job_task_operator)_(\w+)'
replacement: '${1}_bytes'
target_label: __name__
or
(union),and
(intersection), andunless
(complement) as an operation on sets (prometheus.io/docs/prometheus/latest/querying/operators/…). I don't know how to show two distinct metrics on the same chart in order to compare them.