Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The function `observeRetrievalResultCodes()` includes the following statement in the InfluxDB query fetching `(day, code, rate)` data: |> aggregateWindow(every: 1d, fn: mean, createEmpty: false) Such query produces a list of values like this: ``` 2024-11-15T00:00:00Z,CONNECTION_REFUSED,0.0022313570194142725 2024-11-16T00:00:00Z,CONNECTION_REFUSED,0.002153071995819862 (...) 2025-02-12T00:00:00Z,CONNECTION_REFUSED,0.021266890041248942 2025-02-12T13:08:20.817239423Z,CONNECTION_REFUSED,0.02153170594662248 ``` Notice there are two rows for today (2025-02-12). One row contains data from yesterday (full day) and another row contain partial data from today. In this commit, I am fixing the query to correctly assign data points from yesterday to yesterday's date: |> aggregateWindow(every: 1d, fn: mean, createEmpty: false, timeSrc: "_start") The new query produces a list like this: ``` 2024-11-14T00:00:00Z,CONNECTION_REFUSED,0.0022313570194142725 2024-11-15T00:00:00Z,CONNECTION_REFUSED,0.002153071995819862 (...) 2025-02-11T00:00:00Z,CONNECTION_REFUSED,0.021266890041248942 2025-02-12T00:00:00Z,CONNECTION_REFUSED,0.02153170594662248 ``` This fixed the error introduced by cbb3bf1 (#316), where the SQL query fails with the following message: ``` ON CONFLICT DO UPDATE command cannot affect row a second time. Ensure that no rows proposed for insertion within the same command have duplicate constrained values. ``` See also InfluxDB documentation for `aggregateWindow()`: https://docs.influxdata.com/flux/v0/stdlib/universe/aggregatewindow/#timesrc Signed-off-by: Miroslav Bajtoš <[email protected]>
- Loading branch information