Skip to content
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

mssql: pass timerange for template variable queries #13324

Closed
cgaborik opened this issue Sep 18, 2018 · 3 comments · Fixed by #15215
Closed

mssql: pass timerange for template variable queries #13324

cgaborik opened this issue Sep 18, 2018 · 3 comments · Fixed by #15215

Comments

@cgaborik
Copy link

cgaborik commented Sep 18, 2018

atm the frontend does not pass the timerange on template variable queries in mssql. this patch changes the behaviour to include the timerange when the refresh mode for the variable is set to on time range change

I've updated the mssql datasource.ts file and tested, but I'm still navigating how to publish this change.

@marefr
Copy link
Member

marefr commented Oct 4, 2018

To fix this you can have a look at the MySQL datasource code which already has solved this. The needed code is highlighted.

Basically we need the same code as highlighted for MySQL above implemented in the MSSQL datasource code.

As a bonus, to validate that your implemented changes are correct a test could be added here and would be similar to one of the existing tests. However, instead of verifying the response is correct you would need to verify that the payload provided to this.backendSrv.datasourceRequest includes a data property with to and from properties having a value according to argument passed to metricFindQuery.

@cgaborik
Copy link
Author

cgaborik commented Oct 4, 2018

I've had it working for some time on our local Grafana instance. I think I merged the datasource.ts file correctly with cgaborik@0ed8fb3

@marefr
Copy link
Member

marefr commented Oct 4, 2018

@cgaborik with that merge you've basically merged your PR to your fork of Grafana. Should be pretty straight forward to extract that commit onto new branch based on latest Grafana master and open PR here. If you're interested of course we would love the contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants