Skip to content

Commit

Permalink
Merge pull request #1900 from akto-api-security/logs/add_debug_logs_g…
Browse files Browse the repository at this point in the history
…roups

Added more debug logs
  • Loading branch information
notshivansh authored Jan 2, 2025
2 parents 0874637 + 393d0ee commit b2f041a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion libs/dao/src/main/java/com/akto/dto/ApiCollectionUsers.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ private static void operationForCollectionId(List<TestingEndpoints> conditions,
}

public static void addToCollectionsForCollectionId(List<TestingEndpoints> conditions, int apiCollectionId) {
logger.info("Started adding apis for in addToCollectionsForCollectionId: " + apiCollectionId);
Bson update = Updates.addToSet(SingleTypeInfo._COLLECTION_IDS, apiCollectionId);
Bson matchFilter = Filters.nin(SingleTypeInfo._COLLECTION_IDS, apiCollectionId);
operationForCollectionId(conditions, apiCollectionId, update, matchFilter, false);
Expand Down Expand Up @@ -232,6 +233,9 @@ public void run() {
MCollection<?>[] collections = collectionsEntry.getValue();
Bson filter = filtersMap.get(type);

// printing filter size
long val = filter.toString().length();
logger.info("Size of the filter in updateCollectionsForCollectionId is: " + val + "Bytes");
updateCollections(collections, filter, update);
}

Expand All @@ -241,7 +245,10 @@ public void run() {

private static void updateCollections(MCollection<?>[] collections, Bson filter, Bson update) {
for (MCollection<?> collection : collections) {
collection.getMCollection().updateMany(filter, update);
UpdateResult res = collection.getMCollection().updateMany(filter, update);
logger.info(String.format(
"mongo update results for updating collection groups are: {matchedCount : %d} {modifiedCount : %d} {collection: %s}",
res.getMatchedCount(), res.getModifiedCount(), collection.getCollName()));
}
}

Expand Down

0 comments on commit b2f041a

Please sign in to comment.