Skip to content

cadvisor assigns labels to prometheus metrics with empty values #1951

Open
@jaloren

Description

@jaloren

when cadvisor, exports metrics for docker containers, there is a root cgroup (/) and cgroup for a docker container (/docker/uuid). If docker container has a label on it, then this label is applied to all containers including the root container. Because some containers don't have that label, the label will have an empty value.

For example, lets say I have a python flask app in a docker container and I have labelled it in docker with the label python_version and the value 3.6. The root container will also get this metric label except it will be python_version=""

It looks like the cause of this is the code here. It loops through all the containers, getting labels for each container and then combines all of those labels into a single slice.

https://github.com/google/cadvisor/blob/master/metrics/prometheus.go#L853

I can't think of any valid usecase in which a user would want labels with no values, so I am wondering if its a bug that a label with an empty value is being applied to the metric.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions