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

Query Validation: accept any parser to validate query and integrate with Prom query editor #77081

Merged
merged 4 commits into from
Oct 31, 2023

Conversation

matyax
Copy link
Contributor

@matyax matyax commented Oct 24, 2023

We have a lot of components in common, with similar tools, adding query validation for other data sources that use a Lezer parser could be trivial, so I quickly came up with this PR, where:

  • The validation function accepts a parser parameter.
  • Integrated the validator with the Prometheus Monaco component.

If we want to support other data sources and be friendly with external data sources, we should ideally move this to an external repo.

Special notes for your reviewer:

Demo.mov

@matyax
Copy link
Contributor Author

matyax commented Oct 24, 2023

@grafana/observability-metrics Would you be interested in this feature? I wouldn't mind moving it elsewhere where other data sources could use this.

@matyax matyax self-assigned this Oct 24, 2023
@matyax matyax added no-backport Skip backport of PR no-changelog Skip including change in changelog/release notes labels Oct 24, 2023
@github-actions
Copy link
Contributor

Backend code coverage report for PR #77081
No changes

@github-actions
Copy link
Contributor

github-actions bot commented Oct 24, 2023

Frontend code coverage report for PR #77081

Plugin Main PR Difference
loki 86.18% 86.18% 0%

@gtk-grafana
Copy link
Contributor

This is a good refactor and a win IMO even if we don't pursue a shared lib
@bohandley, what do you think?

@matyax matyax changed the title Validation: accept any parser to validate query and integrate with Prom query editor Query Validation: accept any parser to validate query and integrate with Prom query editor Oct 27, 2023
@bohandley
Copy link
Contributor

I agree @gtk-grafana, this looks good to me!

@matyax matyax added add to changelog no-changelog Skip including change in changelog/release notes and removed no-changelog Skip including change in changelog/release notes add to changelog labels Oct 31, 2023
@matyax
Copy link
Contributor Author

matyax commented Oct 31, 2023

Added unit tests for PromQL. Any concern about merging this @gtk-grafana @bohandley ?

@matyax matyax merged commit 91398a1 into main Oct 31, 2023
24 checks passed
@matyax matyax deleted the matyax/prom-validate-query branch October 31, 2023 15:30
@matyax
Copy link
Contributor Author

matyax commented Oct 31, 2023

Thank you all! If there's any issue with this feel free to just ping 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/frontend datasource/Loki datasource/Prometheus no-backport Skip backport of PR no-changelog Skip including change in changelog/release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants