Skip to content

Commit babe973

Browse files
committed
fix: resolve 'Received spot notification for undefined' log message
When metrics are disabled, metricName is undefined and gets interpolated into the log string as literal "undefined". Use conditional interpolation so the message reads "Received spot notification" when no metric is set.
1 parent 60fed70 commit babe973

File tree

2 files changed

+1
-1
lines changed

2 files changed

+1
-1
lines changed

lambdas/functions/termination-watcher/src/metric-event.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export async function metricEvent(
1313
const instanceRunningTimeInSeconds = instance.LaunchTime
1414
? (new Date(event.time).getTime() - new Date(instance.LaunchTime).getTime()) / 1000
1515
: undefined;
16-
logger.info(`Received spot notification for ${metricName}`, {
16+
logger.info(`Received spot notification${metricName ? ` for ${metricName}` : ''}`, {
1717
instanceId: instance.InstanceId,
1818
instanceType: instance.InstanceType ?? 'unknown',
1919
instanceName: instance.Tags?.find((tag) => tag.Key === 'Name')?.Value,
-15 KB
Binary file not shown.

0 commit comments

Comments
 (0)