-
Notifications
You must be signed in to change notification settings - Fork 251
fix account id #2762
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
fix account id #2762
Conversation
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.
Pull Request Overview
This PR improves error logging in ClientActor.fetchOrganization
and standardizes account ID retrieval in HttpCallParser
.
- Include exception objects in logging calls for better diagnostics.
- Replace dynamic context-based account ID resolution with a centralized static field (
Main.actualAccountId
).
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
libs/utils/src/main/java/com/akto/data_actor/ClientActor.java | Updated errorAndAddToDb calls to include the exception object and clarified messages. |
apps/mini-runtime/src/main/java/com/akto/hybrid_parsers/HttpCallParser.java | Removed Context.accountId and AccountSettings lookup in favor of Main.actualAccountId . |
Comments suppressed due to low confidence (2)
libs/utils/src/main/java/com/akto/data_actor/ClientActor.java:1318
- Verify that
errorAndAddToDb
supports an overload accepting(Exception, String, LogDb)
. If not, adjust the parameter order or add the appropriate overload to prevent compilation errors.
loggerMaker.errorAndAddToDb(e, "error extracting response in fetchOrganization " + e, LoggerMaker.LogDb.RUNTIME);
apps/mini-runtime/src/main/java/com/akto/hybrid_parsers/HttpCallParser.java:193
- The previous fallback logic using
AccountSettings.getId()
was removed. Confirm thatMain.actualAccountId
always provides the correct value and that no behavior regression is introduced.
int accountId = Main.actualAccountId;
loggerMaker.errorAndAddToDb(e, "error extracting response in fetchOrganization " + e, LoggerMaker.LogDb.RUNTIME); | ||
} | ||
} catch (Exception e) { | ||
loggerMaker.errorAndAddToDb("error in fetchOrganization" + e, LoggerMaker.LogDb.RUNTIME); | ||
loggerMaker.errorAndAddToDb(e, "error in fetchOrganization" + e, LoggerMaker.LogDb.RUNTIME); |
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.
[nitpick] The exception is concatenated into the message string twice (once implicitly by passing e
). Consider using a logging overload that separates the exception from the message to avoid redundant output.
Copilot uses AI. Check for mistakes.
public void syncTrafficMetricsWithDBHelper() { | ||
List<BulkUpdates> bulkUpdates = new ArrayList<>(); | ||
BasicDBObject metricsData = new BasicDBObject(); | ||
int accountId = Context.accountId.get(); | ||
int accountId = Main.actualAccountId; |
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.
[nitpick] Relying on a static global for accountId
can reduce testability and introduce threading concerns. Consider passing accountId
as a method parameter or using dependency injection instead.
Copilot uses AI. Check for mistakes.
No description provided.