-
Notifications
You must be signed in to change notification settings - Fork 42
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
merge into existing target, new tests and DRYing #69
base: main
Are you sure you want to change the base?
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 |
---|---|---|
|
@@ -411,8 +411,10 @@ def filter(event) | |
return if kv.empty? | ||
|
||
if @target | ||
@logger.debug? && @logger.debug("Overwriting existing target field", :target => @target) | ||
event.set(@target, kv) | ||
@logger.debug? && @logger.debug("Merging into existing target field", :target => @target) | ||
t = event.get(@target) | ||
t = {} unless t.is_a?(Hash) | ||
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. Consider that if I think this is a very uncommon edge case that can be covered by updating the docs to advise the user, that if they want to keep the value at 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, that was my reasoning: if |
||
event.set(@target, t.merge(kv)) | ||
else | ||
kv.each{|k, v| event.set(k, v)} | ||
end | ||
|
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.
If you fancy, removing this line should satisfy #11 too.
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.
good point. my concern is with BWC but we could make this a major version bump in that respect and have better consistency in the plugin behaviour.