From 74100ad2fcca771957b0dd75b77a5ed6c6e0703b Mon Sep 17 00:00:00 2001 From: Cody Lee Date: Mon, 9 Feb 2026 20:43:50 -0600 Subject: [PATCH 1/2] fix(metrics): send timestamps as Unix seconds instead of milliseconds to API The metrics query command was incorrectly converting timestamps to milliseconds before sending to the Datadog v2 timeseries API, which expects Unix timestamps in seconds. This caused queries to fail or return incorrect time ranges. The parseTimeParam function correctly parses input timestamps as seconds (e.g., "1h" ago, "1704067200", or "now"), but the code was then multiplying by 1000 (via UnixMilli()) before sending to the API. Changes: - Changed from.UnixMilli() to from.Unix() in runMetricsQuery - Changed to.UnixMilli() to to.Unix() in runMetricsQuery - Updated documentation to clarify timestamps are in seconds Co-Authored-By: Claude Sonnet 4.5 --- cmd/metrics.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/metrics.go b/cmd/metrics.go index cf1f7cde..b1e94e37 100644 --- a/cmd/metrics.go +++ b/cmd/metrics.go @@ -123,8 +123,8 @@ EXAMPLES: OUTPUT: Returns time-series data including: • series: Array of time-series data points - • from_date: Query start time (Unix timestamp milliseconds) - • to_date: Query end time (Unix timestamp milliseconds) + • from_date: Query start time (Unix timestamp seconds) + • to_date: Query end time (Unix timestamp seconds) • query: The query string used • res_type: Response type • resp_version: Response version`, @@ -507,8 +507,8 @@ func runMetricsQuery(cmd *cobra.Command, args []string) error { body := datadogV2.TimeseriesFormulaQueryRequest{ Data: datadogV2.TimeseriesFormulaRequest{ Attributes: datadogV2.TimeseriesFormulaRequestAttributes{ - From: from.UnixMilli(), - To: to.UnixMilli(), + From: from.Unix(), + To: to.Unix(), Queries: []datadogV2.TimeseriesQuery{timeseriesQuery}, }, Type: datadogV2.TIMESERIESFORMULAREQUESTTYPE_TIMESERIES_REQUEST, From 5022dcca79510f3753a4f319622f6c7c05c9e863 Mon Sep 17 00:00:00 2001 From: Cody Lee Date: Mon, 9 Feb 2026 20:45:57 -0600 Subject: [PATCH 2/2] do not duplicate testing --- .github/workflows/ci.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3da5398c..2e86555c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,9 +1,6 @@ name: CI on: - push: - branches: - - '**' pull_request: branches: - '**'