Skip to content

Commit

Permalink
fix default value for IAST_SCAN_INSTANCE_COUNT
Browse files Browse the repository at this point in the history
  • Loading branch information
lovesh-ap committed Nov 6, 2024
1 parent 5826ac7 commit ecd14d7
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,13 @@ public long instantiate() throws RestrictionModeException {
// Set required LogLevel
logLevel = applyRequiredLogLevel();

if(NewRelic.getAgent().getConfig().getValue(IUtilConstants.IAST_SCAN_INSTANCE_COUNT) instanceof Integer) {
scanControllers.setScanInstanceCount(NewRelic.getAgent().getConfig().getValue(IUtilConstants.IAST_SCAN_INSTANCE_COUNT));
} else {
try {
scanControllers.setScanInstanceCount(NewRelic.getAgent().getConfig().getValue(IUtilConstants.IAST_SCAN_INSTANCE_COUNT, 0));
} catch (NumberFormatException | ClassCastException e){
logger.log(LogLevel.FINEST, String.format("Error while reading IAST_SCAN_INSTANCE_COUNT %s , setting to default", NewRelic.getAgent().getConfig().getValue(IUtilConstants.IAST_SCAN_INSTANCE_COUNT)), AgentConfig.class.getName());
scanControllers.setScanInstanceCount(0);
}

//Always set IAST Test Identifier after IAST_SCAN_INSTANCE_COUNT
if(NewRelic.getAgent().getConfig().getValue(IUtilConstants.IAST_TEST_IDENTIFIER) instanceof String) {
scanControllers.setIastTestIdentifier(NewRelic.getAgent().getConfig().getValue(IUtilConstants.IAST_TEST_IDENTIFIER));
Expand Down

0 comments on commit ecd14d7

Please sign in to comment.