From bb416894e1fb428a61b069b225e06cea199e6e9f Mon Sep 17 00:00:00 2001 From: Joey Zhao <5253430+joeyzhao2018@users.noreply.github.com> Date: Wed, 25 Jun 2025 14:21:32 -0400 Subject: [PATCH] bugfix: error metrics should be sent during exception handling Signed-off-by: Joey Zhao <5253430+joeyzhao2018@users.noreply.github.com> --- datadog_lambda/wrapper.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/datadog_lambda/wrapper.py b/datadog_lambda/wrapper.py index 29972bf4..98a1e87e 100644 --- a/datadog_lambda/wrapper.py +++ b/datadog_lambda/wrapper.py @@ -166,10 +166,9 @@ def __call__(self, event, context, **kwargs): self.response = self.func(event, context, **kwargs) return self.response except Exception: - if not should_use_extension: - from datadog_lambda.metric import submit_errors_metric + from datadog_lambda.metric import submit_errors_metric - submit_errors_metric(context) + submit_errors_metric(context) if self.span: self.span.set_traceback()