Merge pull request #3405 from dominikschulz/fix/issue-3001

Guard against tags being nil in EC2 discovery
This commit is contained in:
Björn Rabenstein 2017-11-03 17:20:40 +01:00 committed by GitHub
commit bf8e002fce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -200,6 +200,9 @@ func (d *Discovery) refresh() (tg *config.TargetGroup, err error) {
} }
for _, t := range inst.Tags { for _, t := range inst.Tags {
if t == nil || t.Key == nil || t.Value == nil {
continue
}
name := strutil.SanitizeLabelName(*t.Key) name := strutil.SanitizeLabelName(*t.Key)
labels[ec2LabelTag+model.LabelName(name)] = model.LabelValue(*t.Value) labels[ec2LabelTag+model.LabelName(name)] = model.LabelValue(*t.Value)
} }