Skip to content

[ENHANCEMENT] TimeSeriesChart: add query name support for query settings#585

Merged
shahrokni merged 7 commits into
perses:mainfrom
Gladorme:named-queries
Jul 2, 2026
Merged

[ENHANCEMENT] TimeSeriesChart: add query name support for query settings#585
shahrokni merged 7 commits into
perses:mainfrom
Gladorme:named-queries

Conversation

@Gladorme

@Gladorme Gladorme commented Feb 26, 2026

Copy link
Copy Markdown
Member

Description

Depends on: perses/shared#69

Add support for query name in query settings + deprecating queryIndex.

Migration guide:

  • Via the UI:
    Go the dashboard, edit timeserieschart panel, go to query settings, update any value and save (it will migrate all query settings of the panel to queryName)

  • Manually:
    Replace queryIndex by queryName.
    Replace number by string Query #<index + 1> or use helper defaultQueryName.
    Example: queryIndex: 0 become queryName: 'Query #1'.

Screenshots

Queries:
image

Query settings:
image

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.

@Gladorme Gladorme changed the title Named queries ENHANCEMENT/BREAKINGCHANGE] timneserieschart: add query name support for query settings Feb 27, 2026
@Gladorme Gladorme changed the title ENHANCEMENT/BREAKINGCHANGE] timneserieschart: add query name support for query settings [ENHANCEMENT/BREAKINGCHANGE] timneserieschart: add query name support for query settings Feb 27, 2026
@Gladorme Gladorme changed the title [ENHANCEMENT/BREAKINGCHANGE] timneserieschart: add query name support for query settings [ENHANCEMENT/BREAKINGCHANGE] timeserieschart: add query name support for query settings Feb 27, 2026
@AntoineThebaud AntoineThebaud changed the title [ENHANCEMENT/BREAKINGCHANGE] timeserieschart: add query name support for query settings [ENHANCEMENT/BREAKINGCHANGE] TimeSeriesChart: add query name support for query settings Mar 11, 2026
Gladorme added 3 commits June 26, 2026 17:23
Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
… for query settings

Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
@Gladorme Gladorme force-pushed the named-queries branch 2 times, most recently from cc39a7d to f6d19a8 Compare June 26, 2026 15:57
@Gladorme Gladorme marked this pull request as ready for review June 26, 2026 15:57
@Gladorme Gladorme requested review from a team, AntoineThebaud and Nexucis as code owners June 26, 2026 15:57
@Gladorme Gladorme requested review from shahrokni and removed request for a team June 26, 2026 15:57
Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
seriesIndex: 0,
querySettings: {
queryIndex: 0,
queryName: defaultQueryName(0),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's a massive breaking change. This will break every dashboard created without dashboard as code or by migrating from Grafana.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I will check if I can keep old data model

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I remember why I did this change. We can't keep index, because it will cause issue when re-ordering queries with query settings. I will rename queryName to queryIndex, but result will be the same => they will need to update queryIndex.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure why we are dropping the queryIndex, the index could be 0 and the name could be whatever. If name is a new field for better UX, queryIndex can be kept as it is.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jgbernalp Yes, queryIndex is not more dropped, but set as optional

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder why it should be optional. Using the name to index might not be a good strategy, IIUC the index defines the order (functional) and the name is for display (cosmetic).

@Gladorme Gladorme Jul 2, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that query can have name, I thought it was a nice idea to be based on it. But the more I think about it, the more I think it's better to stick to index for now and keep name only for cosmetic purpose.

The only drawback for query settings is: if you remove a query, it will change querysettings selector display. But it's already the case today, so I guess it's okay.

I will rollback to use queryIndex for functional purpose

Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
@Gladorme Gladorme changed the title [ENHANCEMENT/BREAKINGCHANGE] TimeSeriesChart: add query name support for query settings [ENHANCEMENT] TimeSeriesChart: add query name support for query settings Jun 29, 2026
Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
Comment thread timeserieschart/src/QuerySettingsEditor.tsx Outdated
Comment thread timeserieschart/src/time-series-chart-model.ts
Comment thread timeserieschart/schemas/time-series.cue Outdated
Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
@Gladorme

Gladorme commented Jul 2, 2026

Copy link
Copy Markdown
Member Author

Should be good now @jgbernalp / @shahrokni.

Btw, I think there a bug with query settings (already existing), if there are more than 1 series retuned by the query, the color is not applied (other styles are applied) or it's working as intended? 🤔

@shahrokni

Copy link
Copy Markdown
Contributor

Should be good now @jgbernalp / @shahrokni.

Btw, I think there a bug with query settings (already existing), if there are more than 1 series retuned by the query, the color is not applied (other styles are applied) or it's working as intended? 🤔

I will take a look.

@shahrokni shahrokni added this pull request to the merge queue Jul 2, 2026
Merged via the queue into perses:main with commit d9fc4f3 Jul 2, 2026
15 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.

4 participants