Skip to content

Commit ee8a7df

Browse files
committed
Reduce container metrics cardinality
Adds support for passing extra runtime options to cAdvisor. By default new options disable exporting rarely useful metrics and labels by cAdvisor. This helps reducing the load on Prometheus and cAdvisor itself. Change-Id: I81f3845d6cd03a70a0c8569f8d0ea421027df083
1 parent 7548cc8 commit ee8a7df

File tree

4 files changed

+26
-1
lines changed

4 files changed

+26
-1
lines changed

ansible/roles/prometheus/defaults/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,3 +257,5 @@ prometheus_openstack_exporter_disabled_dns: "{{ '--disable-service.dns' if not e
257257
prometheus_openstack_exporter_disabled_object: "{{ '--disable-service.object-store' if not enable_swift | bool else '' }}"
258258
prometheus_openstack_exporter_disabled_lb: "{{ '--disable-service.load-balancer --disable-metric=neutron-loadbalancers --disable-metric=neutron-loadbalancers_not_active' if not enable_octavia | bool else '' }}"
259259
prometheus_openstack_exporter_disabled_items: "{{ [prometheus_openstack_exporter_disabled_volume, prometheus_openstack_exporter_disabled_dns, prometheus_openstack_exporter_disabled_object, prometheus_openstack_exporter_disabled_lb|trim]|join(' ')|trim }}"
260+
261+
prometheus_cadvisor_cmdline_extras: "--docker_only --store_container_labels=false --disable_metrics=percpu,referenced_memory,cpu_topology,resctrl,udp,advtcp,sched,hugetlb,memory_numa,tcp,process"

ansible/roles/prometheus/templates/prometheus-cadvisor.json.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"command": "/opt/cadvisor --port={{ prometheus_cadvisor_port }} --log_dir=/var/log/kolla/prometheus",
2+
"command": "/opt/cadvisor --port={{ prometheus_cadvisor_port }} --log_dir=/var/log/kolla/prometheus {{ prometheus_cadvisor_cmdline_extras }}",
33
"config_files": [],
44
"permissions": [
55
{

etc/kolla/globals.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,10 @@
716716
# List of extra parameters passed to prometheus. You can add as many to the list.
717717
#prometheus_cmdline_extras:
718718

719+
# List of extra parameters passed to cAdvisor. By default system cgroups
720+
# and container labels are not exposed to reduce time series cardinality.
721+
#prometheus_cadvisor_cmdline_extras: "--docker_only --store_container_labels=false --disable_metrics=percpu,referenced_memory,cpu_topology,resctrl,udp,advtcp,sched,hugetlb,memory_numa,tcp,process"
722+
719723
# Example of setting endpoints for prometheus ceph mgr exporter.
720724
# You should add all ceph mgr's in your external ceph deployment.
721725
#prometheus_ceph_mgr_exporter_endpoints:
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
features:
3+
- |
4+
Adds support for passing extra runtime options to cAdvisor via
5+
``prometheus_cadvisor_cmdline_extras`` new variable. By default
6+
system cgroups' metrics are disabled, plus container labels
7+
don't get exposed to Prometheus. Expensive metrics that usually
8+
should not be exported are also enforced to be disabled - consult
9+
`<https://github.com/google/cadvisor/blob/master/docs/runtime_options.md#metrics>`_
10+
for a list. These defaults create savings in resources usage by both
11+
cAdvisor and Prometheus.
12+
upgrade:
13+
- |
14+
cAdvisor has now reduced number of Prometheus metrics and labels
15+
exported by default. This means that corresponding timeseries will
16+
no longer be created. If existing setup relies on these, eg. for
17+
visualisation or alerting, they could be explicitly enabled prior to
18+
upgrading with the ``prometheus_cadvisor_cmdline_extras`` new variable.
19+
Reference for the possible options: `<https://github.com/google/cadvisor/blob/master/docs/runtime_options.md#metrics>`_.

0 commit comments

Comments
 (0)