mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-26 06:04:05 -08:00
[FIX] EC2 DS: Check for existence of OwnerID (#4672)
Commit 1c89984
introduced the ability to expose the owner of the instance.
However, this breaks Prometheus if there is no OwnerID in the reservation (Eg. if you are using a private EC2-API introduced by #4333)
Signed-off-by: Jannick Fahlbusch <git@jf-projects.de>
This commit is contained in:
parent
3c00eeaf16
commit
f78e59577b
|
@ -241,9 +241,13 @@ func (d *Discovery) refresh() (tg *targetgroup.Group, err error) {
|
|||
continue
|
||||
}
|
||||
labels := model.LabelSet{
|
||||
ec2LabelOwnerID: model.LabelValue(*r.OwnerId),
|
||||
ec2LabelInstanceID: model.LabelValue(*inst.InstanceId),
|
||||
}
|
||||
|
||||
if r.OwnerId != nil {
|
||||
labels[ec2LabelOwnerID] = model.LabelValue(*r.OwnerId)
|
||||
}
|
||||
|
||||
labels[ec2LabelPrivateIP] = model.LabelValue(*inst.PrivateIpAddress)
|
||||
addr := net.JoinHostPort(*inst.PrivateIpAddress, fmt.Sprintf("%d", d.port))
|
||||
labels[model.AddressLabel] = model.LabelValue(addr)
|
||||
|
|
Loading…
Reference in a new issue