-
Notifications
You must be signed in to change notification settings - Fork 25.3k
Allow pipeline processor to ignore missing pipelines #87354
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
Changes from all commits
3f3b70e
7256823
0268b50
5aa72db
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
pr: 87354 | ||
summary: Allow pipeline processor to ignore missing pipelines | ||
area: Ingest | ||
type: enhancement | ||
issues: [] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,11 +18,19 @@ public class PipelineProcessor extends AbstractProcessor { | |
public static final String TYPE = "pipeline"; | ||
|
||
private final TemplateScript.Factory pipelineTemplate; | ||
private final boolean ignoreMissingPipeline; | ||
private final IngestService ingestService; | ||
|
||
PipelineProcessor(String tag, String description, TemplateScript.Factory pipelineTemplate, IngestService ingestService) { | ||
PipelineProcessor( | ||
String tag, | ||
String description, | ||
TemplateScript.Factory pipelineTemplate, | ||
boolean ignoreMissingPipeline, | ||
IngestService ingestService | ||
) { | ||
super(tag, description); | ||
this.pipelineTemplate = pipelineTemplate; | ||
this.ignoreMissingPipeline = ignoreMissingPipeline; | ||
this.ingestService = ingestService; | ||
} | ||
|
||
|
@@ -33,10 +41,14 @@ public void execute(IngestDocument ingestDocument, BiConsumer<IngestDocument, Ex | |
if (pipeline != null) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From a performance aspect the This path will get executed a lot if this feature is used in all Fleet data stream pipelines. I just wanted to confirm that lookup failures are not particularly expensive 😄 (like lazy loading on lookup failure). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes, this method performs a map lookup. I don't think this map lookup will be noticeable during indexing (many other operations occur during indexing, so I don't think this will be visible). |
||
ingestDocument.executePipeline(pipeline, handler); | ||
} else { | ||
handler.accept( | ||
null, | ||
new IllegalStateException("Pipeline processor configured for non-existent pipeline [" + pipelineName + ']') | ||
); | ||
if (ignoreMissingPipeline) { | ||
handler.accept(ingestDocument, null); | ||
} else { | ||
handler.accept( | ||
null, | ||
new IllegalStateException("Pipeline processor configured for non-existent pipeline [" + pipelineName + ']') | ||
); | ||
} | ||
} | ||
} | ||
|
||
|
@@ -85,7 +97,14 @@ public PipelineProcessor create( | |
"name", | ||
ingestService.getScriptService() | ||
); | ||
return new PipelineProcessor(processorTag, description, pipelineTemplate, ingestService); | ||
boolean ignoreMissingPipeline = ConfigurationUtils.readBooleanProperty( | ||
TYPE, | ||
processorTag, | ||
config, | ||
"ignore_missing_pipeline", | ||
false | ||
); | ||
return new PipelineProcessor(processorTag, description, pipelineTemplate, ignoreMissingPipeline, ingestService); | ||
} | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.