diff --git a/apps/api-runtime/src/main/java/com/akto/dependency/DependencyAnalyser.java b/apps/api-runtime/src/main/java/com/akto/dependency/DependencyAnalyser.java index ef132770f6..3b6940c571 100644 --- a/apps/api-runtime/src/main/java/com/akto/dependency/DependencyAnalyser.java +++ b/apps/api-runtime/src/main/java/com/akto/dependency/DependencyAnalyser.java @@ -22,6 +22,8 @@ import com.mongodb.client.model.*; import org.bson.Document; import org.bson.conversions.Bson; +import com.akto.log.LoggerMaker; +import com.akto.log.LoggerMaker.LogDb; import java.util.*; @@ -31,6 +33,7 @@ public class DependencyAnalyser { Store valueStore; // this is to store all the values seen in response payload Store urlValueStore; // this is to store all the url$value seen in response payload Store urlParamValueStore; // this is to store all the url$param$value seen in response payload + private static final LoggerMaker loggerMaker = new LoggerMaker(DependencyAnalyser.class, LogDb.RUNTIME); Map> urlsToResponseParam = new HashMap<>(); @@ -354,10 +357,12 @@ public void mergeNodes() { } public void syncWithDb() { + loggerMaker.infoAndAddToDb("Syncing dependency analyser nodes"); ArrayList> bulkUpdates1 = new ArrayList<>(); ArrayList> bulkUpdates2 = new ArrayList<>(); ArrayList> bulkUpdates3 = new ArrayList<>(); + loggerMaker.infoAndAddToDb("dependency analyser nodes size: " + nodes.size()); mergeNodes(); for (DependencyNode dependencyNode: nodes.values()) { @@ -449,6 +454,10 @@ filter3, update3, new UpdateOptions().upsert(false) } } + loggerMaker.infoAndAddToDb("dependency analyser bulkUpdates1 size: " + bulkUpdates1.size()); + loggerMaker.infoAndAddToDb("dependency analyser bulkUpdates2 size: " + bulkUpdates2.size()); + loggerMaker.infoAndAddToDb("dependency analyser bulkUpdates3 size: " + bulkUpdates3.size()); + // ordered has to be true or else won't work if (bulkUpdates1.size() > 0) DependencyNodeDao.instance.getMCollection().bulkWrite(bulkUpdates1, new BulkWriteOptions().ordered(false)); if (bulkUpdates2.size() > 0) DependencyNodeDao.instance.getMCollection().bulkWrite(bulkUpdates2, new BulkWriteOptions().ordered(false)); diff --git a/apps/mini-runtime/src/main/java/com/akto/hybrid_dependency/DependencyAnalyser.java b/apps/mini-runtime/src/main/java/com/akto/hybrid_dependency/DependencyAnalyser.java index 7783d3ce46..4bf7c5c8a7 100644 --- a/apps/mini-runtime/src/main/java/com/akto/hybrid_dependency/DependencyAnalyser.java +++ b/apps/mini-runtime/src/main/java/com/akto/hybrid_dependency/DependencyAnalyser.java @@ -13,6 +13,7 @@ import com.akto.hybrid_runtime.APICatalogSync; import com.akto.hybrid_runtime.URLAggregator; import com.akto.hybrid_runtime.policies.AuthPolicy; +import com.akto.log.LoggerMaker; import com.akto.util.HTTPHeadersExample; import com.akto.util.JSONUtils; import com.google.common.base.Charsets; @@ -31,6 +32,7 @@ public class DependencyAnalyser { Store valueStore; // this is to store all the values seen in response payload Store urlValueStore; // this is to store all the url$value seen in response payload Store urlParamValueStore; // this is to store all the url$param$value seen in response payload + private static final LoggerMaker loggerMaker = new LoggerMaker(DependencyAnalyser.class, LoggerMaker.LogDb.RUNTIME); Map> urlsToResponseParam = new HashMap<>(); @@ -343,10 +345,12 @@ public void mergeNodes() { } public void syncWithDb() { + loggerMaker.infoAndAddToDb("Syncing dependency analyser nodes"); ArrayList> bulkUpdates1 = new ArrayList<>(); ArrayList> bulkUpdates2 = new ArrayList<>(); ArrayList> bulkUpdates3 = new ArrayList<>(); + loggerMaker.infoAndAddToDb("dependency analyser nodes size: " + nodes.size()); mergeNodes(); for (DependencyNode dependencyNode: nodes.values()) { @@ -439,8 +443,10 @@ filter3, update3, new UpdateOptions().upsert(false) } // ordered has to be true or else won't work - + loggerMaker.infoAndAddToDb("dependency analyser bulkUpdates1 size: " + bulkUpdates1.size()); + loggerMaker.infoAndAddToDb("dependency analyser bulkUpdates2 size: " + bulkUpdates2.size()); + loggerMaker.infoAndAddToDb("dependency analyser bulkUpdates3 size: " + bulkUpdates3.size()); if (bulkUpdates1.size() > 0) DependencyNodeDao.instance.getMCollection().bulkWrite(bulkUpdates1, new BulkWriteOptions().ordered(false));