Skip to content

Commit 4df0c49

Browse files
committed
fixed formatting with black
1 parent 82b253b commit 4df0c49

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

aws/logs_monitoring/enhanced_lambda_metrics.py

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,7 @@ def submit_to_dd(self):
186186
if not timestamp:
187187
timestamp = time()
188188

189-
log.debug("Submitting metric {} {} {}".format(
190-
self.name, self.value, self.tags))
189+
log.debug("Submitting metric {} {} {}".format(self.name, self.value, self.tags))
191190
lambda_stats.distribution(
192191
self.name, self.value, timestamp=timestamp, tags=self.tags
193192
)
@@ -247,8 +246,7 @@ def get_dd_tag_string_from_aws_dict(aws_key_value_tag_dict):
247246
key:value colon-separated string built from the dict
248247
ex: "creator:swf"
249248
"""
250-
key = sanitize_aws_tag_string(
251-
aws_key_value_tag_dict["Key"], remove_colons=True)
249+
key = sanitize_aws_tag_string(aws_key_value_tag_dict["Key"], remove_colons=True)
252250
value = sanitize_aws_tag_string(aws_key_value_tag_dict.get("Value"))
253251
# Value is optional in DD and AWS
254252
if not value:
@@ -294,21 +292,17 @@ def build_tags_by_arn_cache():
294292
tags_by_arn_cache (dict<str, str[]>): each Lambda's tags in a dict keyed by ARN
295293
"""
296294
tags_by_arn_cache = {}
297-
get_resources_paginator = resource_tagging_client.get_paginator(
298-
"get_resources")
295+
get_resources_paginator = resource_tagging_client.get_paginator("get_resources")
299296

300297
try:
301298
for page in get_resources_paginator.paginate(
302-
ResourceTypeFilters=[
303-
GET_RESOURCES_LAMBDA_FILTER], ResourcesPerPage=100
299+
ResourceTypeFilters=[GET_RESOURCES_LAMBDA_FILTER], ResourcesPerPage=100
304300
):
305301
lambda_stats.distribution(
306-
"{}.get_resources_api_calls".format(
307-
ENHANCED_METRICS_NAMESPACE_PREFIX),
302+
"{}.get_resources_api_calls".format(ENHANCED_METRICS_NAMESPACE_PREFIX),
308303
1,
309304
)
310-
page_tags_by_arn = parse_get_resources_response_for_tags_by_arn(
311-
page)
305+
page_tags_by_arn = parse_get_resources_response_for_tags_by_arn(page)
312306
tags_by_arn_cache.update(page_tags_by_arn)
313307

314308
except ClientError:
@@ -455,7 +449,7 @@ def parse_metrics_from_report_log(report_log_line):
455449

456450
# loop is to account for adding cold start
457451
for tag in TAGS_TO_PARSE_FROM_REPORT:
458-
tags.append(tag + ':' + regex_match.group(tag))
452+
tags.append(tag + ":" + regex_match.group(tag))
459453

460454
for metric_name in METRICS_TO_PARSE_FROM_REPORT:
461455
metric_point_value = float(regex_match.group(metric_name))
@@ -474,8 +468,7 @@ def parse_metrics_from_report_log(report_log_line):
474468
metrics.append(dd_metric)
475469

476470
estimated_cost_metric_point = DatadogMetricPoint(
477-
"{}.{}".format(ENHANCED_METRICS_NAMESPACE_PREFIX,
478-
ESTIMATED_COST_METRIC_NAME),
471+
"{}.{}".format(ENHANCED_METRICS_NAMESPACE_PREFIX, ESTIMATED_COST_METRIC_NAME),
479472
calculate_estimated_cost(
480473
float(regex_match.group(BILLED_DURATION_METRIC_NAME)),
481474
float(regex_match.group(MEMORY_ALLOCATED_FIELD_NAME)),

0 commit comments

Comments
 (0)