Skip to content

Commit a8e2618

Browse files
committed
clean up
1 parent a0cb1b7 commit a8e2618

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed

examples/default/main.tf

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ module "runners" {
9898
runner_name_prefix = "${local.environment}_"
9999

100100
# Enable debug logging for the lambda functions
101-
log_level = "debug"
101+
log_level = "info"
102102

103103
enable_ami_housekeeper = true
104104
ami_housekeeper_cleanup_config = {
@@ -117,14 +117,14 @@ module "runners" {
117117
}
118118

119119
# enable metric creation (experimental)
120-
metrics = {
121-
enable = true
122-
metric = {
123-
enable_spot_termination_warning = true
124-
enable_job_retry = false
125-
enable_github_app_rate_limit = false
126-
}
127-
}
120+
# metrics = {
121+
# enable = true
122+
# metric = {
123+
# enable_spot_termination_warning = true
124+
# enable_job_retry = false
125+
# enable_github_app_rate_limit = false
126+
# }
127+
# }
128128

129129
# enable job_retry feature. Be careful with this feature, it can lead to you hitting API rate limits.
130130
# job_retry = {

lambdas/functions/termination-watcher/src/termination-warning.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ async function createMetricForInstances(
2424
for (const instance of instances) {
2525
const matchFilter = tagFilter(instance, config.tagFilters);
2626

27-
if (matchFilter && instance) {
27+
if (matchFilter) {
2828
metricEvent(instance, event, config.createSpotWarningMetric ? 'SpotInterruptionWarning' : undefined, logger);
2929
} else {
3030
logger.debug(

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { BidEvictedDetail, BidEvictedEvent } from './types';
33
import { EC2Client } from '@aws-sdk/client-ec2';
44
import { Config } from './ConfigResolver';
55
import { metricEvent } from './metric-event';
6-
import { getInstances } from './ec2';
6+
import { getInstances, tagFilter } from './ec2';
77

88
const logger = createChildLogger('termination-handler');
99

@@ -26,11 +26,9 @@ async function createMetricForInstances(
2626

2727
// check if all tags in config.tagFilter are present on the instance
2828
for (const instance of instances) {
29-
const matchFilter = Object.keys(config.tagFilters).every((key) => {
30-
return instance?.Tags?.find((tag) => tag.Key === key && tag.Value?.startsWith(config.tagFilters[key]));
31-
});
29+
const matchFilter = tagFilter(instance, config.tagFilters);
3230

33-
if (matchFilter && instance) {
31+
if (matchFilter) {
3432
metricEvent(instance, event, config.createSpotTerminationMetric ? 'SpotTermination' : undefined, logger);
3533
} else {
3634
logger.debug(

0 commit comments

Comments
 (0)