Skip to content

Commit 95e2cbc

Browse files
chore: add guard around lambda_stats.flush()
1 parent f8967a7 commit 95e2cbc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

datadog_lambda/metric.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ def write_metric_point_to_stdout(metric_name, value, timestamp=None, tags=None):
168168

169169

170170
def flush_stats(lambda_context=None):
171-
lambda_stats.flush()
171+
if lambda_stats is not None:
172+
lambda_stats.flush()
172173

173174

174175
def submit_enhanced_metric(metric_name, lambda_context):

0 commit comments

Comments
 (0)