If in getCgroupPath in cgroups we have some other hierarchies after
"devices" using ".*" sometimes will cause matching wrong string as
a container path so we need negated character class here: "[^:]*".
e.g.
If cgroups string is
"153:name=systemd:/system.slice/docker-f55e7cad1fcc02f992e0c33c210ecdc6d641858a665f28370523c27c05bdde0e.scope,4:freezer,devices,name=container:/system.slice/docker-f55e7cad1fcc02f992e0c33c210ecdc6d641858a665f28370523c27c05bdde0e.scope,3:cpuacct,cpu,cpuset,name=fairsched:/system.slice/docker-f55e7cad1fcc02f992e0c33c210ecdc6d641858a665f28370523c27c05bdde0e.scope,2:memory:/system.slice/docker-f55e7cad1fcc02f992e0c33c210ecdc6d641858a665f28370523c27c05bdde0e.scope,1:blkio,name=beancounter:/system.slice/docker-f55e7cad1fcc02f992e0c33c210ecdc6d641858a665f28370523c27c05bdde0e.scope"
match[1] will be "blkio" but not:
/system.slice/docker-f55e7cad1fcc02f992e0c33c210ecdc6d641858a665f28370523c27c05bdde0e.scope
These fixes the commit:
4cbd91c761 Make getCgroupPath work in case of named or multi- hierarchies
v2: use negated character class, correct the example, remove .* on
either end as they don't do anything in FindSubmatch.
The documentation for custom metrics contained an error in the
Prometheus metrics example JSON, and was also somewhat unclear
as to how the labels worked.
Previously, the Prometheus collector ignored the
`MetricsConfig` field of the custom metrics specification,
simply storing all exposed metrics. Now, if the `MetricsConfig`
field contains any metric names, only those metrics will be stored
and exposed.
Fixes#1005
cf0adcc817 introduced two switch
statements to facilitate the addition of the `overlayStorageDriver`;
unfortunately neither of them conform to the Go switch semantic, which
does not fallthrough unless explicitly requested. In one case this was
innocuous (because a `break` was effectively the same as a no-op) but in
the other it would cause the `HasFilesystem` bool to not be set
appropriately in the case of `aufsStorageDriver` being used.
IMHO it's also more idiomatic to perform the default behaviour in the
default case rather than pre-setting and overriding it.