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

[Fleet] Handle ES failures on template installation #70586

Open
jonathan-buttner opened this issue Jul 2, 2020 · 7 comments
Open

[Fleet] Handle ES failures on template installation #70586

jonathan-buttner opened this issue Jul 2, 2020 · 7 comments
Labels
Feature:EPM Fleet team's Elastic Package Manager (aka Integrations) project research Team:Fleet Team label for Observability Data Collection Fleet team

Comments

@jonathan-buttner
Copy link
Contributor

jonathan-buttner commented Jul 2, 2020

Describe the feature:

There are a couple of TODOs in the EPM template generation (both index template and component template) code to handle any errors returned from ES

here:

and here:

One solution would be to just wrap them in a try/catch and throw a Boom. This may cause installation of the rest of the required packages to fail though.

@jonathan-buttner jonathan-buttner added Feature:EPM Fleet team's Elastic Package Manager (aka Integrations) project Team:Fleet Team label for Observability Data Collection Fleet team Feature:Ingest Management labels Jul 2, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/ingest-management (Feature:EPM)

@skh
Copy link
Contributor

skh commented Jul 8, 2020

Strategy for error handling is here: #66688

In particular, we've been advised to move away from Boom.

@ph
Copy link
Contributor

ph commented Oct 19, 2020

Could this be closed @skh @jfsiii @neptunian ?

@jfsiii
Copy link
Contributor

jfsiii commented Oct 19, 2020

@ph, @jonathan-buttner knows best what this is about but we are able to identify an ES error and include the reason in the HTTP response. See #76865

@skh
Copy link
Contributor

skh commented Oct 26, 2020

The TODOs in that file are still there (moved to different lines now), marking code paths where return values need to be checked.

We should at least check if the corresponding errors can be triggered in tests, and add tests to verify the current error handling is ok.

@jonathan-buttner
Copy link
Contributor Author

Yeah this ticket was just to track some of the TODOs in EPM. I agree with @skh, it'd probably be good to introduce some errors in the tests and see if we can handle the errors.

@jfsiii
Copy link
Contributor

jfsiii commented Oct 27, 2020

@skh @jonathan-buttner I updated the description to point to the new lines. Both of them are deal with communicating with Elasticsearch (callCluster). Can you help define what error behavior we want to assert?

The two things that come to mind are

  • a) any errors from ES are thrown by these functions
  • b) the errors result in specific HTTP failure status/response

Are there specific ES errors we want to test? Should there be different behavior for different errors beyond the HTTP status/response?

For (a) I see the testing as

  • mock callCluster to throw an error (or specific errors)
  • call installDataStreamComponentTemplates & installTemplate
  • ensure they throw the given ES error(s)?

(b) is more challenging since installTemplate is one of several other functions called by installPackage, which is called by installPackageFromRegistry & installPackageByUpload. The installPackage* functions are called as a part of /setup & /epm/package. That's a lot of functions and side-effects.

Perhaps we could assert that given (a) the error given to defaultIngestErrorHandler (or perhaps other specific route handlers) results in the desired status & message?

@ph ph unassigned skh Feb 15, 2021
@jen-huang jen-huang changed the title [EPM] Handle ES failures on template installation [Fleet] Handle ES failures on template installation Apr 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:EPM Fleet team's Elastic Package Manager (aka Integrations) project research Team:Fleet Team label for Observability Data Collection Fleet team
Projects
None yet
Development

No branches or pull requests

6 participants