Datadog analysis logs read millisecond timestamps as seconds
What happened
An ANALYSIS threshold check correctly rejects a Datadog sample from 2023-04-16 22:15:00 UTC, but the failure log dates the sample 55260-06-03 02:00:00 UTC.
Datadog returns milliseconds in pointlist. The provider copies that timestamp into DataPoint.Timestamp, which the stage log formats as Unix seconds. Datadog API response example · pipedv1 conversion · pipedv0 conversion · Timestamp formatter
What you expected to happen
The failure log shows the sample's UTC time as 2023-04-16 22:15:00 UTC.
How to reproduce it
- In the Datadog provider test, mock a successful query response with one series,
length: 1, andpointlist: [[1681683300000, 2]]. - Call
QueryPointsand format the returned sample withDataPoint.String(). The formatted year is 55260. - Feed the point into a THRESHOLD check with
expected.max: 1. The failure log prints the same date.
Local Go tests reproduced the timestamp conversion in both providers and captured the threshold failure log in pipedv1.
Environment
pipedv0 and pipedv1 analysis source at 87c6da5e7. The tests used a mocked Datadog response.
Hi, I'd like to work on this.
I confirmed it. Datadog's docs say pointlist times are in milliseconds, but both datadog providers (piped and pipedv1) copy them as seconds. The current test only passes because its fake data uses seconds.
Fix: convert with time.UnixMilli(...).Unix() in both providers, and change the test data to milliseconds like the real API. I tried it locally: the updated test fails on master and passes with the fix.
Can you assign me?
cc @mohammedfirdouss @khanhtc1202