nickwallen commented on a change in pull request #1269: METRON-1879 Allow
Elasticsearch to Auto-Generate the Document ID
URL: https://github.com/apache/metron/pull/1269#discussion_r240813632
##########
File path:
metron-platform/metron-indexing/src/main/java/org/apache/metron/indexing/dao/MultiIndexDao.java
##########
@@ -145,18 +164,30 @@ public Document
removeCommentFromAlert(CommentAddRemoveRequest request) throws I
*/
@Override
public Document removeCommentFromAlert(CommentAddRemoveRequest request,
Document latest) throws IOException {
- List<DocumentContainer> output =
- indices.parallelStream().map(dao -> {
- try {
- return new
DocumentContainer(dao.removeCommentFromAlert(request, latest));
- } catch (Throwable e) {
- return new DocumentContainer(e);
- }
- }).collect(Collectors.toList());
-
+ List<DocumentContainer> output = indices
+ .parallelStream()
+ .map(dao -> removeCommentFromAlert(dao, request, latest))
+ .collect(Collectors.toList());
return getLatestDocument(output);
}
+ private DocumentContainer removeCommentFromAlert(IndexDao indexDao,
CommentAddRemoveRequest request, Document latest) {
+ DocumentContainer container;
+ try {
+ Document document = indexDao.removeCommentFromAlert(request, latest);
+ container = new DocumentContainer(document);
+ LOG.debug("Removed comment from alert; indexDao={}, guid={},
sensorType={}, document={}",
+ ClassUtils.getShortClassName(indexDao.getClass()),
document.getGuid(), document.getSensorType(), document);
+
+ } catch (Throwable e) {
+ container = new DocumentContainer(e);
+ LOG.error("Unable to remove comment from alert; indexDao={}, error={}",
Review comment:
We had no logging to indicate when a particular IndexDao fails. I ran into
this and it took some effort to trace since we lacked logging.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services