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] Alerts hook trigger snapshot API unnecessarily #152544

Closed
tonyghiani opened this issue Mar 2, 2023 · 1 comment · Fixed by #152549
Closed

[Infrastructure UI] Alerts hook trigger snapshot API unnecessarily #152544

tonyghiani opened this issue Mar 2, 2023 · 1 comment · Fixed by #152549
Assignees
Labels
bug Fixes for quality problems that affect the customer experience Feature:Metrics UI Metrics UI feature Feature:ObsHosts Hosts feature within Observability Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services

Comments

@tonyghiani
Copy link
Contributor

📓 Summary

The useAlertsQuery hook is wrongly importing the hook implementation of the HostView context instead of the provided context hook.

This results in rebuilding the snapshot query and performing twice the /snapshot request unnecessarily.

✔️ Acceptance criteria

Import correctly the context hook and verify the /snapshot request is performed once on each search.

@tonyghiani tonyghiani added the Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services label Mar 2, 2023
@elasticmachine
Copy link
Contributor

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

@tonyghiani tonyghiani added bug Fixes for quality problems that affect the customer experience Feature:ObsHosts Hosts feature within Observability labels Mar 2, 2023
@tonyghiani tonyghiani self-assigned this Mar 2, 2023
@tonyghiani tonyghiani added the Feature:Metrics UI Metrics UI feature label Mar 6, 2023
tonyghiani added a commit that referenced this issue Mar 6, 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

---------

Co-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
bmorelli25 pushed a commit to bmorelli25/kibana that referenced this issue 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
bug Fixes for quality problems that affect the customer experience Feature:Metrics UI Metrics UI feature Feature:ObsHosts Hosts feature within Observability Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants