Skip to content

Commit c03ad6d

Browse files
Use datetime.now(utc) in MetricDatum (#3538)
1 parent 027ffc0 commit c03ad6d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

samtranslator/metrics/metrics.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
"""
22
Helper classes to publish metrics
33
"""
4+
45
import logging
56
from abc import ABC, abstractmethod
6-
from datetime import datetime
7+
from datetime import datetime, timezone
78
from typing import Any, Dict, List, Optional, TypedDict, Union
89

910
from samtranslator.internal.deprecation_control import deprecated
@@ -114,7 +115,7 @@ def __init__(
114115
self.value = value
115116
self.unit = unit
116117
self.dimensions = dimensions if dimensions else []
117-
self.timestamp = timestamp if timestamp else datetime.utcnow()
118+
self.timestamp = timestamp if timestamp else datetime.now(timezone.utc)
118119

119120
def get_metric_data(self) -> Dict[str, Any]:
120121
return {

0 commit comments

Comments
 (0)