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

[Ingest Manager] Improve server-side error handling #67278

Merged
merged 4 commits into from
May 27, 2020

Conversation

skh
Copy link
Contributor

@skh skh commented May 25, 2020

Summary

Minimal example implementation of #66688

How to test this

Mostly, read the linked issue, and read the changes in this PR. Do you agree with the approach?

To trigger the error case handled in this PR:

  • have an installation where Ingest Manager hasn't been set up (restarting yarn es snapshot does that).
  • set xpack.ingestManager.epm.registryUrl to a non-existing registry
  • start Kibana and login, with the browser dev tools network tab open
  • inspect the response to the call to /api/ingest_manager/setup
  • inspect the kibana log for the error message (grep / search for [ingestManager])

@botelastic botelastic bot added the Team:Fleet Team label for Observability Data Collection Fleet team label May 25, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/ingest-management (Team:Ingest Management)

@skh skh self-assigned this May 25, 2020
@skh skh added Ingest Management:beta1 release_note:skip Skip the PR/issue when compiling release notes release_note:enhancement v7.9.0 v8.0.0 and removed release_note:skip Skip the PR/issue when compiling release notes labels May 25, 2020
@skh skh marked this pull request as ready for review May 25, 2020 13:50
@skh skh requested a review from a team May 25, 2020 13:50
statusCode: getHTTPResponseCode(e),
body: { message: e.getMessage() },
});
}
if (e.isBoom) {
logger.error(e.output.payload.message);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This will be removed once we stop using Boom elsewhere. This handler is currently in an in-between state where it should capture both Boom and IngestManagerError errors

this.message = message;
}

public getType = (): IngestManagerErrorType => {
Copy link
Member

Choose a reason for hiding this comment

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

What do you think instead of relaying on type having all of our errors extending IngestManagerError

class RegistryError extends IngestManagerError {
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See #66688 (comment)

We can do that. We don't use that pattern (inheritance + instanceof) at the moment in ingest manager code, and I didn't want to introduce it when it isn't needed.

Copy link
Member

Choose a reason for hiding this comment

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

I think it's a really good pattern for Error (inheritance + instanceof) and we can keep the getStatusCode method so this stay an internal to this error module, curious to have other thoughts here, maybe @jfsiii?

But it's really personal preference for me.

Copy link
Contributor

Choose a reason for hiding this comment

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

sounds good to me

@skh skh requested a review from nchaulet May 25, 2020 15:12
@skh
Copy link
Contributor Author

skh commented May 26, 2020

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

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

@skh skh merged commit 9a241f3 into elastic:master May 27, 2020
@skh skh deleted the 66688-server-error-handling branch May 27, 2020 06:15
skh added a commit to skh/kibana that referenced this pull request May 27, 2020
* Use IngestManagerError instead of Boom errors.

* Extend Error and simplify.

* Add registry url to error messages.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
skh added a commit that referenced this pull request May 27, 2020
* Use IngestManagerError instead of Boom errors.

* Extend Error and simplify.

* Add registry url to error messages.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:enhancement Team:Fleet Team label for Observability Data Collection Fleet team v7.9.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants