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

migrationsv2: handle 413 errors and log the request details for unexpected ES failures #108213

Merged
merged 7 commits into from
Aug 13, 2021

Conversation

rudolf
Copy link
Contributor

@rudolf rudolf commented Aug 11, 2021

Summary

Fixes #107288

This doesn't fix the problem that a too large batch size causes migrations to fail, it only provides a log message with instructions that users can act on to fix the problem. Although long term I think we should be more dynamic and automatically adjust the batch size lower, we've only had such a large request payload fail migrations on a single cluster.

I didn't add release notes since we're not really addressing the problem.

Checklist

Delete any items that are not applicable to this PR.

Risk Matrix

Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.

Risk Probability Severity Mitigation/Notes
Regression in Elasticsearch service debug logging Low Low Good code coverage / integration tests

For maintainers

@rudolf rudolf changed the title Migrations logging migrationsv2: Log the request details for unexpected ES request failures and handle 413 errors Aug 12, 2021
@rudolf rudolf added Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v7.15.0 project:ResilientSavedObjectMigrations Reduce Kibana upgrade failures by making saved object migrations more resilient v7.14.1 labels Aug 12, 2021
@rudolf rudolf changed the title migrationsv2: Log the request details for unexpected ES request failures and handle 413 errors migrationsv2: handle 413 errors and log the request details for unexpected ES failures Aug 12, 2021
@rudolf rudolf added the bug Fixes for quality problems that affect the customer experience label Aug 12, 2021
@rudolf rudolf marked this pull request as ready for review August 12, 2021 11:17
@rudolf rudolf requested a review from a team as a code owner August 12, 2021 11:17
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-core (Team:Core)

@rudolf rudolf added release_note:fix release_note:skip Skip the PR/issue when compiling release notes and removed release_note:fix labels Aug 12, 2021
const req = getRequestDebugMeta(e.meta);
const failedRequestMessage = `Unexpected Elasticsearch ResponseError: statusCode: ${
req.statusCode
}, error: ${getErrorMessage(e)}, method: ${req.method}, url: ${req.url}`;
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we change the order to align with the error message in ES client: statusCode, method, URL, error message

"500
GET /foo?hello=dolly
{\\"seq_no_primary_term\\":true,\\"query\\":{\\"term\\":{\\"user\\":\\"kimchy\\"}}} [internal server error]: internal server error",
?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah good point, I initially included the body and because the body might easily be large enough to cause the log line to truncate I wanted to put the error in the front of the log line. But after I removed the body for security reasons it makes sense to keep the same order.

@rudolf
Copy link
Contributor Author

rudolf commented Aug 12, 2021

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

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

@rudolf rudolf merged commit ebdda25 into elastic:master Aug 13, 2021
@rudolf rudolf deleted the migrations-logging branch August 13, 2021 09:44
rudolf added a commit to rudolf/kibana that referenced this pull request Aug 16, 2021
…ected ES failures (elastic#108213)

* Log the failing request and response code when an action throws a response error

* Provide useful log message when migrations fail due to ES 413 Request Entity Too Large

* Don't log request body for unexpected ES request failures

* Fix types

* CR feedback: fix order of ES request debug log

Co-authored-by: Kibana Machine <[email protected]>
# Conflicts:
#	src/core/server/elasticsearch/client/configure_client.ts
#	src/core/server/elasticsearch/index.ts
rudolf added a commit that referenced this pull request Aug 16, 2021
…ected ES failures (#108213) (#108650)

* Log the failing request and response code when an action throws a response error

* Provide useful log message when migrations fail due to ES 413 Request Entity Too Large

* Don't log request body for unexpected ES request failures

* Fix types

* CR feedback: fix order of ES request debug log

Co-authored-by: Kibana Machine <[email protected]>

Co-authored-by: Kibana Machine <[email protected]>
rudolf added a commit that referenced this pull request Aug 16, 2021
…ected ES failures (#108213) (#108658)

* Log the failing request and response code when an action throws a response error

* Provide useful log message when migrations fail due to ES 413 Request Entity Too Large

* Don't log request body for unexpected ES request failures

* Fix types

* CR feedback: fix order of ES request debug log

Co-authored-by: Kibana Machine <[email protected]>
# Conflicts:
#	src/core/server/elasticsearch/client/configure_client.ts
#	src/core/server/elasticsearch/index.ts
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 project:ResilientSavedObjectMigrations Reduce Kibana upgrade failures by making saved object migrations more resilient release_note:skip Skip the PR/issue when compiling release notes Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v7.14.1 v7.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve logging for failed migrations
4 participants