Skip to content

Commit

Permalink
accept metrics such as "1.5"
Browse files Browse the repository at this point in the history
  • Loading branch information
nhulston committed Jan 30, 2025
1 parent 05b73c9 commit d73cc8d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions datadog_lambda/metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@ def lambda_metric(metric_name, value, timestamp=None, tags=None, force_async=Fal
)
return

if not isinstance(value, numbers.Number):
try:
float(value)
except (ValueError, TypeError):
logger.warning(
"Ignoring metric submission for metric '%s' because the value is not numeric: %r",
"Ignoring metric submission for metric '%s' because the value cannot be converted to a number: %r",
metric_name,
value,
)
Expand Down

0 comments on commit d73cc8d

Please sign in to comment.