-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Fix NPE when date_buckets aggregation is missing in the response
#128974
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
|
Pinging @elastic/ml-core (Team:ML) |
davidkyle
left a comment
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
| List<? extends Histogram.Bucket> buckets = ((Histogram) response.getAggregations().get(DATE_BUCKETS)).getBuckets(); | ||
| Histogram histogram = searchResponse.getAggregations().get(DATE_BUCKETS); | ||
| if (histogram == null) { | ||
| logger.debug( |
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 expect this to be a rare occurrence so let's log it at a higher level. Also we want to know if the delayed detector is not working
| logger.debug( | |
| logger.warn( |
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.
Just double-checking: If we log at WARN, we shouldn't include full request/response bodies, should we?
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.
hmm probably not, we know what the request is anyway as it's fixed in code.
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.
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.
On a second thought, I added logging of "search response" because if the agg is missing, the response is never big and we can get more useful info this way.
...n/java/org/elasticsearch/xpack/ml/datafeed/delayeddatacheck/DatafeedDelayedDataDetector.java
Outdated
Show resolved
Hide resolved
|
Hi @przemekwitek, I've created a changelog YAML for you. |
|
run elasticsearch-ci/part-2 |
davidkyle
left a comment
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 thanks for making the changes
💔 Backport failedYou can use sqren/backport to manually backport by running |
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation |
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation |
This PR fixes NPE thrown by the
DatafeedDelayedDataDetector.checkCurrentBucketEventCountmethod when thedate_bucketsaggregation is missing in the response.