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_r240813659
##########
File path:
metron-platform/metron-indexing/src/main/java/org/apache/metron/indexing/dao/MultiIndexDao.java
##########
@@ -117,18 +124,30 @@ public Document
addCommentToAlert(CommentAddRemoveRequest request) throws IOExce
*/
@Override
public Document addCommentToAlert(CommentAddRemoveRequest request, Document
latest) throws IOException {
- List<DocumentContainer> output =
- indices.parallelStream().map(dao -> {
- try {
- return new DocumentContainer(dao.addCommentToAlert(request,
latest));
- } catch (Throwable e) {
- return new DocumentContainer(e);
- }
- }).collect(Collectors.toList());
-
+ List<DocumentContainer> output = indices
+ .parallelStream()
+ .map(dao -> addCommentToAlert(dao, request, latest))
+ .collect(Collectors.toList());
return getLatestDocument(output);
}
+ private DocumentContainer addCommentToAlert(IndexDao indexDao,
CommentAddRemoveRequest request, Document latest) {
+ DocumentContainer container;
+ try {
+ Document document = indexDao.addCommentToAlert(request, latest);
+ container = new DocumentContainer(document);
+ LOG.debug("Added comment to 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 add comment to 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