-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Open
Description
Hi folks:
Although we can already obtain the container id by using the full container name, why isn't it exposed?
cadvisor/container/docker/factory.go
Lines 173 to 181 in 3888dda
func ContainerNameToDockerId(name string) string { | |
id := path.Base(name) | |
if matches := dockerCgroupRegexp.FindStringSubmatch(id); matches != nil { | |
return matches[1] | |
} | |
return id | |
} |
Why don't we use container ID directly, and instead use the container name as the label ID value in DefaultContainerLabels?
cadvisor/metrics/prometheus.go
Lines 1769 to 1784 in d91f2e6
func DefaultContainerLabels(container *info.ContainerInfo) map[string]string { | |
set := map[string]string{LabelID: container.Name} | |
if len(container.Aliases) > 0 { | |
set[LabelName] = container.Aliases[0] | |
} | |
if image := container.Spec.Image; len(image) > 0 { | |
set[LabelImage] = image | |
} | |
for k, v := range container.Spec.Labels { | |
set[ContainerLabelPrefix+k] = v | |
} | |
for k, v := range container.Spec.Envs { | |
set[ContainerEnvPrefix+k] = v | |
} | |
return set | |
} |
The problem with this is that we cannot map back to Kubernetes information using the container ID
Metadata
Metadata
Assignees
Labels
No labels