Skip to content

Commit 117dc26

Browse files
czechnologyMartin Kulhavyleandrodamascena
authored
fix(typing): Fix type of Metrics.set_timestamp argument (#7582)
The docstring is correct but the type hint is not. The underlying AmazonCloudWatchEMFProvider.set_timestamp supports both int and datetime.datetime. Co-authored-by: Martin Kulhavy <[email protected]> Co-authored-by: Leandro Damascena <[email protected]>
1 parent fd6865d commit 117dc26

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

aws_lambda_powertools/metrics/metrics.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from aws_lambda_powertools.metrics.provider.cloudwatch_emf.cloudwatch import AmazonCloudWatchEMFProvider
77

88
if TYPE_CHECKING:
9+
import datetime
910
from collections.abc import Callable
1011

1112
from aws_lambda_powertools.metrics.base import MetricResolution, MetricUnit
@@ -133,7 +134,7 @@ def serialize_metric_set(
133134
def add_metadata(self, key: str, value: Any) -> None:
134135
self.provider.add_metadata(key=key, value=value)
135136

136-
def set_timestamp(self, timestamp: int):
137+
def set_timestamp(self, timestamp: int | datetime.datetime):
137138
"""
138139
Set the timestamp for the metric.
139140

0 commit comments

Comments
 (0)