Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions aws/logs_monitoring/enhanced_lambda_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
MEMORY_ALLOCATED_FIELD_NAME = "memorysize"
MAX_MEMORY_USED_METRIC_NAME = "max_memory_used"
INIT_DURATION_METRIC_NAME = "init_duration"
TIMED_OUT_DURATION_METRIC_NAME = "timed_out"
TIMEOUTS_METRIC_NAME = "timeouts"

# Create named groups for each metric and tag so that we can
# access the values from the search result by name
Expand All @@ -45,9 +45,7 @@
)

TIMED_OUT_REGEX = re.compile(
r"Task\stimed\sout\safter\s+(?P<{}>[\d\.]+)\s+seconds".format(
TIMED_OUT_DURATION_METRIC_NAME
)
r"Task\stimed\sout\safter\s+(?P<{}>[\d\.]+)\s+seconds".format(TIMEOUTS_METRIC_NAME)
)

METRICS_TO_PARSE_FROM_REPORT = [
Expand Down Expand Up @@ -530,7 +528,7 @@ def get_enriched_lambda_log_tags(log_event):


def create_timeout_enhanced_metric(report_log_line):
"""Parses and returns timed out metric from lambda log
"""Parses and returns a value of 1 if a timeout occurred for the function

Args:
report_log_line (str): The timed out task log
Expand All @@ -546,9 +544,6 @@ def create_timeout_enhanced_metric(report_log_line):
return []

dd_metric = DatadogMetricPoint(
"{}.{}".format(
ENHANCED_METRICS_NAMESPACE_PREFIX, TIMED_OUT_DURATION_METRIC_NAME
),
float(regex_match.group(TIMED_OUT_DURATION_METRIC_NAME)),
"{}.{}".format(ENHANCED_METRICS_NAMESPACE_PREFIX, TIMEOUTS_METRIC_NAME), 1.0,
)
return [dd_metric]
4 changes: 2 additions & 2 deletions aws/logs_monitoring/tests/test_enhanced_lambda_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ def test_generate_enhanced_lambda_metrics_timeout(self, mock_build_cache):
[metric.__dict__ for metric in generated_metrics],
[
{
"name": "aws.lambda.enhanced.timed_out",
"name": "aws.lambda.enhanced.timeouts",
"tags": [
"region:us-east-1",
"account_id:0",
Expand All @@ -539,7 +539,7 @@ def test_generate_enhanced_lambda_metrics_timeout(self, mock_build_cache):
"creator:swf",
],
"timestamp": 1591714946151,
"value": 3.0,
"value": 1.0,
}
],
)
Expand Down