-
Notifications
You must be signed in to change notification settings - Fork 306
Raise logging level for 'invalid_index_name_exception' ES exceptions to ERROR #771
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
Conversation
This new |
Test failures on 3a848c8 with older versions of ES answered my question about guarding for |
I could not repro the nil exceptions as they happened in Travis. Tried with ES 1.7, 2.4, 5.6 and 6.2.4 LOL (all those that failed). This small method is pretty easy to test and doesn't require much setup. @jsvd Quick question. There's a |
I don't think you are, we can see in the java code for the DLQ writer that we expect two objects as arguments, but quickly those get coerced into a LogStash::Event and a string |
# To support bwc, we check if DLQ exists. otherwise we log and drop event (previous behavior) | ||
if @dlq_writer | ||
# TODO: Change this to send a map with { :status => status, :action => action } in the future | ||
@dlq_writer.write(action[2], "#{message} status: #{status}, action: #{action}, response: #{response}") |
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'm not a huge fan of this "report_doc_level_error" to be writing data to the DLQ. Maybe we can have this method only take care of the else
case in this if, where the DLQ isn't available.
Another alternative is to call this method something like handle_doc_level_error
. the word "handle" works for everything, yay
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.
Yes, handle_
is a better name
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.
Actually this method is specifically for statuses that are candidates for the DLQ. I'll go even further and rename it to handle_dlq_status
. It logs if DLQ is not enabled, and it sends to DLQ if it's enabled.
Ah, I had missed the PluginDeadLetterQueueWriter class sitting in the middle. Now it makes sense 😂 |
We should be good to go for PR, as of commit 5c074c1. Version bump is done, I've noticed a few things while working on this, and I've created follow-up issue #772 to handle them. |
# TODO: Change this to send a map with { :status => status, :action => action } in the future | ||
@dlq_writer.write(action[2], "#{message} status: #{status}, action: #{action}, response: #{response}") | ||
else | ||
error_type = response['index'] && response['index']['error'] && response['index']['error']['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.
We can do response.fetch('index', {}).fetch('error', {}).get('type')
instead.
Ok @jsvd All tests are passing now. I'd like to merge tomorrow if there's nothing else. Thanks for the terser syntax for digging into nested hashes :-) |
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.
LGTM (please squash the commits)
3c1f97b
to
2be7d9b
Compare
2be7d9b
to
9e73149
Compare
As discussed in #759, an invalid index exception should log at the ERROR level.
Presumably, most of these will happen just after an update to a user's Logstash
configuration.
Still missing in this PR
Questions
dlq_writer.write
already support(event, reason, params_hash)
?response['index']
andresponse['index']['error']
guaranteed to be set, or should I guard against anything in there being nil?
I would posit that making the list of exceptions that are elevated to ERROR is
out of scope for this. We could release this as is, and if there's interest we
make it configurable later on.
Generate an
invalid_index_name_exception
withGenerate another ES exception (mapping) with
closes #759