Skip to content

Commit f8f9abc

Browse files
chore: a bit more defense in depth
1 parent 736ba06 commit f8f9abc

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

datadog_lambda/dogstatsd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def _serialize_metric(self, metric, metric_type, value, tags, timestamp):
9797
value,
9898
metric_type,
9999
("|#" + ",".join(self.normalize_tags(tags))) if tags else "",
100-
("|T" + str(timestamp)) if timestamp is not None else "",
100+
("|T" + str(int(timestamp))) if timestamp is not None else "",
101101
)
102102

103103
def _report(self, metric, metric_type, value, tags, timestamp):

tests/test_dogstatsd.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,7 @@ def test_distribution_with_tags(self):
5353
def test_distribution_with_timestamp(self):
5454
statsd.distribution("my.test.timestamp.metric", 9, timestamp=123456789)
5555
self._checkOnlyOneMetric("my.test.timestamp.metric:9|d|T123456789")
56+
57+
def test_distribution_with_float_timestamp(self):
58+
statsd.distribution("my.test.timestamp.metric", 9, timestamp=123456789.123)
59+
self._checkOnlyOneMetric("my.test.timestamp.metric:9|d|T123456789")

0 commit comments

Comments
 (0)