Skip to content

Commit 8b048f6

Browse files
Nidhi AgarwalFrancisco de Freitas
authored andcommitted
handle disordered network interfaces (#48)
1 parent 44cac7d commit 8b048f6

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

main.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,11 @@ func (t *AugmentedTask) ExporterInformation() []*PrometheusTaskInfo {
169169
if len(t.EC2Instance.NetworkInterfaces) == 0 {
170170
return ret
171171
}
172+
172173
for _, iface := range t.EC2Instance.NetworkInterfaces {
173-
if iface.PrivateIpAddress != nil && *iface.PrivateIpAddress != "" {
174+
if iface.PrivateIpAddress != nil && *iface.PrivateIpAddress != "" &&
175+
iface.PrivateDnsName != nil && *iface.PrivateDnsName != "" &&
176+
*iface.PrivateDnsName == *t.EC2Instance.PrivateDnsName {
174177
ip = *iface.PrivateIpAddress
175178
break
176179
}

0 commit comments

Comments
 (0)