From a189102d0b841a01a79c13baee1654e640e88e1f Mon Sep 17 00:00:00 2001 From: Kevin Pullin Date: Tue, 3 Nov 2020 15:09:39 -0800 Subject: [PATCH 1/2] Add debug log messages to `isInstanceManaged` This change adds debug log messages to give hints when an Auto Scaling Group is not tagged as managed. Without this change there's no other indication that the instance & ASG is unmanaged and makes diagnosing this condition quite difficult without reading through the source code. --- pkg/monitor/sqsevent/sqs-monitor.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/monitor/sqsevent/sqs-monitor.go b/pkg/monitor/sqsevent/sqs-monitor.go index 66a50a68..4a2af701 100644 --- a/pkg/monitor/sqsevent/sqs-monitor.go +++ b/pkg/monitor/sqsevent/sqs-monitor.go @@ -194,6 +194,7 @@ func (m SQSMonitor) isInstanceManaged(instanceID string) (bool, error) { return false, err } if len(asgs.AutoScalingInstances) == 0 { + log.Debug().Str("instance_id", instanceID).Msg("Did not find an Auto Scaling Instance for the given instance id") return false, nil } asgName := asgs.AutoScalingInstances[0].AutoScalingGroupName @@ -214,5 +215,10 @@ func (m SQSMonitor) isInstanceManaged(instanceID string) (bool, error) { return true }) + if !isManaged { + log.Debug(). + Str("instance_id", instanceID). + Msgf("The instance's Auto Scaling Group is not tagged as managed with tag key: %s", NTHManagedASG) + } return isManaged, err } From a8e14a42383bdb0956a31bf971564a1e524b1f66 Mon Sep 17 00:00:00 2001 From: Kevin Pullin Date: Tue, 3 Nov 2020 15:25:24 -0800 Subject: [PATCH 2/2] isInstanceManaged log message update Change `Auto Scaling Instance` to `Auto Scaling Group`. --- pkg/monitor/sqsevent/sqs-monitor.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/monitor/sqsevent/sqs-monitor.go b/pkg/monitor/sqsevent/sqs-monitor.go index 4a2af701..83a3cf33 100644 --- a/pkg/monitor/sqsevent/sqs-monitor.go +++ b/pkg/monitor/sqsevent/sqs-monitor.go @@ -194,7 +194,7 @@ func (m SQSMonitor) isInstanceManaged(instanceID string) (bool, error) { return false, err } if len(asgs.AutoScalingInstances) == 0 { - log.Debug().Str("instance_id", instanceID).Msg("Did not find an Auto Scaling Instance for the given instance id") + log.Debug().Str("instance_id", instanceID).Msg("Did not find an Auto Scaling Group for the given instance id") return false, nil } asgName := asgs.AutoScalingInstances[0].AutoScalingGroupName