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

[Infrastructure UI] Improve alerts query and fix import #152549

Merged
merged 3 commits into from
Mar 6, 2023

Conversation

tonyghiani
Copy link
Contributor

@tonyghiani tonyghiani commented Mar 2, 2023

📓 Summary

Closes #152544

The issue was caused by a wrong import, where we were directly importing the hook implementation instead of the context hook exposed by constate.

This PR also improves a bit the alerts status filtering switching from match_phrase to a term query.

🧪 Testing

  • Navigate to the Hosts View
  • Open dev tools
  • Refresh the page or trigger a new search
  • Verify the /snapshot API is called once to retrieve the table metrics

@tonyghiani tonyghiani added Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services release_note:skip Skip the PR/issue when compiling release notes v8.8.0 labels Mar 2, 2023
@tonyghiani tonyghiani marked this pull request as ready for review March 2, 2023 10:36
@tonyghiani tonyghiani requested a review from a team as a code owner March 2, 2023 10:36
@elasticmachine
Copy link
Contributor

Pinging @elastic/infra-monitoring-ui (Team:Infra Monitoring UI)

Copy link
Contributor

@crespocarlos crespocarlos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. The duplicate request problem has been solved


return buildEsQuery(undefined, queries, filters);
return buildEsQuery(undefined, [], filters);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why aren't we passing a data view here? Is it because we have more control over the filters that are passed to it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As done in the observability plugin, the data view was not passed because we need more control over those filters yeah! This way we are just taking care of passing the list of hosts, the data range and the alert status, without the need to retrieve the alerts data view.

@tonyghiani tonyghiani enabled auto-merge (squash) March 6, 2023 11:18
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
infra 1.3MB 1.3MB -22.0B
Unknown metric groups

ESLint disabled line counts

id before after diff
securitySolution 428 430 +2

Total ESLint disabled count

id before after diff
securitySolution 506 508 +2

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@tonyghiani tonyghiani merged commit dadc9c9 into elastic:main Mar 6, 2023
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Mar 6, 2023
@tonyghiani tonyghiani deleted the 152544-fix-alerts-query-hook branch March 7, 2023 08:07
bmorelli25 pushed a commit to bmorelli25/kibana that referenced this pull request Mar 10, 2023
## 📓 Summary

Closes elastic#152544 

The issue was caused by a wrong import, where we were directly importing
the hook implementation instead of the context hook exposed by
`constate`.

This PR also improves a bit the alerts status filtering switching from
`match_phrase` to a `term` query.

## 🧪 Testing
- Navigate to the Hosts View
- Open dev tools
- Refresh the page or trigger a new search
- Verify the `/snapshot` API is called once to retrieve the table
metrics

---------

Co-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services v8.8.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Infrastructure UI] Alerts hook trigger snapshot API unnecessarily
5 participants