Skip to content

Commit

Permalink
Fix the api id changes for control command 11
Browse files Browse the repository at this point in the history
  • Loading branch information
lovesh-ap committed Nov 19, 2024
1 parent 0908901 commit 9a258ed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.newrelic.agent.security.intcodeagent.controlcommand;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.newrelic.agent.security.AgentInfo;
import com.newrelic.agent.security.instrumentator.httpclient.IASTDataTransferRequestProcessor;
import com.newrelic.agent.security.instrumentator.httpclient.RestRequestProcessor;
Expand Down Expand Up @@ -66,6 +67,7 @@ public class ControlCommandProcessor implements Runnable {
public static final String RECEIVED_IAST_COOLDOWN_WAITING_TILL_S = "Received IAST cooldown. Waiting for next : %s Seconds";
public static final String PURGING_CONFIRMED_IAST_PROCESSED_RECORDS_COUNT_S = "Purging confirmed IAST processed records count : %s";
public static final String PURGING_CONFIRMED_IAST_PROCESSED_RECORDS_S = "Purging confirmed IAST processed records : %s";
public static final String API_ID = "apiId";


private String controlCommandMessage;
Expand Down Expand Up @@ -97,6 +99,9 @@ public void run() {
controlCommand.setData(object.get(DATA));
controlCommand.setControlCommand(Integer.valueOf(object.get(CONTROL_COMMAND).toString()));
controlCommand.setReflectedMetaData((Map<String, String>) object.get(REFLECTED_METADATA));
if(object.get(API_ID) != null) {
controlCommand.setApiId(object.get(API_ID).toString());
}

} catch (Throwable e) {
logger.log(LogLevel.SEVERE, ERROR_IN_CONTROL_COMMAND_PROCESSOR, e,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ private void updateSkippedTraceApis(String traceId) {
Set<String> operationApiIds = encounteredTraces.get(traceId);
if (operationApiIds != null) {
skippedTraceApis.addAll(operationApiIds);
logger.log(LogLevel.FINER, "Skipped trace apis: " + skippedTraceApis, IastExclusionUtils.class.getName());
logger.log(LogLevel.FINER, String.format("Adding trace to skip list: %s with following api ids: %s", skippedTraceApis, operationApiIds), IastExclusionUtils.class.getName());
}
}

private void updateSkippedTraceApis(String traceId, String operationApiId) {
if (skippedTraces.containsKey(traceId)) {
skippedTraceApis.add(operationApiId);
logger.log(LogLevel.FINER, "Skipped trace apis: " + skippedTraceApis, IastExclusionUtils.class.getName());
logger.log(LogLevel.FINER, "Adding api id to skip list: " + skippedTraceApis, IastExclusionUtils.class.getName());
}
}

Expand Down

0 comments on commit 9a258ed

Please sign in to comment.