Skip to content

[BUGFIX] Table: use last data point instead of first in buildRawTableData#736

Merged
Nexucis merged 1 commit into
perses:mainfrom
tgitelman:fix/table-use-last-value
Jul 21, 2026
Merged

[BUGFIX] Table: use last data point instead of first in buildRawTableData#736
Nexucis merged 1 commit into
perses:mainfrom
tgitelman:fix/table-use-last-value

Conversation

@tgitelman

Copy link
Copy Markdown
Contributor

buildRawTableData() hardcodes ts.values[0] — always picking the first data point from range query results. When a datasource plugin sends query_range despite the table requesting instant mode, the first step covers a stale time window while the last step is current. StatChart panels (using calculation: last) show correct values; the table does not.

Fix: use ts.values[ts.values.length - 1] instead of ts.values[0] for value extraction, timestamp, and CSV export. Also add a guard for empty values arrays.

Ref: perses/perses#4270

Description

Screenshots

Checklist

  • Pull request has a descriptive title and context useful to a reviewer.
  • Pull request title follows the [<catalog_entry>] <commit message> naming convention using one of the
    following catalog_entry values: FEATURE, ENHANCEMENT, BUGFIX, BREAKINGCHANGE, DOC,IGNORE.
  • All commits have DCO signoffs.

UI Changes

  • Changes that impact the UI include screenshots and/or screencasts of the relevant changes.
  • Code follows the UI guidelines.

@tgitelman
tgitelman requested a review from a team as a code owner July 19, 2026 17:34
@tgitelman
tgitelman requested review from Gladorme and removed request for a team July 19, 2026 17:34
@tgitelman
tgitelman force-pushed the fix/table-use-last-value branch from 8d23d3c to 9d65d62 Compare July 19, 2026 17:47
@tgitelman
tgitelman force-pushed the fix/table-use-last-value branch from 9d65d62 to e2ebed8 Compare July 21, 2026 09:18
@jgbernalp jgbernalp changed the title fix(table): use last data point instead of first in buildRawTableData [BUGFIX] Table: use last data point instead of first in buildRawTableData Jul 21, 2026
@jgbernalp
jgbernalp enabled auto-merge July 21, 2026 09:44
@Nexucis

Nexucis commented Jul 21, 2026

Copy link
Copy Markdown
Member

type-check failed. Can you check @tgitelman please

auto-merge was automatically disabled July 21, 2026 11:26

Head branch was pushed to by a user without write access

@tgitelman
tgitelman force-pushed the fix/table-use-last-value branch from e2ebed8 to 212c9b2 Compare July 21, 2026 11:26
buildRawTableData() hardcodes ts.values[0] — always picking the first
data point from range query results. When a datasource plugin sends
query_range despite the table requesting instant mode, the first step
covers a stale time window while the last step is current. StatChart
panels (using calculation: last) show correct values; the table does
not.

Fix: use ts.values[ts.values.length - 1] instead of ts.values[0] for
value extraction, timestamp, and CSV export. Also add a guard for
empty values arrays.

Ref: perses/perses#4270
Signed-off-by: Tal Gitelman <tgitelma@redhat.com>
@tgitelman
tgitelman force-pushed the fix/table-use-last-value branch from 212c9b2 to 080ff35 Compare July 21, 2026 11:28
@Nexucis
Nexucis added this pull request to the merge queue Jul 21, 2026
Merged via the queue into perses:main with commit 54b63e8 Jul 21, 2026
16 checks passed
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