Skip to content

Commit

Permalink
Limit container env table size to 20
Browse files Browse the repository at this point in the history
  • Loading branch information
Alfonso Acosta committed May 10, 2016
1 parent 291c9af commit db91a52
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions probe/docker/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,12 +373,18 @@ func (c *container) metrics() report.Metrics {

func (c *container) env() map[string]string {
result := map[string]string{}
// Truncate to a maximum of 20
count := 0
for _, value := range c.container.Config.Env {
if count > 20 {
break
}
v := strings.SplitN(value, "=", 2)
if len(v) != 2 {
continue
}
result[v[0]] = v[1]
count += 1
}
return result
}
Expand Down

0 comments on commit db91a52

Please sign in to comment.