Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
- Fix in info level logs about silent entities found and pipeline mongo performed (#872)
- Fix expandObject when post rule is using array of attributes (#866)
- Upgrade: mongodb dependency from 3.6.12 to 4.17.2
- Add PERSEO_MONGO_URI env var which overrides other mongo options
Expand Down
19 changes: 16 additions & 3 deletions lib/models/entitiesStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ function findSilentEntitiesByMongo(service, subservice, ruleData, alterFunc, cal
}
];

logger.debug(context, 'findSilentEntities service %s pipeline: %j ', service, pipeline);
logger.info(context, 'findSilentEntities service %s pipeline: %j ', service, pipeline);
var cursor = col.aggregate(pipeline);

cursor.toArray(function(err, results) {
Expand All @@ -253,14 +253,27 @@ function findSilentEntities(service, subservice, ruleData, alterFunc, callback)

var timedCallback = function(err, result, entityCount) {
var hrend = process.hrtime(hrstart);
var ids = [];

if (Array.isArray(result) && result.length > 0) {
ids = result
.map(function(e) {
return e && e._id ? e._id.id : undefined;
})
.filter(function(id) {
return id !== undefined && id !== null;
});
}

logger.info(
context,
' %s has found %d entities in (hr): %d ms result %j',
' %s has found %d entities in (hr): %d ms service=%s subservice=%s ids=%j',
method,
entityCount,
hrend[1] / 1000000,
result
service,
subservice,
ids
);

callback(err, result, entityCount);
Expand Down