Skip to content

Report container FS metrics into prometheus /metrics #1642

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 28, 2017

Conversation

smarterclayton
Copy link
Contributor

Fixes #1403

PerDiskStats reported from cgroups were not being surfaced into
prometheus. In order to properly correlate the metrics, we need to
assign a device label to each metric (which is the FS or device path).
Since blkio cgroup tracks devices, we create a synthetic device
/dev/NAME for the metric.

Assign a Device label to each PerDiskStat for the handlers up front, and
then surface the PerDiskStat values into the prometheus metrics. Report
two new metrics - total bytes read and total bytes written.

Open questions:

  • Does this add too much extra data (are there metrics we would drop?)
  • Do I have the correct mapping between blkio and the Filesystem stats (at casual reading yes, but not positive)
  • Do we want to add the _bytes_total metrics?
  • Is there an equivalent to weighted_time in blkio (I don't think so, but could be wrong)
  • Did this regress performance for cadvisor gathering (device assignment is fairly cheap, but...)

@smarterclayton
Copy link
Contributor Author

oc get --raw /metrics | grep _fs_
# HELP container_fs_inodes_free Number of available Inodes
# TYPE container_fs_inodes_free gauge
container_fs_inodes_free{device="/dev/mapper/centos-openshift--xfs--vol--dir",id="/"} 1.046118e+07
container_fs_inodes_free{device="/dev/mapper/centos-root",id="/"} 3.0020491e+07
container_fs_inodes_free{device="/dev/sda1",id="/"} 511656
# HELP container_fs_inodes_total Number of Inodes
# TYPE container_fs_inodes_total gauge
container_fs_inodes_total{device="/dev/mapper/centos-openshift--xfs--vol--dir",id="/"} 1.0461184e+07
container_fs_inodes_total{device="/dev/mapper/centos-root",id="/"} 3.0721888e+07
container_fs_inodes_total{device="/dev/sda1",id="/"} 512000
# HELP container_fs_io_current Number of I/Os currently in progress
# TYPE container_fs_io_current gauge
container_fs_io_current{device="/dev/mapper/centos-openshift--xfs--vol--dir",id="/"} 0
container_fs_io_current{device="/dev/mapper/centos-root",id="/"} 0
container_fs_io_current{device="/dev/sda",id="/"} 0
container_fs_io_current{device="/dev/sda",id="/system.slice"} 0
container_fs_io_current{device="/dev/sda",id="/system.slice/NetworkManager.service"} 0
container_fs_io_current{device="/dev/sda",id="/system.slice/atd.service"} 0
container_fs_io_current{device="/dev/sda",id="/system.slice/auditd.service"} 0
container_fs_io_current{device="/dev/sda",id="/system.slice/crond.service"} 0
container_fs_io_current{device="/dev/sda",id="/system.slice/dbus.service"} 0
container_fs_io_current{device="/dev/sda",id="/system.slice/docker-1e8fa84249225e6cd7e4873b0339215d346e924309954f2d3cb3475d3cf93405.scope"} 0
container_fs_io_current{device="/dev/sda",id="/system.slice/docker-6f68e87c197dcc2990731b15a434b237ba784fee3b65f8708196a88f95cce032.scope"} 0
container_fs_io_current{device="/dev/sda",id="/system.slice/docker-bf7e5fce1172be7dd2f4ff7a97847b478920157fae61f86cf44599e431c9f558.scope"} 0
container_fs_io_current{device="/dev/sda",id="/system.slice/docker-containerd.service"} 0
container_fs_io_current{device="/dev/sda",id="/system.slice/docker.service"} 0
container_fs_io_current{device="/dev/sda",id="/system.slice/gssproxy.service"} 0
container_fs_io_current{device="/dev/sda",id="/system.slice/irqbalance.service"} 0
container_fs_io_current{device="/dev/sda",id="/system.slice/lvm2-lvmetad.service"} 0
container_fs_io_current{device="/dev/sda",id="/system.slice/polkit.service"} 0
container_fs_io_current{device="/dev/sda",id="/system.slice/postfix.service"} 0
container_fs_io_current{device="/dev/sda",id="/system.slice/rhel-push-plugin.service"} 0
container_fs_io_current{device="/dev/sda",id="/system.slice/rhsmcertd.service"} 0
container_fs_io_current{device="/dev/sda",id="/system.slice/rsyslog.service"} 0
container_fs_io_current{device="/dev/sda",id="/system.slice/sshd.service"} 0
container_fs_io_current{device="/dev/sda",id="/system.slice/systemd-journald.service"} 0
container_fs_io_current{device="/dev/sda",id="/system.slice/systemd-logind.service"} 0
container_fs_io_current{device="/dev/sda",id="/system.slice/systemd-udevd.service"} 0
container_fs_io_current{device="/dev/sda",id="/user.slice"} 0
container_fs_io_current{device="/dev/sda1",id="/"} 0
container_fs_io_current{container_name="registry",device="/dev/sda",id="/system.slice/docker-da6260076d47a04536b3a8339ccb40143a6c55c731c98c7a99fb3e32ea5b1f3f.scope",image="openshift/origin-docker-registry:v3.6.0-alpha.1",name="k8s_registry.c5fb07ea_docker-registry-1-g89b9_default_f702f49d-248d-11e7-9470-080027893417_868be8c3",namespace="default",pod_name="docker-registry-1-g89b9"} 0
# HELP container_fs_io_time_seconds_total Cumulative count of seconds spent doing I/Os
# TYPE container_fs_io_time_seconds_total counter
container_fs_io_time_seconds_total{device="/dev/mapper/centos-openshift--xfs--vol--dir",id="/"} 0
container_fs_io_time_seconds_total{device="/dev/mapper/centos-root",id="/"} 0
container_fs_io_time_seconds_total{device="/dev/sda",id="/"} 17468.89820598
container_fs_io_time_seconds_total{device="/dev/sda",id="/system.slice"} 3053.64959099
container_fs_io_time_seconds_total{device="/dev/sda",id="/system.slice/NetworkManager.service"} 29.678010162
container_fs_io_time_seconds_total{device="/dev/sda",id="/system.slice/atd.service"} 0.010909787
container_fs_io_time_seconds_total{device="/dev/sda",id="/system.slice/auditd.service"} 1.509095758
container_fs_io_time_seconds_total{device="/dev/sda",id="/system.slice/crond.service"} 2.407612592
container_fs_io_time_seconds_total{device="/dev/sda",id="/system.slice/dbus.service"} 1.882829536
container_fs_io_time_seconds_total{device="/dev/sda",id="/system.slice/docker-1e8fa84249225e6cd7e4873b0339215d346e924309954f2d3cb3475d3cf93405.scope"} 0.025023154
container_fs_io_time_seconds_total{device="/dev/sda",id="/system.slice/docker-6f68e87c197dcc2990731b15a434b237ba784fee3b65f8708196a88f95cce032.scope"} 0.066847817
container_fs_io_time_seconds_total{device="/dev/sda",id="/system.slice/docker-bf7e5fce1172be7dd2f4ff7a97847b478920157fae61f86cf44599e431c9f558.scope"} 0.096245165
container_fs_io_time_seconds_total{device="/dev/sda",id="/system.slice/docker-containerd.service"} 57.734992013
container_fs_io_time_seconds_total{device="/dev/sda",id="/system.slice/docker.service"} 16.969229857
container_fs_io_time_seconds_total{device="/dev/sda",id="/system.slice/gssproxy.service"} 0.126133858
container_fs_io_time_seconds_total{device="/dev/sda",id="/system.slice/irqbalance.service"} 0.46796402
container_fs_io_time_seconds_total{device="/dev/sda",id="/system.slice/lvm2-lvmetad.service"} 0.043273694
container_fs_io_time_seconds_total{device="/dev/sda",id="/system.slice/polkit.service"} 0.952086428
container_fs_io_time_seconds_total{device="/dev/sda",id="/system.slice/postfix.service"} 6.320610364
container_fs_io_time_seconds_total{device="/dev/sda",id="/system.slice/rhel-push-plugin.service"} 16.685652057
container_fs_io_time_seconds_total{device="/dev/sda",id="/system.slice/rhsmcertd.service"} 4.180338969
container_fs_io_time_seconds_total{device="/dev/sda",id="/system.slice/rsyslog.service"} 2.483772873
container_fs_io_time_seconds_total{device="/dev/sda",id="/system.slice/sshd.service"} 2.341998992
container_fs_io_time_seconds_total{device="/dev/sda",id="/system.slice/systemd-journald.service"} 3.888256042
container_fs_io_time_seconds_total{device="/dev/sda",id="/system.slice/systemd-logind.service"} 0.702763816
container_fs_io_time_seconds_total{device="/dev/sda",id="/system.slice/systemd-udevd.service"} 2.053080013
container_fs_io_time_seconds_total{device="/dev/sda",id="/user.slice"} 324.000092222
container_fs_io_time_seconds_total{device="/dev/sda1",id="/"} 7.23e-07
container_fs_io_time_seconds_total{container_name="registry",device="/dev/sda",id="/system.slice/docker-da6260076d47a04536b3a8339ccb40143a6c55c731c98c7a99fb3e32ea5b1f3f.scope",image="openshift/origin-docker-registry:v3.6.0-alpha.1",name="k8s_registry.c5fb07ea_docker-registry-1-g89b9_default_f702f49d-248d-11e7-9470-080027893417_868be8c3",namespace="default",pod_name="docker-registry-1-g89b9"} 3.969092706
# HELP container_fs_io_time_weighted_seconds_total Cumulative weighted I/O time in seconds
# TYPE container_fs_io_time_weighted_seconds_total counter
container_fs_io_time_weighted_seconds_total{device="/dev/mapper/centos-openshift--xfs--vol--dir",id="/"} 0
container_fs_io_time_weighted_seconds_total{device="/dev/mapper/centos-root",id="/"} 0
container_fs_io_time_weighted_seconds_total{device="/dev/sda1",id="/"} 8.91e-07
# HELP container_fs_limit_bytes Number of bytes that can be consumed by the container on this filesystem.
# TYPE container_fs_limit_bytes gauge
container_fs_limit_bytes{device="/dev/mapper/centos-openshift--xfs--vol--dir",id="/"} 1.0701766656e+10
container_fs_limit_bytes{device="/dev/mapper/centos-root",id="/"} 4.128114688e+10
container_fs_limit_bytes{device="/dev/sda1",id="/"} 5.20794112e+08
# HELP container_fs_read_seconds_total Cumulative count of seconds spent reading
# TYPE container_fs_read_seconds_total counter
container_fs_read_seconds_total{device="/dev/mapper/centos-openshift--xfs--vol--dir",id="/"} 0
container_fs_read_seconds_total{device="/dev/mapper/centos-root",id="/"} 0
container_fs_read_seconds_total{device="/dev/sda",id="/"} 2180.011001925
container_fs_read_seconds_total{device="/dev/sda",id="/system.slice"} 1778.822306236
container_fs_read_seconds_total{device="/dev/sda",id="/system.slice/NetworkManager.service"} 29.674368294
container_fs_read_seconds_total{device="/dev/sda",id="/system.slice/atd.service"} 0.010909787
container_fs_read_seconds_total{device="/dev/sda",id="/system.slice/auditd.service"} 0.218436287
container_fs_read_seconds_total{device="/dev/sda",id="/system.slice/crond.service"} 2.407612592
container_fs_read_seconds_total{device="/dev/sda",id="/system.slice/dbus.service"} 1.882829536
container_fs_read_seconds_total{device="/dev/sda",id="/system.slice/docker-1e8fa84249225e6cd7e4873b0339215d346e924309954f2d3cb3475d3cf93405.scope"} 0.025023154
container_fs_read_seconds_total{device="/dev/sda",id="/system.slice/docker-6f68e87c197dcc2990731b15a434b237ba784fee3b65f8708196a88f95cce032.scope"} 0.066847817
container_fs_read_seconds_total{device="/dev/sda",id="/system.slice/docker-bf7e5fce1172be7dd2f4ff7a97847b478920157fae61f86cf44599e431c9f558.scope"} 0.096245165
container_fs_read_seconds_total{device="/dev/sda",id="/system.slice/docker-containerd.service"} 57.734992013
container_fs_read_seconds_total{device="/dev/sda",id="/system.slice/docker.service"} 15.272533128
container_fs_read_seconds_total{device="/dev/sda",id="/system.slice/gssproxy.service"} 0.126133858
container_fs_read_seconds_total{device="/dev/sda",id="/system.slice/irqbalance.service"} 0.46796402
container_fs_read_seconds_total{device="/dev/sda",id="/system.slice/lvm2-lvmetad.service"} 0.043273694
container_fs_read_seconds_total{device="/dev/sda",id="/system.slice/polkit.service"} 0.952086428
container_fs_read_seconds_total{device="/dev/sda",id="/system.slice/postfix.service"} 6.320610364
container_fs_read_seconds_total{device="/dev/sda",id="/system.slice/rhel-push-plugin.service"} 16.685652057
container_fs_read_seconds_total{device="/dev/sda",id="/system.slice/rhsmcertd.service"} 4.180338969
container_fs_read_seconds_total{device="/dev/sda",id="/system.slice/rsyslog.service"} 2.483772873
container_fs_read_seconds_total{device="/dev/sda",id="/system.slice/sshd.service"} 2.341998992
container_fs_read_seconds_total{device="/dev/sda",id="/system.slice/systemd-journald.service"} 3.888256042
container_fs_read_seconds_total{device="/dev/sda",id="/system.slice/systemd-logind.service"} 0.702763816
container_fs_read_seconds_total{device="/dev/sda",id="/system.slice/systemd-udevd.service"} 2.053080013
container_fs_read_seconds_total{device="/dev/sda",id="/user.slice"} 308.112142881
container_fs_read_seconds_total{device="/dev/sda1",id="/"} 7.39e-07
container_fs_read_seconds_total{container_name="registry",device="/dev/sda",id="/system.slice/docker-da6260076d47a04536b3a8339ccb40143a6c55c731c98c7a99fb3e32ea5b1f3f.scope",image="openshift/origin-docker-registry:v3.6.0-alpha.1",name="k8s_registry.c5fb07ea_docker-registry-1-g89b9_default_f702f49d-248d-11e7-9470-080027893417_868be8c3",namespace="default",pod_name="docker-registry-1-g89b9"} 3.969092706
# HELP container_fs_reads_bytes_total Cumulative count of bytes read
# TYPE container_fs_reads_bytes_total counter
container_fs_reads_bytes_total{device="/dev/sda",id="/"} 5.2674830336e+10
container_fs_reads_bytes_total{device="/dev/sda",id="/system.slice"} 4.2169052672e+10
container_fs_reads_bytes_total{device="/dev/sda",id="/system.slice/NetworkManager.service"} 1.899642368e+09
container_fs_reads_bytes_total{device="/dev/sda",id="/system.slice/atd.service"} 602112
container_fs_reads_bytes_total{device="/dev/sda",id="/system.slice/auditd.service"} 4.501504e+06
container_fs_reads_bytes_total{device="/dev/sda",id="/system.slice/crond.service"} 2.9442048e+07
container_fs_reads_bytes_total{device="/dev/sda",id="/system.slice/dbus.service"} 8.1825792e+07
container_fs_reads_bytes_total{device="/dev/sda",id="/system.slice/docker-1e8fa84249225e6cd7e4873b0339215d346e924309954f2d3cb3475d3cf93405.scope"} 2.260992e+06
container_fs_reads_bytes_total{device="/dev/sda",id="/system.slice/docker-6f68e87c197dcc2990731b15a434b237ba784fee3b65f8708196a88f95cce032.scope"} 4.554752e+06
container_fs_reads_bytes_total{device="/dev/sda",id="/system.slice/docker-bf7e5fce1172be7dd2f4ff7a97847b478920157fae61f86cf44599e431c9f558.scope"} 3.387392e+06
container_fs_reads_bytes_total{device="/dev/sda",id="/system.slice/docker-containerd.service"} 1.529950208e+09
container_fs_reads_bytes_total{device="/dev/sda",id="/system.slice/docker.service"} 1.25435904e+08
container_fs_reads_bytes_total{device="/dev/sda",id="/system.slice/gssproxy.service"} 3.063808e+06
container_fs_reads_bytes_total{device="/dev/sda",id="/system.slice/irqbalance.service"} 1.8526208e+07
container_fs_reads_bytes_total{device="/dev/sda",id="/system.slice/lvm2-lvmetad.service"} 1.486848e+06
container_fs_reads_bytes_total{device="/dev/sda",id="/system.slice/polkit.service"} 5.1204096e+07
container_fs_reads_bytes_total{device="/dev/sda",id="/system.slice/postfix.service"} 1.81219328e+08
container_fs_reads_bytes_total{device="/dev/sda",id="/system.slice/rhel-push-plugin.service"} 2.37060096e+08
container_fs_reads_bytes_total{device="/dev/sda",id="/system.slice/rhsmcertd.service"} 1.1794432e+08
container_fs_reads_bytes_total{device="/dev/sda",id="/system.slice/rsyslog.service"} 1.21530368e+08
container_fs_reads_bytes_total{device="/dev/sda",id="/system.slice/sshd.service"} 4.2262528e+07
container_fs_reads_bytes_total{device="/dev/sda",id="/system.slice/systemd-journald.service"} 1.35585792e+08
container_fs_reads_bytes_total{device="/dev/sda",id="/system.slice/systemd-logind.service"} 3.2964608e+07
container_fs_reads_bytes_total{device="/dev/sda",id="/system.slice/systemd-udevd.service"} 4.2074112e+07
container_fs_reads_bytes_total{device="/dev/sda",id="/user.slice"} 7.86886656e+09
container_fs_reads_bytes_total{container_name="registry",device="/dev/sda",id="/system.slice/docker-da6260076d47a04536b3a8339ccb40143a6c55c731c98c7a99fb3e32ea5b1f3f.scope",image="openshift/origin-docker-registry:v3.6.0-alpha.1",name="k8s_registry.c5fb07ea_docker-registry-1-g89b9_default_f702f49d-248d-11e7-9470-080027893417_868be8c3",namespace="default",pod_name="docker-registry-1-g89b9"} 5.1924992e+07
# HELP container_fs_reads_merged_total Cumulative count of reads merged
# TYPE container_fs_reads_merged_total counter
container_fs_reads_merged_total{device="/dev/mapper/centos-openshift--xfs--vol--dir",id="/"} 0
container_fs_reads_merged_total{device="/dev/mapper/centos-root",id="/"} 0
container_fs_reads_merged_total{device="/dev/sda",id="/"} 2858
container_fs_reads_merged_total{device="/dev/sda",id="/system.slice"} 2731
container_fs_reads_merged_total{device="/dev/sda",id="/system.slice/NetworkManager.service"} 165
container_fs_reads_merged_total{device="/dev/sda",id="/system.slice/atd.service"} 0
container_fs_reads_merged_total{device="/dev/sda",id="/system.slice/auditd.service"} 0
container_fs_reads_merged_total{device="/dev/sda",id="/system.slice/crond.service"} 0
container_fs_reads_merged_total{device="/dev/sda",id="/system.slice/dbus.service"} 1
container_fs_reads_merged_total{device="/dev/sda",id="/system.slice/docker-1e8fa84249225e6cd7e4873b0339215d346e924309954f2d3cb3475d3cf93405.scope"} 0
container_fs_reads_merged_total{device="/dev/sda",id="/system.slice/docker-6f68e87c197dcc2990731b15a434b237ba784fee3b65f8708196a88f95cce032.scope"} 0
container_fs_reads_merged_total{device="/dev/sda",id="/system.slice/docker-bf7e5fce1172be7dd2f4ff7a97847b478920157fae61f86cf44599e431c9f558.scope"} 0
container_fs_reads_merged_total{device="/dev/sda",id="/system.slice/docker-containerd.service"} 943
container_fs_reads_merged_total{device="/dev/sda",id="/system.slice/docker.service"} 1
container_fs_reads_merged_total{device="/dev/sda",id="/system.slice/gssproxy.service"} 0
container_fs_reads_merged_total{device="/dev/sda",id="/system.slice/irqbalance.service"} 0
container_fs_reads_merged_total{device="/dev/sda",id="/system.slice/lvm2-lvmetad.service"} 0
container_fs_reads_merged_total{device="/dev/sda",id="/system.slice/polkit.service"} 6
container_fs_reads_merged_total{device="/dev/sda",id="/system.slice/postfix.service"} 9
container_fs_reads_merged_total{device="/dev/sda",id="/system.slice/rhel-push-plugin.service"} 21
container_fs_reads_merged_total{device="/dev/sda",id="/system.slice/rhsmcertd.service"} 0
container_fs_reads_merged_total{device="/dev/sda",id="/system.slice/rsyslog.service"} 11
container_fs_reads_merged_total{device="/dev/sda",id="/system.slice/sshd.service"} 0
container_fs_reads_merged_total{device="/dev/sda",id="/system.slice/systemd-journald.service"} 1
container_fs_reads_merged_total{device="/dev/sda",id="/system.slice/systemd-logind.service"} 13
container_fs_reads_merged_total{device="/dev/sda",id="/system.slice/systemd-udevd.service"} 114
container_fs_reads_merged_total{device="/dev/sda",id="/user.slice"} 92
container_fs_reads_merged_total{device="/dev/sda1",id="/"} 0
container_fs_reads_merged_total{container_name="registry",device="/dev/sda",id="/system.slice/docker-da6260076d47a04536b3a8339ccb40143a6c55c731c98c7a99fb3e32ea5b1f3f.scope",image="openshift/origin-docker-registry:v3.6.0-alpha.1",name="k8s_registry.c5fb07ea_docker-registry-1-g89b9_default_f702f49d-248d-11e7-9470-080027893417_868be8c3",namespace="default",pod_name="docker-registry-1-g89b9"} 0
# HELP container_fs_reads_total Cumulative count of reads completed
# TYPE container_fs_reads_total counter
container_fs_reads_total{device="/dev/mapper/centos-openshift--xfs--vol--dir",id="/"} 0
container_fs_reads_total{device="/dev/mapper/centos-root",id="/"} 0
container_fs_reads_total{device="/dev/sda",id="/"} 1.29444e+06
container_fs_reads_total{device="/dev/sda",id="/system.slice"} 824585
container_fs_reads_total{device="/dev/sda",id="/system.slice/NetworkManager.service"} 16841
container_fs_reads_total{device="/dev/sda",id="/system.slice/atd.service"} 11
container_fs_reads_total{device="/dev/sda",id="/system.slice/auditd.service"} 184
container_fs_reads_total{device="/dev/sda",id="/system.slice/crond.service"} 1674
container_fs_reads_total{device="/dev/sda",id="/system.slice/dbus.service"} 2715
container_fs_reads_total{device="/dev/sda",id="/system.slice/docker-1e8fa84249225e6cd7e4873b0339215d346e924309954f2d3cb3475d3cf93405.scope"} 11
container_fs_reads_total{device="/dev/sda",id="/system.slice/docker-6f68e87c197dcc2990731b15a434b237ba784fee3b65f8708196a88f95cce032.scope"} 14
container_fs_reads_total{device="/dev/sda",id="/system.slice/docker-bf7e5fce1172be7dd2f4ff7a97847b478920157fae61f86cf44599e431c9f558.scope"} 16
container_fs_reads_total{device="/dev/sda",id="/system.slice/docker-containerd.service"} 16628
container_fs_reads_total{device="/dev/sda",id="/system.slice/docker.service"} 9999
container_fs_reads_total{device="/dev/sda",id="/system.slice/gssproxy.service"} 80
container_fs_reads_total{device="/dev/sda",id="/system.slice/irqbalance.service"} 522
container_fs_reads_total{device="/dev/sda",id="/system.slice/lvm2-lvmetad.service"} 61
container_fs_reads_total{device="/dev/sda",id="/system.slice/polkit.service"} 1079
container_fs_reads_total{device="/dev/sda",id="/system.slice/postfix.service"} 2425
container_fs_reads_total{device="/dev/sda",id="/system.slice/rhel-push-plugin.service"} 3890
container_fs_reads_total{device="/dev/sda",id="/system.slice/rhsmcertd.service"} 6283
container_fs_reads_total{device="/dev/sda",id="/system.slice/rsyslog.service"} 3239
container_fs_reads_total{device="/dev/sda",id="/system.slice/sshd.service"} 1736
container_fs_reads_total{device="/dev/sda",id="/system.slice/systemd-journald.service"} 4532
container_fs_reads_total{device="/dev/sda",id="/system.slice/systemd-logind.service"} 806
container_fs_reads_total{device="/dev/sda",id="/system.slice/systemd-udevd.service"} 1929
container_fs_reads_total{device="/dev/sda",id="/user.slice"} 298803
container_fs_reads_total{device="/dev/sda1",id="/"} 2309
container_fs_reads_total{container_name="registry",device="/dev/sda",id="/system.slice/docker-da6260076d47a04536b3a8339ccb40143a6c55c731c98c7a99fb3e32ea5b1f3f.scope",image="openshift/origin-docker-registry:v3.6.0-alpha.1",name="k8s_registry.c5fb07ea_docker-registry-1-g89b9_default_f702f49d-248d-11e7-9470-080027893417_868be8c3",namespace="default",pod_name="docker-registry-1-g89b9"} 463
# HELP container_fs_sector_reads_total Cumulative count of sector reads completed
# TYPE container_fs_sector_reads_total counter
container_fs_sector_reads_total{device="/dev/mapper/centos-openshift--xfs--vol--dir",id="/"} 0
container_fs_sector_reads_total{device="/dev/mapper/centos-root",id="/"} 0
container_fs_sector_reads_total{device="/dev/sda",id="/"} 0
container_fs_sector_reads_total{device="/dev/sda",id="/system.slice"} 0
container_fs_sector_reads_total{device="/dev/sda",id="/system.slice/NetworkManager.service"} 0
container_fs_sector_reads_total{device="/dev/sda",id="/system.slice/atd.service"} 0
container_fs_sector_reads_total{device="/dev/sda",id="/system.slice/auditd.service"} 0
container_fs_sector_reads_total{device="/dev/sda",id="/system.slice/crond.service"} 0
container_fs_sector_reads_total{device="/dev/sda",id="/system.slice/dbus.service"} 0
container_fs_sector_reads_total{device="/dev/sda",id="/system.slice/docker-1e8fa84249225e6cd7e4873b0339215d346e924309954f2d3cb3475d3cf93405.scope"} 0
container_fs_sector_reads_total{device="/dev/sda",id="/system.slice/docker-6f68e87c197dcc2990731b15a434b237ba784fee3b65f8708196a88f95cce032.scope"} 0
container_fs_sector_reads_total{device="/dev/sda",id="/system.slice/docker-bf7e5fce1172be7dd2f4ff7a97847b478920157fae61f86cf44599e431c9f558.scope"} 0
container_fs_sector_reads_total{device="/dev/sda",id="/system.slice/docker-containerd.service"} 0
container_fs_sector_reads_total{device="/dev/sda",id="/system.slice/docker.service"} 0
container_fs_sector_reads_total{device="/dev/sda",id="/system.slice/gssproxy.service"} 0
container_fs_sector_reads_total{device="/dev/sda",id="/system.slice/irqbalance.service"} 0
container_fs_sector_reads_total{device="/dev/sda",id="/system.slice/lvm2-lvmetad.service"} 0
container_fs_sector_reads_total{device="/dev/sda",id="/system.slice/polkit.service"} 0
container_fs_sector_reads_total{device="/dev/sda",id="/system.slice/postfix.service"} 0
container_fs_sector_reads_total{device="/dev/sda",id="/system.slice/rhel-push-plugin.service"} 0
container_fs_sector_reads_total{device="/dev/sda",id="/system.slice/rhsmcertd.service"} 0
container_fs_sector_reads_total{device="/dev/sda",id="/system.slice/rsyslog.service"} 0
container_fs_sector_reads_total{device="/dev/sda",id="/system.slice/sshd.service"} 0
container_fs_sector_reads_total{device="/dev/sda",id="/system.slice/systemd-journald.service"} 0
container_fs_sector_reads_total{device="/dev/sda",id="/system.slice/systemd-logind.service"} 0
container_fs_sector_reads_total{device="/dev/sda",id="/system.slice/systemd-udevd.service"} 0
container_fs_sector_reads_total{device="/dev/sda",id="/user.slice"} 0
container_fs_sector_reads_total{device="/dev/sda1",id="/"} 56802
container_fs_sector_reads_total{container_name="registry",device="/dev/sda",id="/system.slice/docker-da6260076d47a04536b3a8339ccb40143a6c55c731c98c7a99fb3e32ea5b1f3f.scope",image="openshift/origin-docker-registry:v3.6.0-alpha.1",name="k8s_registry.c5fb07ea_docker-registry-1-g89b9_default_f702f49d-248d-11e7-9470-080027893417_868be8c3",namespace="default",pod_name="docker-registry-1-g89b9"} 0
# HELP container_fs_sector_writes_total Cumulative count of sector writes completed
# TYPE container_fs_sector_writes_total counter
container_fs_sector_writes_total{device="/dev/mapper/centos-openshift--xfs--vol--dir",id="/"} 0
container_fs_sector_writes_total{device="/dev/mapper/centos-root",id="/"} 0
container_fs_sector_writes_total{device="/dev/sda",id="/"} 0
container_fs_sector_writes_total{device="/dev/sda",id="/system.slice"} 0
container_fs_sector_writes_total{device="/dev/sda",id="/system.slice/NetworkManager.service"} 0
container_fs_sector_writes_total{device="/dev/sda",id="/system.slice/atd.service"} 0
container_fs_sector_writes_total{device="/dev/sda",id="/system.slice/auditd.service"} 0
container_fs_sector_writes_total{device="/dev/sda",id="/system.slice/crond.service"} 0
container_fs_sector_writes_total{device="/dev/sda",id="/system.slice/dbus.service"} 0
container_fs_sector_writes_total{device="/dev/sda",id="/system.slice/docker-1e8fa84249225e6cd7e4873b0339215d346e924309954f2d3cb3475d3cf93405.scope"} 0
container_fs_sector_writes_total{device="/dev/sda",id="/system.slice/docker-6f68e87c197dcc2990731b15a434b237ba784fee3b65f8708196a88f95cce032.scope"} 0
container_fs_sector_writes_total{device="/dev/sda",id="/system.slice/docker-bf7e5fce1172be7dd2f4ff7a97847b478920157fae61f86cf44599e431c9f558.scope"} 0
container_fs_sector_writes_total{device="/dev/sda",id="/system.slice/docker-containerd.service"} 0
container_fs_sector_writes_total{device="/dev/sda",id="/system.slice/docker.service"} 0
container_fs_sector_writes_total{device="/dev/sda",id="/system.slice/gssproxy.service"} 0
container_fs_sector_writes_total{device="/dev/sda",id="/system.slice/irqbalance.service"} 0
container_fs_sector_writes_total{device="/dev/sda",id="/system.slice/lvm2-lvmetad.service"} 0
container_fs_sector_writes_total{device="/dev/sda",id="/system.slice/polkit.service"} 0
container_fs_sector_writes_total{device="/dev/sda",id="/system.slice/postfix.service"} 0
container_fs_sector_writes_total{device="/dev/sda",id="/system.slice/rhel-push-plugin.service"} 0
container_fs_sector_writes_total{device="/dev/sda",id="/system.slice/rhsmcertd.service"} 0
container_fs_sector_writes_total{device="/dev/sda",id="/system.slice/rsyslog.service"} 0
container_fs_sector_writes_total{device="/dev/sda",id="/system.slice/sshd.service"} 0
container_fs_sector_writes_total{device="/dev/sda",id="/system.slice/systemd-journald.service"} 0
container_fs_sector_writes_total{device="/dev/sda",id="/system.slice/systemd-logind.service"} 0
container_fs_sector_writes_total{device="/dev/sda",id="/system.slice/systemd-udevd.service"} 0
container_fs_sector_writes_total{device="/dev/sda",id="/user.slice"} 0
container_fs_sector_writes_total{device="/dev/sda1",id="/"} 4168
container_fs_sector_writes_total{container_name="registry",device="/dev/sda",id="/system.slice/docker-da6260076d47a04536b3a8339ccb40143a6c55c731c98c7a99fb3e32ea5b1f3f.scope",image="openshift/origin-docker-registry:v3.6.0-alpha.1",name="k8s_registry.c5fb07ea_docker-registry-1-g89b9_default_f702f49d-248d-11e7-9470-080027893417_868be8c3",namespace="default",pod_name="docker-registry-1-g89b9"} 0
# HELP container_fs_usage_bytes Number of bytes that are consumed by the container on this filesystem.
# TYPE container_fs_usage_bytes gauge
container_fs_usage_bytes{device="/dev/mapper/centos-openshift--xfs--vol--dir",id="/"} 3.3726464e+07
container_fs_usage_bytes{device="/dev/mapper/centos-root",id="/"} 3.3596928e+10
container_fs_usage_bytes{device="/dev/sda1",id="/"} 2.2013952e+08
# HELP container_fs_write_seconds_total Cumulative count of seconds spent writing
# TYPE container_fs_write_seconds_total counter
container_fs_write_seconds_total{device="/dev/mapper/centos-openshift--xfs--vol--dir",id="/"} 0
container_fs_write_seconds_total{device="/dev/mapper/centos-root",id="/"} 0
container_fs_write_seconds_total{device="/dev/sda",id="/"} 15288.887204055
container_fs_write_seconds_total{device="/dev/sda",id="/system.slice"} 1274.827284754
container_fs_write_seconds_total{device="/dev/sda",id="/system.slice/NetworkManager.service"} 0.003641868
container_fs_write_seconds_total{device="/dev/sda",id="/system.slice/atd.service"} 0
container_fs_write_seconds_total{device="/dev/sda",id="/system.slice/auditd.service"} 1.290659471
container_fs_write_seconds_total{device="/dev/sda",id="/system.slice/crond.service"} 0
container_fs_write_seconds_total{device="/dev/sda",id="/system.slice/dbus.service"} 0
container_fs_write_seconds_total{device="/dev/sda",id="/system.slice/docker-1e8fa84249225e6cd7e4873b0339215d346e924309954f2d3cb3475d3cf93405.scope"} 0
container_fs_write_seconds_total{device="/dev/sda",id="/system.slice/docker-6f68e87c197dcc2990731b15a434b237ba784fee3b65f8708196a88f95cce032.scope"} 0
container_fs_write_seconds_total{device="/dev/sda",id="/system.slice/docker-bf7e5fce1172be7dd2f4ff7a97847b478920157fae61f86cf44599e431c9f558.scope"} 0
container_fs_write_seconds_total{device="/dev/sda",id="/system.slice/docker-containerd.service"} 0
container_fs_write_seconds_total{device="/dev/sda",id="/system.slice/docker.service"} 1.696696729
container_fs_write_seconds_total{device="/dev/sda",id="/system.slice/gssproxy.service"} 0
container_fs_write_seconds_total{device="/dev/sda",id="/system.slice/irqbalance.service"} 0
container_fs_write_seconds_total{device="/dev/sda",id="/system.slice/lvm2-lvmetad.service"} 0
container_fs_write_seconds_total{device="/dev/sda",id="/system.slice/polkit.service"} 0
container_fs_write_seconds_total{device="/dev/sda",id="/system.slice/postfix.service"} 0
container_fs_write_seconds_total{device="/dev/sda",id="/system.slice/rhel-push-plugin.service"} 0
container_fs_write_seconds_total{device="/dev/sda",id="/system.slice/rhsmcertd.service"} 0
container_fs_write_seconds_total{device="/dev/sda",id="/system.slice/rsyslog.service"} 0
container_fs_write_seconds_total{device="/dev/sda",id="/system.slice/sshd.service"} 0
container_fs_write_seconds_total{device="/dev/sda",id="/system.slice/systemd-journald.service"} 0
container_fs_write_seconds_total{device="/dev/sda",id="/system.slice/systemd-logind.service"} 0
container_fs_write_seconds_total{device="/dev/sda",id="/system.slice/systemd-udevd.service"} 0
container_fs_write_seconds_total{device="/dev/sda",id="/user.slice"} 15.887949341
container_fs_write_seconds_total{device="/dev/sda1",id="/"} 1.71e-07
container_fs_write_seconds_total{container_name="registry",device="/dev/sda",id="/system.slice/docker-da6260076d47a04536b3a8339ccb40143a6c55c731c98c7a99fb3e32ea5b1f3f.scope",image="openshift/origin-docker-registry:v3.6.0-alpha.1",name="k8s_registry.c5fb07ea_docker-registry-1-g89b9_default_f702f49d-248d-11e7-9470-080027893417_868be8c3",namespace="default",pod_name="docker-registry-1-g89b9"} 0
# HELP container_fs_writes_bytes_total Cumulative count of bytes written
# TYPE container_fs_writes_bytes_total counter
container_fs_writes_bytes_total{device="/dev/sda",id="/"} 1.87071492096e+11
container_fs_writes_bytes_total{device="/dev/sda",id="/system.slice"} 1.6475451392e+10
container_fs_writes_bytes_total{device="/dev/sda",id="/system.slice/NetworkManager.service"} 57344
container_fs_writes_bytes_total{device="/dev/sda",id="/system.slice/atd.service"} 0
container_fs_writes_bytes_total{device="/dev/sda",id="/system.slice/auditd.service"} 3.1215616e+07
container_fs_writes_bytes_total{device="/dev/sda",id="/system.slice/crond.service"} 0
container_fs_writes_bytes_total{device="/dev/sda",id="/system.slice/dbus.service"} 0
container_fs_writes_bytes_total{device="/dev/sda",id="/system.slice/docker-1e8fa84249225e6cd7e4873b0339215d346e924309954f2d3cb3475d3cf93405.scope"} 0
container_fs_writes_bytes_total{device="/dev/sda",id="/system.slice/docker-6f68e87c197dcc2990731b15a434b237ba784fee3b65f8708196a88f95cce032.scope"} 0
container_fs_writes_bytes_total{device="/dev/sda",id="/system.slice/docker-bf7e5fce1172be7dd2f4ff7a97847b478920157fae61f86cf44599e431c9f558.scope"} 0
container_fs_writes_bytes_total{device="/dev/sda",id="/system.slice/docker-containerd.service"} 0
container_fs_writes_bytes_total{device="/dev/sda",id="/system.slice/docker.service"} 2.3957504e+07
container_fs_writes_bytes_total{device="/dev/sda",id="/system.slice/gssproxy.service"} 0
container_fs_writes_bytes_total{device="/dev/sda",id="/system.slice/irqbalance.service"} 0
container_fs_writes_bytes_total{device="/dev/sda",id="/system.slice/lvm2-lvmetad.service"} 0
container_fs_writes_bytes_total{device="/dev/sda",id="/system.slice/polkit.service"} 0
container_fs_writes_bytes_total{device="/dev/sda",id="/system.slice/postfix.service"} 0
container_fs_writes_bytes_total{device="/dev/sda",id="/system.slice/rhel-push-plugin.service"} 0
container_fs_writes_bytes_total{device="/dev/sda",id="/system.slice/rhsmcertd.service"} 0
container_fs_writes_bytes_total{device="/dev/sda",id="/system.slice/rsyslog.service"} 0
container_fs_writes_bytes_total{device="/dev/sda",id="/system.slice/sshd.service"} 0
container_fs_writes_bytes_total{device="/dev/sda",id="/system.slice/systemd-journald.service"} 0
container_fs_writes_bytes_total{device="/dev/sda",id="/system.slice/systemd-logind.service"} 0
container_fs_writes_bytes_total{device="/dev/sda",id="/system.slice/systemd-udevd.service"} 0
container_fs_writes_bytes_total{device="/dev/sda",id="/user.slice"} 2.45915648e+08
container_fs_writes_bytes_total{container_name="registry",device="/dev/sda",id="/system.slice/docker-da6260076d47a04536b3a8339ccb40143a6c55c731c98c7a99fb3e32ea5b1f3f.scope",image="openshift/origin-docker-registry:v3.6.0-alpha.1",name="k8s_registry.c5fb07ea_docker-registry-1-g89b9_default_f702f49d-248d-11e7-9470-080027893417_868be8c3",namespace="default",pod_name="docker-registry-1-g89b9"} 0
# HELP container_fs_writes_merged_total Cumulative count of writes merged
# TYPE container_fs_writes_merged_total counter
container_fs_writes_merged_total{device="/dev/mapper/centos-openshift--xfs--vol--dir",id="/"} 0
container_fs_writes_merged_total{device="/dev/mapper/centos-root",id="/"} 0
container_fs_writes_merged_total{device="/dev/sda",id="/"} 455792
container_fs_writes_merged_total{device="/dev/sda",id="/system.slice"} 0
container_fs_writes_merged_total{device="/dev/sda",id="/system.slice/NetworkManager.service"} 0
container_fs_writes_merged_total{device="/dev/sda",id="/system.slice/atd.service"} 0
container_fs_writes_merged_total{device="/dev/sda",id="/system.slice/auditd.service"} 0
container_fs_writes_merged_total{device="/dev/sda",id="/system.slice/crond.service"} 0
container_fs_writes_merged_total{device="/dev/sda",id="/system.slice/dbus.service"} 0
container_fs_writes_merged_total{device="/dev/sda",id="/system.slice/docker-1e8fa84249225e6cd7e4873b0339215d346e924309954f2d3cb3475d3cf93405.scope"} 0
container_fs_writes_merged_total{device="/dev/sda",id="/system.slice/docker-6f68e87c197dcc2990731b15a434b237ba784fee3b65f8708196a88f95cce032.scope"} 0
container_fs_writes_merged_total{device="/dev/sda",id="/system.slice/docker-bf7e5fce1172be7dd2f4ff7a97847b478920157fae61f86cf44599e431c9f558.scope"} 0
container_fs_writes_merged_total{device="/dev/sda",id="/system.slice/docker-containerd.service"} 0
container_fs_writes_merged_total{device="/dev/sda",id="/system.slice/docker.service"} 0
container_fs_writes_merged_total{device="/dev/sda",id="/system.slice/gssproxy.service"} 0
container_fs_writes_merged_total{device="/dev/sda",id="/system.slice/irqbalance.service"} 0
container_fs_writes_merged_total{device="/dev/sda",id="/system.slice/lvm2-lvmetad.service"} 0
container_fs_writes_merged_total{device="/dev/sda",id="/system.slice/polkit.service"} 0
container_fs_writes_merged_total{device="/dev/sda",id="/system.slice/postfix.service"} 0
container_fs_writes_merged_total{device="/dev/sda",id="/system.slice/rhel-push-plugin.service"} 0
container_fs_writes_merged_total{device="/dev/sda",id="/system.slice/rhsmcertd.service"} 0
container_fs_writes_merged_total{device="/dev/sda",id="/system.slice/rsyslog.service"} 0
container_fs_writes_merged_total{device="/dev/sda",id="/system.slice/sshd.service"} 0
container_fs_writes_merged_total{device="/dev/sda",id="/system.slice/systemd-journald.service"} 0
container_fs_writes_merged_total{device="/dev/sda",id="/system.slice/systemd-logind.service"} 0
container_fs_writes_merged_total{device="/dev/sda",id="/system.slice/systemd-udevd.service"} 0
container_fs_writes_merged_total{device="/dev/sda",id="/user.slice"} 0
container_fs_writes_merged_total{device="/dev/sda1",id="/"} 0
container_fs_writes_merged_total{container_name="registry",device="/dev/sda",id="/system.slice/docker-da6260076d47a04536b3a8339ccb40143a6c55c731c98c7a99fb3e32ea5b1f3f.scope",image="openshift/origin-docker-registry:v3.6.0-alpha.1",name="k8s_registry.c5fb07ea_docker-registry-1-g89b9_default_f702f49d-248d-11e7-9470-080027893417_868be8c3",namespace="default",pod_name="docker-registry-1-g89b9"} 0
# HELP container_fs_writes_total Cumulative count of writes completed
# TYPE container_fs_writes_total counter
container_fs_writes_total{device="/dev/mapper/centos-openshift--xfs--vol--dir",id="/"} 0
container_fs_writes_total{device="/dev/mapper/centos-root",id="/"} 0
container_fs_writes_total{device="/dev/sda",id="/"} 5.263333e+06
container_fs_writes_total{device="/dev/sda",id="/system.slice"} 1.635728e+06
container_fs_writes_total{device="/dev/sda",id="/system.slice/NetworkManager.service"} 14
container_fs_writes_total{device="/dev/sda",id="/system.slice/atd.service"} 0
container_fs_writes_total{device="/dev/sda",id="/system.slice/auditd.service"} 4604
container_fs_writes_total{device="/dev/sda",id="/system.slice/crond.service"} 0
container_fs_writes_total{device="/dev/sda",id="/system.slice/dbus.service"} 0
container_fs_writes_total{device="/dev/sda",id="/system.slice/docker-1e8fa84249225e6cd7e4873b0339215d346e924309954f2d3cb3475d3cf93405.scope"} 0
container_fs_writes_total{device="/dev/sda",id="/system.slice/docker-6f68e87c197dcc2990731b15a434b237ba784fee3b65f8708196a88f95cce032.scope"} 0
container_fs_writes_total{device="/dev/sda",id="/system.slice/docker-bf7e5fce1172be7dd2f4ff7a97847b478920157fae61f86cf44599e431c9f558.scope"} 0
container_fs_writes_total{device="/dev/sda",id="/system.slice/docker-containerd.service"} 0
container_fs_writes_total{device="/dev/sda",id="/system.slice/docker.service"} 4594
container_fs_writes_total{device="/dev/sda",id="/system.slice/gssproxy.service"} 0
container_fs_writes_total{device="/dev/sda",id="/system.slice/irqbalance.service"} 0
container_fs_writes_total{device="/dev/sda",id="/system.slice/lvm2-lvmetad.service"} 0
container_fs_writes_total{device="/dev/sda",id="/system.slice/polkit.service"} 0
container_fs_writes_total{device="/dev/sda",id="/system.slice/postfix.service"} 0
container_fs_writes_total{device="/dev/sda",id="/system.slice/rhel-push-plugin.service"} 0
container_fs_writes_total{device="/dev/sda",id="/system.slice/rhsmcertd.service"} 0
container_fs_writes_total{device="/dev/sda",id="/system.slice/rsyslog.service"} 0
container_fs_writes_total{device="/dev/sda",id="/system.slice/sshd.service"} 0
container_fs_writes_total{device="/dev/sda",id="/system.slice/systemd-journald.service"} 0
container_fs_writes_total{device="/dev/sda",id="/system.slice/systemd-logind.service"} 0
container_fs_writes_total{device="/dev/sda",id="/system.slice/systemd-udevd.service"} 0
container_fs_writes_total{device="/dev/sda",id="/user.slice"} 21654
container_fs_writes_total{device="/dev/sda1",id="/"} 2067
container_fs_writes_total{container_name="registry",device="/dev/sda",id="/system.slice/docker-da6260076d47a04536b3a8339ccb40143a6c55c731c98c7a99fb3e32ea5b1f3f.scope",image="openshift/origin-docker-registry:v3.6.0-alpha.1",name="k8s_registry.c5fb07ea_docker-registry-1-g89b9_default_f702f49d-248d-11e7-9470-080027893417_868be8c3",namespace="default",pod_name="docker-registry-1-g89b9"} 0

@smarterclayton
Copy link
Contributor Author

@DirectXMan12

Copy link
Contributor

@DirectXMan12 DirectXMan12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems pretty reasonable from my perspective

PerDiskStats reported from cgroups were not being surfaced into
prometheus. In order to properly correlate the metrics, we need to
assign a device label to each metric (which is the FS or device path).
Since blkio cgroup tracks devices, we create a synthetic device
`/dev/NAME` for the metric.

Assign a Device label to each PerDiskStat for the handlers up front, and
then surface the PerDiskStat values into the prometheus metrics. Report
two new metrics - total bytes read and total bytes written.
@smarterclayton
Copy link
Contributor Author

@dashpole as discussed last week - we don't have a prometheus e2e test, and I wasn't sure what expectations are around new tests on something like this.

@dashpole
Copy link
Collaborator

dashpole commented Apr 25, 2017

The code changes look good, but I am still trying to wrap my head around: Since blkio cgroup tracks devices, we create a synthetic device /dev/NAME for the metric.
NAME in this case is the name of the disk, right? In your output, this device is dev/sda? Would it be better to name it "disk/sda" so users dont expect an actual device? Does "dev/sda actually exist, or are we making up a device?
As you point out, we dont have any prometheus tests for this. Your manual test above should be good enough.

@smarterclayton
Copy link
Contributor Author

All the filesystem data is in form /dev/sda1. What we get from the machine info is "sda". To make the two roughly consistent, I turn "sda" into "/dev/sda"

@smarterclayton
Copy link
Contributor Author

And at least on the few systems I looked at (RHEL / Mac / ubuntu) there is always a /dev/NAME for what mount returns

@dashpole
Copy link
Collaborator

Ok, so the name comes from reading the /sys/block/ directory. Would it make more sense to name these /sys/block/NAME in the interest of accurately representing what the metrics are based off of? I am also alright with leaving it as dev/NAME, since the filesystem devices seem to be named similarly. E.g. block device is named sda, filesystem device is dev/sda1. That might make it easier for users to correlate the two. WDYT?

@smarterclayton
Copy link
Contributor Author

Interestingly enough - we depend on /dev/sda existing because we do this:

https://github.com/google/cadvisor/blob/master/utils/sysfs/sysfs.go#L82

So a client that wanted to lookup the device by name can rely on this path (to then get major/minor).

@dashpole
Copy link
Collaborator

yes, so that is /sys/block/sda/dev

@brancz
Copy link
Contributor

brancz commented Apr 28, 2017

My review is mostly based on the resulting metric output, and that lgtm. I only had a chance to glance over the implementation, but generally looks good as well. (coming from sig-instrumentation)

Copy link
Collaborator

@dashpole dashpole left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, Thanks.

@dashpole dashpole merged commit e14ee9b into google:master Apr 28, 2017
@bobrik
Copy link
Contributor

bobrik commented May 18, 2017

Any chance to get a release with this PR included soon?

@dashpole
Copy link
Collaborator

yep, ill cut a cAdvisor release next week sometime before the kubernetes 1.7

@bobrik
Copy link
Contributor

bobrik commented May 18, 2017

Hmm, I applied this patch on 0.25.0 and with -disable_metrics=network,tcp,disk I have disk metrics:

$ curl -s http://36com10.in.cfops.it:3059/metrics | grep ^container_fs | fgrep one
container_fs_reads_bytes_total{device="/dev/md127",id="/docker/729323ff33006e04043142a4c79bd0028ec5e35f01e38d362a4fe62014620e5d",image="debian:jessie",name="one"} 0
container_fs_reads_total{device="/dev/md127",id="/docker/729323ff33006e04043142a4c79bd0028ec5e35f01e38d362a4fe62014620e5d",image="debian:jessie",name="one"} 0
container_fs_writes_bytes_total{device="/dev/md127",id="/docker/729323ff33006e04043142a4c79bd0028ec5e35f01e38d362a4fe62014620e5d",image="debian:jessie",name="one"} 2.91930112e+09
container_fs_writes_total{device="/dev/md127",id="/docker/729323ff33006e04043142a4c79bd0028ec5e35f01e38d362a4fe62014620e5d",image="debian:jessie",name="one"} 5122

The actual difference in reported metrics between defaults and my case:

$ diff -rup before.txt after.txt
--- before.txt	2017-05-18 22:15:13.897839830 +0000
+++ after.txt	2017-05-18 22:17:25.008781070 +0000
@@ -30,14 +30,6 @@ container_memory_rss
 container_memory_swap
 container_memory_usage_bytes
 container_memory_working_set_bytes
-container_network_receive_bytes_total
-container_network_receive_errors_total
-container_network_receive_packets_dropped_total
-container_network_receive_packets_total
-container_network_transmit_bytes_total
-container_network_transmit_errors_total
-container_network_transmit_packets_dropped_total
-container_network_transmit_packets_total
 container_scrape_error
 container_spec_cpu_period
 container_spec_cpu_quota
@@ -79,7 +71,6 @@ http_request_duration_microseconds_sum
 http_request_size_bytes
 http_request_size_bytes_count
 http_request_size_bytes_sum
-http_requests_total
 http_response_size_bytes
 http_response_size_bytes_count
 http_response_size_bytes_sum

Looks like no disk metrics were dropped. Is this expected?

@dashpole
Copy link
Collaborator

these are diskIO stats

@bobrik
Copy link
Contributor

bobrik commented May 18, 2017

@dashpole, thanks, makes sense now.

@discordianfish
Copy link
Contributor

If I'm not mistake, this should be in 0.26.1, correct? But I still don't have the metrics:

$ curl -s http://10.116.2.7:8080/metrics|egrep '^cadvisor_version_info|^container_fs_io'|sed 's/container_fs_io.*} //'
cadvisor_version_info{cadvisorRevision="d19cc94",cadvisorVersion="v0.26.1",dockerVersion="1.11.2",kernelVersion="4.4.52+",osVersion="Alpine Linux v3.4"} 1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

@ZhiqinYang
Copy link

Hi, I try this in ubuntu and centos, the container_fs_writes_total show that ubuntu is corrected and centos are not? why ?

@discordianfish
Copy link
Contributor

@ZhiqinYang Maybe differences in how the cgroups are mounted?

@ZhiqinYang
Copy link

Thank you for your reply, I do it with this command on centos7:
sudo docker run -d
--userns=hos
--volume=/:/rootfs:ro
--volume=/var/run:/var/run:rw
--volume=/sys:/sys:ro
--volume=/var/lib/docker/:/var/lib/docker:ro
--privileged=true
--publish=1004:8080
--volume=/cgroup:/cgroup:ro
--name=cadvisor
google/cadvisor
I found the result not correct. I don't know how to do it? Any help please, thank!
docker info:
Containers: 55
Running: 50
Paused: 0
Stopped: 5
Images: 31
Server Version: 1.13.1
Storage Driver: overlay
Backing Filesystem: xfs
Supports d_type: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: aa8187dbd3b7ad67d8e5e3a15115d3eef43a7ed1
runc version: 9df8b306d01f59d3a8029be411de015b7304dd8f
init version: 949e6fa
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.0-514.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 3.702 GiB
Name: node2
ID: 4N6Y:IWI4:TNPD:BBBT:YWYN:MHFD:PJTG:IWSW:XPYY:6CPH:MNOA:76NI
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled
Experimental: false
Insecure Registries:
10.233.0.0/18
127.0.0.0/8
Live Restore Enabled: false

@ZhiqinYang
Copy link

Thank you for help, I take a mistake, The cgroup is set to error!

@copolycube
Copy link

Hello @ZhiqinYang , I'm not sure to understand how you managed to solve this issue with the cgroup ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

no fs stats per container
8 participants