-
Notifications
You must be signed in to change notification settings - Fork 207
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
Drop processor #801
Drop processor #801
Conversation
Signed-off-by: David Powers <[email protected]>
Signed-off-by: David Powers <[email protected]>
Signed-off-by: David Powers <[email protected]>
Signed-off-by: David Powers <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #801 +/- ##
============================================
+ Coverage 91.53% 91.64% +0.10%
- Complexity 637 640 +3
============================================
Files 75 75
Lines 1902 1902
Branches 161 161
============================================
+ Hits 1741 1743 +2
Misses 121 121
+ Partials 40 38 -2
Continue to review full report at Codecov.
|
@@ -0,0 +1,29 @@ | |||
/* |
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.
This is not the correct copyright header (unless you copied this source code from another project).
It should be:
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
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.
Done
@@ -0,0 +1,59 @@ | |||
/* |
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.
Incorrect copyright header - see message above.
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.
Done
@@ -0,0 +1,49 @@ | |||
package com.amazon.dataprepper.plugins.processor.drop; |
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.
Please add copyright header.
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.
Done
import java.util.LinkedList; | ||
import java.util.List; | ||
|
||
@SingleThread |
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.
This processor does not need the @SingleThread
annotation.
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.
Removed
|
||
@Override | ||
public Collection<Record<Event>> doExecute(Collection<Record<Event>> records) { | ||
List<Record<Event>> emptySet = new LinkedList<>(); |
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.
You can return Collections.emptyList()
here instead.
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.
Done
|
||
final List<Record<Event>> droppedRecords = (List<Record<Event>>) dropProcessor.doExecute(Collections.singletonList(record)); | ||
|
||
Assert.assertEquals(0, droppedRecords.size()); |
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.
Please use Hamcrest:
assertThat(droppedRecords.size(), equalTo(0));
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.
Changed to Hamcrest
private final String PLUGIN_NAME = "drop_events"; | ||
|
||
@Test | ||
void doExecute() { |
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.
It would be good to have a test which also has more than one item in the input list.
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.
Added the second test
settings.gradle
Outdated
@@ -31,6 +31,7 @@ include 'data-prepper-plugins:otel-trace-source' | |||
include 'data-prepper-plugins:peer-forwarder' | |||
include 'data-prepper-plugins:blocking-buffer' | |||
include 'data-prepper-plugins:http-source' | |||
include 'data-prepper-plugins:drop-processor' |
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 think we should try to keep the names consistent. You named the plugin drop_events
. So, I think this project should be drop-events-processor
.
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.
Renamed to drop-events-processor
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.
Let's document this plugin with a README.md file.
Signed-off-by: David Powers <[email protected]>
...or/src/test/java/com/amazon/dataprepper/plugins/processor/drop/DropEventsProcessorTests.java
Outdated
Show resolved
Hide resolved
...or/src/test/java/com/amazon/dataprepper/plugins/processor/drop/DropEventsProcessorTests.java
Show resolved
Hide resolved
...or/src/test/java/com/amazon/dataprepper/plugins/processor/drop/DropEventsProcessorTests.java
Outdated
Show resolved
Hide resolved
...or/src/test/java/com/amazon/dataprepper/plugins/processor/drop/DropEventsProcessorTests.java
Outdated
Show resolved
Hide resolved
...or/src/test/java/com/amazon/dataprepper/plugins/processor/drop/DropEventsProcessorTests.java
Show resolved
Hide resolved
...or/src/test/java/com/amazon/dataprepper/plugins/processor/drop/DropEventsProcessorTests.java
Show resolved
Hide resolved
Signed-off-by: David Powers <[email protected]>
Description
This creates a Drop Processor to drop messages
Issues Resolved
#598
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.