Skip to content

Commit 2b6fbac

Browse files
committed
feat: add container whitelisted envs as metrics labels.
Signed-off-by: colstuwjx <[email protected]>
1 parent 2dd0cd9 commit 2b6fbac

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

metrics/prometheus.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1836,7 +1836,7 @@ func DefaultContainerLabels(container *info.ContainerInfo) map[string]string {
18361836
}
18371837

18381838
// BaseContainerLabels returns a ContainerLabelsFunc that exports the container
1839-
// name, first alias, image name as well as white listed label values.
1839+
// name, first alias, image name as well as all its white listed env and label values.
18401840
func BaseContainerLabels(whiteList []string) func(container *info.ContainerInfo) map[string]string {
18411841
whiteListMap := make(map[string]struct{}, len(whiteList))
18421842
for _, k := range whiteList {
@@ -1856,6 +1856,9 @@ func BaseContainerLabels(whiteList []string) func(container *info.ContainerInfo)
18561856
set[ContainerLabelPrefix+k] = v
18571857
}
18581858
}
1859+
for k, v := range container.Spec.Envs {
1860+
set[ContainerEnvPrefix+k] = v
1861+
}
18591862
return set
18601863
}
18611864
}

0 commit comments

Comments
 (0)