Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions pkg/monitor/sqsevent/sqs-monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,28 @@ func (m SQSMonitor) getNodeInfo(instanceID string) (*NodeInfo, error) {
},
})
if err != nil {
// handle all kinds of InvalidInstanceID error events
// - https://docs.aws.amazon.com/AWSEC2/latest/APIReference/errors-overview.html
if aerr, ok := err.(awserr.Error); ok && aerr.Code() == "InvalidInstanceID" {
msg := fmt.Sprintf("Invalid instance id %s provided", instanceID)
log.Warn().Msg(msg)
return nil, skip{fmt.Errorf(msg)}
}
if aerr, ok := err.(awserr.Error); ok && aerr.Code() == "InvalidInstanceID.NotFound" {
msg := fmt.Sprintf("No instance found with instance-id %s", instanceID)
log.Warn().Msg(msg)
return nil, skip{fmt.Errorf(msg)}
}
if aerr, ok := err.(awserr.Error); ok && aerr.Code() == "InvalidInstanceID.Malformed" {
msg := fmt.Sprintf("Malformed instance-id %s", instanceID)
log.Warn().Msg(msg)
return nil, skip{fmt.Errorf(msg)}
}
if aerr, ok := err.(awserr.Error); ok && aerr.Code() == "InvalidInstanceID.NotLinkable" {
msg := fmt.Sprintf("Instance-id %s not linkable", instanceID)
log.Warn().Msg(msg)
return nil, skip{fmt.Errorf(msg)}
}
return nil, err
}
if len(result.Reservations) == 0 || len(result.Reservations[0].Instances) == 0 {
Expand Down