Skip to content

Commit 380d9ee

Browse files
committed
Fix misleading logging for launch lifecycle events logged as drain operations
1 parent 9b7e73e commit 380d9ee

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

cmd/node-termination-handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ func main() {
288288
for event, ok := interruptionEventStore.GetActiveEvent(); ok; event, ok = interruptionEventStore.GetActiveEvent() {
289289
select {
290290
case interruptionEventStore.Workers <- 1:
291-
logging.VersionedMsgs.RequestingInstanceDrain(event)
291+
logging.VersionedMsgs.ProcessingInterruptionEvent(event)
292292
event.InProgress = true
293293
wg.Add(1)
294294
recorder.Emit(event.NodeName, observability.Normal, observability.GetReasonForKind(event.Kind, event.Monitor), event.Description)

pkg/logging/versioned.go

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,22 @@ func (versionedMsgsV1) ProblemMonitoringForEvents(monitorKind string, err error)
3030
log.Warn().Str("event_type", monitorKind).Err(err).Msg("There was a problem monitoring for events")
3131
}
3232

33-
func (versionedMsgsV1) RequestingInstanceDrain(event *monitor.InterruptionEvent) {
33+
func (versionedMsgsV1) ProcessingInterruptionEvent(event *monitor.InterruptionEvent) {
34+
var message string
35+
switch event.Kind {
36+
case monitor.ASGLaunchLifecycleKind:
37+
message = "Processing launch lifecycle event"
38+
default:
39+
message = "Requesting instance drain"
40+
}
41+
3442
log.Info().
3543
Str("event-id", event.EventID).
3644
Str("kind", event.Kind).
3745
Str("node-name", event.NodeName).
3846
Str("instance-id", event.InstanceID).
3947
Str("provider-id", event.ProviderID).
40-
Msg("Requesting instance drain")
48+
Msg(message)
4149
}
4250

4351
func (versionedMsgsV1) SendingInterruptionEventToChannel(_ string) {
@@ -54,15 +62,23 @@ func (versionedMsgsV2) ProblemMonitoringForEvents(monitorKind string, err error)
5462
log.Warn().Str("monitor_type", monitorKind).Err(err).Msg("There was a problem monitoring for events")
5563
}
5664

57-
func (versionedMsgsV2) RequestingInstanceDrain(event *monitor.InterruptionEvent) {
65+
func (versionedMsgsV2) ProcessingInterruptionEvent(event *monitor.InterruptionEvent) {
66+
var message string
67+
switch event.Kind {
68+
case monitor.ASGLaunchLifecycleKind:
69+
message = "Processing launch lifecycle event"
70+
default:
71+
message = "Requesting instance drain"
72+
}
73+
5874
log.Info().
5975
Str("event-id", event.EventID).
6076
Str("kind", event.Kind).
6177
Str("monitor", event.Monitor).
6278
Str("node-name", event.NodeName).
6379
Str("instance-id", event.InstanceID).
6480
Str("provider-id", event.ProviderID).
65-
Msg("Requesting instance drain")
81+
Msg(message)
6682
}
6783

6884
func (versionedMsgsV2) SendingInterruptionEventToChannel(eventKind string) {
@@ -72,7 +88,7 @@ func (versionedMsgsV2) SendingInterruptionEventToChannel(eventKind string) {
7288
var VersionedMsgs interface {
7389
MonitoringStarted(monitorKind string)
7490
ProblemMonitoringForEvents(monitorKind string, err error)
75-
RequestingInstanceDrain(event *monitor.InterruptionEvent)
91+
ProcessingInterruptionEvent(event *monitor.InterruptionEvent)
7692
SendingInterruptionEventToChannel(eventKind string)
7793
} = versionedMsgsV1{}
7894

0 commit comments

Comments
 (0)