Skip to content

fix(table): use last data point instead of first in buildRawTableData#736

Open
tgitelman wants to merge 1 commit into
perses:mainfrom
tgitelman:fix/table-use-last-value
Open

fix(table): use last data point instead of first in buildRawTableData#736
tgitelman wants to merge 1 commit into
perses:mainfrom
tgitelman:fix/table-use-last-value

Conversation

@tgitelman

Copy link
Copy Markdown

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
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
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.

1 participant