How dangerous are high-cardinality labels in Prometheus?

High-cardinality labels (e.g. labels with big number of unique values) aren’t dangerous on their own. The danger is in the total number of active time series. A single Prometheus instance can handle up to ten millions of active time series according to https://www.robustperception.io/why-does-prometheus-use-so-much-ram when running on a host with >100GB of RAM. An example: suppose … Read more

How can I alert for container restarted?

I used the following Prometheus alert rule for finding container restarts in an hour(can be modified to max time), It may be helpful for you. Prometheus Alert Rule Sample ALERT ContainerRestart/PodRestart IF rate(kube_pod_container_status_restarts[1h]) * 3600 > 1 FOR 5s LABELS {action_required = “true”, severity=”critical/warning/info”} ANNOTATIONS {DESCRIPTION=”Pod {{$labels.namespace}}/{{$labels.pod}} restarting more than once during last one hours.”, … Read more

Different Prometheus scrape URL for every target

You currently can’t configure the metrics_path per target within a job but you can create separate jobs for each of your targets so you can define metrics_path per target. Your config file would look something like this: scrape_configs: – job_name: ‘example-target-1’ scrape_interval: 5s metrics_path: /target-1-path-to-metrics static_configs: – targets: [‘localhost:8090’] labels: group: ‘dummy’ – job_name: ‘example-target-2’ … Read more