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

Introduce on_failure_pipeline ingest metadata inside on_failure block #49076

Merged
merged 7 commits into from
Nov 26, 2019

Conversation

martijnvg
Copy link
Member

In case an exception occurs inside a pipeline processor,
the pipeline stack is kept around as header in the exception.
Then in the on_failure processor the id of the pipeline the
exception occurred is made accessible via the on_failure_pipeline
ingest metadata.

Closes #44920

In case an exception occurs inside a pipeline processor,
the pipeline stack is kept around as header in the exception.
Then in the on_failure processor the id of the pipeline the
exception occurred is made accessible via the `on_failure_pipeline`
ingest metadata.

Closes elastic#44920
@martijnvg martijnvg added >enhancement :Data Management/Ingest Node Execution or management of Ingest Pipelines including GeoIP v8.0.0 v7.6.0 labels Nov 14, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-features (:Core/Features/Ingest)

@jakelandis jakelandis requested a review from andreidan November 21, 2019 15:40
Copy link
Contributor

@andreidan andreidan left a comment

Choose a reason for hiding this comment

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

This generally looks good. I've got a few minor suggestions and a question. Thanks @martijnvg

@@ -279,6 +282,41 @@ public void testBreakOnFailure() throws Exception {
assertStats(pipeline, 1, 1, 0);
}

public void testFailurePipelineField() {
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick would it make sense to rename this to what it tests? eg testFailureProcessorIsInvokedOnFailure

}

private ElasticsearchException newCompoundProcessorException(Exception e, String processorType, String processorTag) {
private ElasticsearchException newCompoundProcessorException(Exception e, Processor processor, IngestDocument document) {
Copy link
Contributor

Choose a reason for hiding this comment

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

should we make this package accessible and add some tests?

Copy link
Member Author

Choose a reason for hiding this comment

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

I've added test for this method: 0772a99

if (processorTag != null) {
exception.addHeader("processor_tag", processorTag);
}
List<String> pipelineStack = document.getPipelineStack();
if (pipelineStack.size() > 1) {
exception.addHeader("pipeline_origin", pipelineStack);
Copy link
Contributor

Choose a reason for hiding this comment

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

is the reason we are providing a stack here because we can't pin point which pipeline in the stack failed? I might be off here but would it make sense to pass the pipeline id to the handlers and report the exact pipeline that failed? https://github.com/elastic/elasticsearch/pull/49076/files#diff-197c33567939d6a2a4f637dda45b72dcR652

Copy link
Member Author

Choose a reason for hiding this comment

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

The reason is because there may be several levels of nested pipeline processors and then it is not clear if we just report the pipeline name that has failed. A pipeline may be used multiple times from the same initial pipeline. Having a stack here, really pin points to the pipeline and how it executed to that point.

@martijnvg martijnvg requested a review from andreidan November 25, 2019 05:38
@martijnvg
Copy link
Member Author

@elasticmachine update branch

@martijnvg
Copy link
Member Author

@elasticmachine update branch

Copy link
Contributor

@andreidan andreidan left a comment

Choose a reason for hiding this comment

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

LGTM thanks for iterating on this Martijn

@martijnvg
Copy link
Member Author

Thanks for reviewing @andreidan.

@martijnvg martijnvg merged commit 2ba00c8 into elastic:master Nov 26, 2019
martijnvg added a commit to martijnvg/elasticsearch that referenced this pull request Nov 26, 2019
…elastic#49076)

In case an exception occurs inside a pipeline processor,
the pipeline stack is kept around as header in the exception.
Then in the on_failure processor the id of the pipeline the
exception occurred is made accessible via the `on_failure_pipeline`
ingest metadata.

Closes elastic#44920
martijnvg added a commit that referenced this pull request Nov 27, 2019
…lure block (#49596)

Backport of #49076

In case an exception occurs inside a pipeline processor,
the pipeline stack is kept around as header in the exception.
Then in the on_failure processor the id of the pipeline the
exception occurred is made accessible via the `on_failure_pipeline`
ingest metadata.

Closes #44920
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Data Management/Ingest Node Execution or management of Ingest Pipelines including GeoIP >enhancement v7.6.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add origin pipeline name to on_failure processor metadata
4 participants