-
Notifications
You must be signed in to change notification settings - Fork 262
use malicious event dao in main threat queries #3298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
KafkaConfig kafkaConfig, MaliciousEventDao maliciousEventDao) { | ||
this.kafka = new Kafka(kafkaConfig); | ||
this.mongoClient = mongoClient; | ||
this.maliciousEventDao = maliciousEventDao; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need the Dao as a variable now ? We should directly use MaliciousEventsDao.instance.. ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as discussed keeping this
|
||
MaliciousEventService maliciousEventService = | ||
new MaliciousEventService(internalKafkaConfig, threatProtectionMongo); | ||
new MaliciousEventService(internalKafkaConfig, MaliciousEventDao.instance); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same why create dependency ? we can directly use MaliciousEventDao.instance ?
MongoCollection<Document> coll = database.getCollection(MongoDBCollection.ThreatDetection.MALICIOUS_EVENTS, Document.class); | ||
public static void createIndexIfAbsent(String accountId, MaliciousEventDao maliciousEventDao) { | ||
// Get the collection from DAO - this will create the collection if it doesn't exist | ||
MongoCollection<?> collection = maliciousEventDao.getCollection(accountId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dao.Instance
create indices for api_distirbution_data as well.
return super.getCollection(accountId); | ||
} | ||
|
||
public AggregateIterable<Document> aggregateRaw(String accountId, List<Document> pipeline) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simly MaliciosDao.instance.aggregate won't work ?
long modifiedCount = coll.updateMany(query, update).getModifiedCount(); | ||
|
||
long modifiedCount = maliciousEventDao.getCollection(accountId).updateMany(query, update).getModifiedCount(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With Dao it should directly be Dao.instance.updateMany ???
.setDetectedAt(event.getDetectedAt()) | ||
.setSubCategory(event.getFilterId()) | ||
.setSeverity(event.getSeverity()) | ||
.setMethod(event.getLatestApiMethod().name()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check if latestApiMethod is an enum ? .name needed ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please check
No description provided.