Skip to content

[ENHANCEMENT] Support curly braces ${} variable syntax in datasource selector shortcut - #242

Open
celian-garcia wants to merge 1 commit into
mainfrom
celian-garcia/support-curly-braces-syntax
Open

[ENHANCEMENT] Support curly braces ${} variable syntax in datasource selector shortcut#242
celian-garcia wants to merge 1 commit into
mainfrom
celian-garcia/support-curly-braces-syntax

Conversation

@celian-garcia

@celian-garcia celian-garcia commented Aug 20, 2026

Copy link
Copy Markdown
Member

Description

This PR allows ${myVar} and $myVar syntax when we use variable in some fields.

This is to align with the already supported syntax inside the queries:
image
image


Here are some examples of usage in the validation schemas:

  • Datasource selector being either a datasource variable or a datasource struct
#datasourceSelector: {
	_kind: string
	datasource?: =~#variableSyntaxRegex | {
		kind:  _kind
		name?: string
	}
}
  • Prometheus query's minStep being either a duration or a variable
kind: "PrometheusTimeSeriesQuery"
spec: close({
	ds.#selector
	query:             strings.MinRunes(1)
	seriesNameFormat?: string
	minStep?:          =~ds.#durationRegex | =~common.#variableSyntaxRegex
	resolution?:       number
})

I am also planning to use it in the Grafana to Perses migration of datasource with datasource variables. That would fix the migration in case it is defined with ${} syntax in Grafana source dashboard
Pending PR: https://github.com/perses/plugins/pull/775/changes

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.

…selector shortcut

Signed-off-by: Celian GARCIA <celian.garcia@amadeus.com>
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