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

[Uptime] Use core HTTP instead of native fetch for API calls #56894

Closed
andrewvc opened this issue Feb 5, 2020 · 3 comments · Fixed by #59881
Closed

[Uptime] Use core HTTP instead of native fetch for API calls #56894

andrewvc opened this issue Feb 5, 2020 · 3 comments · Fixed by #59881
Assignees
Labels
Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability technical debt Improvement of the software architecture and operational architecture test-plan-skip v7.8.0

Comments

@andrewvc
Copy link
Contributor

andrewvc commented Feb 5, 2020

We use plain fetch in a number of places, notably all the files in state/api. We should switch these to use core http as in use_telemetry.

For the API calls however this is a bit trickier since useKibana is only available in the component, and breaks when invoked after dispatch from redux. We should introduce some sugar to making these dispatches more simple, so we don't have to put useKibana everywhere.

@andrewvc andrewvc assigned andrewvc and unassigned andrewvc Feb 5, 2020
@andrewvc andrewvc added [zube]: Ready Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability technical debt Improvement of the software architecture and operational architecture labels Feb 5, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/uptime (Team:uptime)

@zube zube bot added [zube]: Inbox and removed [zube]: Ready labels Feb 5, 2020
@justinkambic
Copy link
Contributor

A possible solution is to use a custom hook that provides a function we can wrap our dispatched actions in that will add Kibana's fetch to the action payload, and we modify our API calls to expect a fetch function as a dependency.

This will keep the API functions pure and stateless, and make them more testable since the fetch function is injected now vs. referenced directly from the function body.

That said, this is only one of other potential solutions, and I'm interested to hear other proposals on the best way to resolve this.

@andrewvc
Copy link
Contributor Author

andrewvc commented Feb 5, 2020

@shahzad31 would love to hear your thoughts here as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability technical debt Improvement of the software architecture and operational architecture test-plan-skip v7.8.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants