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

[AO] Compile the KQL expression on the server. #159017

Closed
fkanout opened this issue Jun 5, 2023 · 2 comments · Fixed by #162701
Closed

[AO] Compile the KQL expression on the server. #159017

fkanout opened this issue Jun 5, 2023 · 2 comments · Fixed by #162701
Assignees
Labels
Team: Actionable Observability - DEPRECATED For Observability Alerting and SLOs use "Team:obs-ux-management", for AIops "Team:obs-knowledge" v8.9.0
Milestone

Comments

@fkanout
Copy link
Contributor

fkanout commented Jun 5, 2023

📝 Summary

Part of https://github.com/elastic/actionable-observability/issues/36
Related to #158665 (comment)

Currently, fitlerQueryText is the unparsed KQL expression, and filterQuery is a stringified JSON representation of the KQL expression. This also makes the JSON body for creating a rule via the API confusing.

Related file x-pack/plugins/observability/public/pages/threshold/components/expression.tsx

✅ ACs

  • Compile the KQL expression on the server.
@fkanout fkanout added Team: Actionable Observability - DEPRECATED For Observability Alerting and SLOs use "Team:obs-ux-management", for AIops "Team:obs-knowledge" v8.9.0 labels Jun 5, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/actionable-observability (Team: Actionable Observability)

@maryam-saeidi
Copy link
Member

maryam-saeidi commented Jul 13, 2023

@simianhacker 's input: Should be fixed before GA, better to be fixed sooner!

@maryam-saeidi maryam-saeidi self-assigned this Jul 20, 2023
@emma-raffenne emma-raffenne modified the milestones: 8.9, 8.10 Jul 20, 2023
maryam-saeidi added a commit that referenced this issue Aug 2, 2023
Closes #159017

## Summary

This PR is related to this
[comment](#158665 (comment)).
Previously, we had both `fitlerQueryText` (unparsed KQL expression) and
`filterQuery` (stringified JSON representation of the KQL expression).
This makes the JSON body for creating a rule via the API confusing, as
@simianhacker pointed out. In this PR, I've removed `filterQuery` and
renamed `fitlerQueryText` to `filterQuery` to avoid confusion and parsed
the `filterQuery` when needed.

After this change, you should only see `filterQuery` in the AAD and the
rule definition with the user's value.

|Rule definition|Alert document|
|---|---|

|![image](https://github.com/elastic/kibana/assets/12370520/05fb04c1-4f5a-4587-b7ac-a90a088b5f26)|![image](https://github.com/elastic/kibana/assets/12370520/2471d144-f284-4721-94ec-cf1b95029786)|

## 🧪 How to test
- Create a new threshold rule and add a filter for it
- Make sure that all the rule functionalities that use filter work as
expected
    - Preview
    - Rule execution
    - Saved data in rule definition and alert document
- Add an invalid filter query by editing the rule and make sure the
validation works as expected (filter should be invalid state and save
button should not work)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team: Actionable Observability - DEPRECATED For Observability Alerting and SLOs use "Team:obs-ux-management", for AIops "Team:obs-knowledge" v8.9.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants