8000 fix account id by notshivansh · Pull Request #2762 · akto-api-security/akto · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged
merged 1 commit into from
Jul 4, 2025
Merged

Conversation

notshivansh
Copy link
Contributor

No description provided.

@Copilot Copilot AI review requested due to automatic review settings July 4, 2025 12:08
@notshivansh notshivansh merged commit b43eea7 into feature/mini-runtime-release Jul 4, 2025
3 checks passed
Copy link
Contributor
@Copilot Copilot AI left a 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 that Main.actualAccountId always provides the correct value and that no behavior regression is introduced.
            int accountId = Main.actualAccountId;

Comment on lines +1318 to +1321
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);
8000 Copy link
Preview
Copilot AI Jul 4, 2025

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.

Comment on lines 365 to +368
public void syncTrafficMetricsWithDBHelper() {
List<BulkUpdates> bulkUpdates = new ArrayList<>();
BasicDBObject metricsData = new BasicDBObject();
int accountId = Context.accountId.get();
int accountId = Main.actualAccountId;
Copy link
Preview
Copilot AI Jul 4, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0