Skip to content

Commit e96b4c1

Browse files
handle datetime params
1 parent 7b5abe4 commit e96b4c1

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

datadog_lambda/metric.py

+2
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ def lambda_metric(metric_name, value, timestamp=None, tags=None, force_async=Fal
6565
timestamp_ceiling = int(
6666
(datetime.now() - timedelta(hours=4)).timestamp()
6767
) # 4 hours ago
68+
if isinstance(timestamp, datetime):
69+
timestamp = int(timestamp.timestamp())
6870
if timestamp_ceiling > timestamp:
6971
logger.warning(
7072
"Timestamp %s is older than 4 hours, not submitting metric %s",

0 commit comments

Comments
 (0)