-
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
Adds the EventKey and EventKeyFactory. #4627
Conversation
Signed-off-by: David Venable <[email protected]>
* | ||
* @since 2.9 | ||
*/ | ||
enum EventAction { |
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.
What kind of benefit do we get from this? If I have a key that is for reading and give it ALL, is the downside that the processor could unintentionally write to the key?
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 wasn't originally planning on adding this. But, I realized that we have different validations for PUT/DELETE than we do for GET. Namely, we don't support an empty string for PUT/DELETE. So the primary advantage is to check that the key is valid for the operation when getting the key, rather than waiting until we process it on an event.
…tAction is supported once. Signed-off-by: David Venable <[email protected]>
I created a small performance evaluation using Pipeline:
Running for about 3 minutes, I found the old approach took about 45% of the CPU time and the new approach took 21% of CPU time. The flame graph is available here: Code reference: |
Description
This PR adds an
EventKey
model for accessing data within theEvent
model. This allows for faster validations and for caching internal details between calls.Some significant changes:
Event
that require a key to also use theEventKey
.JacksonEvent
that use theString
key to create anEventKey
and call that.JacksonEventKey
implementation which works withJacksonEvent
.JacksonEvent
intoJacksonEventKey
to consolidate them.EventAction
to perform validations at creation time. This way, plugins can validate keys for the action they will take.EventKeyFactory
usable to the@DataPrepperPluginConstructor
constructors.TestEventKeyFactory
and consolidates some code with the existingTestEventFactory
ProcessorPipelineIT
.See #4628 for an example of usage.
Issues Resolved
Resolves #1916.
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.