-
Notifications
You must be signed in to change notification settings - Fork 13
Support terminate processor. #345
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
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 |
---|---|---|
|
@@ -1134,6 +1134,35 @@ def path; @path; end | |
# end | ||
end | ||
|
||
describe 'with terminate processor' do | ||
let(:pipeline_processor) { | ||
'{ | ||
"terminate": { | ||
"if": "ctx.error != null", | ||
"tag": "terminated_ingest_pipeline" | ||
} | ||
}, | ||
{ | ||
"append": { | ||
"field": "append_field", | ||
"value": ["integration", "test"] | ||
} | ||
}' | ||
} | ||
|
||
it 'terminates the ingest pipeline' do | ||
events = [LogStash::Event.new( | ||
"message" => "Send message to pipeline which gets terminated.", | ||
"error" => "This is intentionally placed error.", | ||
"data_stream" => data_stream)] | ||
|
||
subject.multi_filter(events).each do |event| | ||
expect(event.get("[@metadata][target_ingest_pipeline]")).to include("_none") | ||
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. Can you help me understand what exactly this assertion proves WRT the termination? Looks like with 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. After plugin successfully executes the pipeline, it let's know (set the
Yeah, this one I tried to highlight here that
In the result, we can see
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. Thanks! That is very helpful. Love that idea! |
||
# intentionally placed append processor to check if it is not executed after terminate processor | ||
expect(event.get("append_field")).to be_nil | ||
end | ||
end | ||
end | ||
end | ||
|
||
context '#multi-pipeline execution' do | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -122,6 +122,7 @@ public EventProcessorBuilder() { | |
org.elasticsearch.ingest.common.SetProcessor.TYPE, | ||
org.elasticsearch.ingest.common.SortProcessor.TYPE, | ||
org.elasticsearch.ingest.common.SplitProcessor.TYPE, | ||
"terminate", // note: upstream constant is package-private | ||
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.
|
||
org.elasticsearch.ingest.common.TrimProcessor.TYPE, | ||
org.elasticsearch.ingest.common.URLDecodeProcessor.TYPE, | ||
org.elasticsearch.ingest.common.UppercaseProcessor.TYPE, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wished this tag be available in
_ingest_document
so that I canexpect(event.get("[tag]")).to eql? "terminated_ingest_pipeline"
but no tag exists.