-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Variables: Interpolate datasource uid when used with datasource variable #996
Conversation
this.findAndSubscribeToAdHocFilters(datasource?.uid); | ||
this.findAndSubscribeToAdHocFilters(ds.uid); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could break existing logic, needs to be the same that was specified in SceneQueryRunner config (the string that has the variable expression), here you are just passing in the uid
so if the ad-hoc filter has a variable expression as data source then this change will break that lookup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think this mainly means that we must make sure that in findAndSubscribeToAdHocFilters
both filters and query runner ds are interpolated when comparing. Not sure what would that break really, it just makes sure that the same data sources are used.
🚀 PR was released in |
jest.resetAllMocks(); | ||
}); | ||
|
||
it.only('should get queries for interpolated source object and query datasource uuids', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Sergej-Vlasov stray .only
here that needs removing. there is an eslint plugin (eslint-plugin-jest
) and a corresponding rule (jest/no-focused-tests
) that you should add as well to prevent this in the future 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use case - use datasource variable as a datasource for ad hoc filter and in a dashboard query.
so we have datasource variable
dsVar
and it equals toprom-1
as example then:${dsVar}
)${dsVar}
) and named ds in panel (prom-1
) that are the sameprom-1
) and ds variable in panel (${dsVar}
) that are the sameIssues solved:
findAndSubscribeToAdHocFilters
did not get interpolated datasource name.getQueriesForVariables
adding dashboard JSON that replicates issue:
dsVar as filter datasource-1733769038417.json
📦 Published PR as canary version:
5.33.1--canary.996.12371059735.0
✨ Test out this PR locally via: