Thanks Peter for your reply. Actually, I don't know how the correlation header should look like. I tried many entries, but in every time it returns malformed header and generate a new one like: [AppDynamics Tracer] [DEBUG]: Correlation Header generated => com.appdynamics.serverless.tracers.aws.correlation.CorrelationHeader@3fee9989 This is why I used it same as the generated value com.appdynamics.serverless.tracers.aws.correlation.CorrelationHeader without the sequence number at the end. Yes, I get a header chain generated after that and looks like that: HeaderChain{root='appId=300*ctrlguid=1570069847*acctguid=a678f643-40d2-4d5d-8a32-636b904e6186*ts=1582757985080*btid=145515*guid=98faae3f-ddfb-4904-bc01-19078418956d', fromCompChain='174213', toCompChain='', exitTypeCallChain='', exitSubtypeCallChain='', snapshotEnabledSet=false, fromCompIds=[174213], threadCallChainForOutOfProcess='null'} But, the generated correlation header is not fetched by the second Lambda. Second Lambda code: public String handleRequest(SNSEvent event, Context context) {
String snsMsg = "Hello From Lambda To SNS";
String messasge = event.getRecords().get(0).getSNS().getMessage();
String correlationHeader="";
//Instantiate the tracer
Tracer tracer = AppDynamics.getTracer(context);
com.appdynamics.serverless.tracers.dependencies.com.google.gson.JsonParser parser = new JsonParser();
JsonObject inputObject = parser.parse(messasge).getAsJsonObject();
if (inputObject.has(Tracer.APPDYNAMICS_TRANSACTION_CORRELATION_HEADER_KEY)) {
System.out.println("corrHeader in tracer");
correlationHeader = inputObject.get(Tracer.APPDYNAMICS_TRANSACTION_CORRELATION_HEADER_KEY).getAsString();
System.out.println(correlationHeader);
} else {
//Try reading from HTTP headers
if (inputObject.has("headers")) {
System.out.println("corrHeader in headers");
JsonObject httpHeaders = inputObject.getAsJsonObject("headers");
if (httpHeaders.has(Tracer.APPDYNAMICS_TRANSACTION_CORRELATION_HEADER_KEY)) {
correlationHeader = httpHeaders.get(Tracer.APPDYNAMICS_TRANSACTION_CORRELATION_HEADER_KEY).getAsString();
System.out.println(correlationHeader);
}
}
}
//Create Transaction
Transaction transaction = tracer.createTransaction(correlationHeader);
//Start the transaction monitoring.
transaction.start();
//Lambda code
try{
context.getLogger().log("SNS Message: " + snsMsg);
context.getLogger().log(event.getRecords().get(0).getSNS().getMessage());
return null;
}
finally {
transaction.stop();
AppDynamics.cleanup();
}
}
} Cloud watch logs that showing receiving message to this Lambda: {
"singularityheader": "com.appdynamics.serverless.tracers.aws.correlation.CorrelationHeader",
"msg": "Hello from InitSample to SNS"
} I'm still missing something on how to pass the generated header from the first lambda to the second one? Thanks
... View more