Skip to content

Commit

Permalink
fix: add space trimming for label allowlist
Browse files Browse the repository at this point in the history
Some developers prefer to write lists by adding spaces after commas,
so add handling of spaces to increase code robustness
  • Loading branch information
oif committed Jun 11, 2023
1 parent 31361f2 commit 19e5c95
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/cadvisor.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ func main() {
containerLabelFunc := metrics.DefaultContainerLabels
if !*storeContainerLabels {
whitelistedLabels := strings.Split(*whitelistedContainerLabels, ",")
// Trim spacing in labels
for i := range whitelistedLabels {
whitelistedLabels[i] = strings.TrimSpace(whitelistedLabels[i])
}
containerLabelFunc = metrics.BaseContainerLabels(whitelistedLabels)
}

Expand Down

0 comments on commit 19e5c95

Please sign in to comment.