Skip to content

Commit

Permalink
Fix pipeline id not present in ingest metadata inside on_failure block (
Browse files Browse the repository at this point in the history
#89632) (#89736)

This commit fixes an issue where inside of an `on_failure` block the
`_ingest.on_failure_pipeline` metadata was not being propagated. The
root cause seems to be an off-by-one error where we were checking for at
least two pipelines, when we should be checking for only a minimum of a
single pipeline that has been executed before adding the metadata.
  • Loading branch information
dakrone committed Aug 30, 2022
1 parent 6c0e6d9 commit 3cd30bd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions docs/changelog/89632.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 89632
summary: Fix pipeline id not present in ingest metadata inside `on_failure` block
area: Ingest Node
type: bug
issues: []
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ static IngestProcessorException newCompoundProcessorException(Exception e, Proce
}
if (document != null) {
List<String> pipelineStack = document.getPipelineStack();
if (pipelineStack.size() > 1) {
if (pipelineStack.isEmpty() == false) {
exception.addHeader("pipeline_origin", pipelineStack);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ public void testExecuteVerboseItemWithOnFailure() throws Exception {
metadata.put(CompoundProcessor.ON_FAILURE_PROCESSOR_TYPE_FIELD, "mock");
metadata.put(CompoundProcessor.ON_FAILURE_PROCESSOR_TAG_FIELD, "processor_0");
metadata.put(CompoundProcessor.ON_FAILURE_MESSAGE_FIELD, "processor failed");
metadata.put(CompoundProcessor.ON_FAILURE_PIPELINE_FIELD, "_id");
assertVerboseResult(
simulateDocumentVerboseResult.getProcessorResults().get(1),
pipeline.getId(),
Expand Down

0 comments on commit 3cd30bd

Please sign in to comment.