Skip to content

Conversation

@nhulston
Copy link
Contributor

@nhulston nhulston commented May 8, 2025

What does this PR do?

When receiving metrics over dogstatsd, we receive metrics in the format: metric.name:15|c|#env:dev|T1656581409, where T1656581409 is the timestamp.

We parse the timestamp as i64, which means that if the timestamp is a float such as T1656581409.123, the parse will fail, and we fallback to now.

Motivation

Just for flexibility. Even though metrics are rounded to the nearest 10 second bucket, we should still support decimal input.

E.g. v108 of datadog-lambda-python sends timestamped metrics with decimals. Therefore, we currently fallback to now since the parse as u64 fails.

Additional Notes

Describe how to test/QA your changes

I tested manually with local builds of Node+Extension, where Node was sending timestamps with a decimal:
Screenshot 2025-05-08 at 10 56 49 AM
Screenshot 2025-05-08 at 11 07 35 AM

And timestamped metrics now work as expected:
Screenshot 2025-05-08 at 10 59 58 AM

Also added a basic unit test

@nhulston nhulston marked this pull request as ready for review May 8, 2025 15:04
@nhulston nhulston force-pushed the nicholas.hulston/also-parse-float-timestamps branch from 698cce4 to 492f44f Compare May 8, 2025 15:07
@nhulston nhulston merged commit e37f0a1 into main May 8, 2025
25 checks passed
@nhulston nhulston deleted the nicholas.hulston/also-parse-float-timestamps branch May 8, 2025 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants