diff --git a/lib/instrumentation/http-shared.js b/lib/instrumentation/http-shared.js index b01397c9238..419c626f5bb 100644 --- a/lib/instrumentation/http-shared.js +++ b/lib/instrumentation/http-shared.js @@ -207,7 +207,10 @@ exports.traceOutgoingRequest = function (agent, moduleName, method) { return function wrapHttpRequest(orig) { return function wrappedHttpRequest(input, options, cb) { const parentRunContext = ins.currRunContext(); - var span = ins.createSpan(null, 'external', 'http', { exitSpan: true }); + var span = + input?.headers?.['x-amz-invocation-type'] === 'RequestResponse' + ? null + : ins.createSpan(null, 'external', 'http', { exitSpan: true }); var id = span && span.transaction.id; agent.logger.debug('intercepted call to %s.%s %o', moduleName, method, { id, diff --git a/lib/lambda.js b/lib/lambda.js index 4ec510c5c91..73d9024bea7 100644 --- a/lib/lambda.js +++ b/lib/lambda.js @@ -705,6 +705,14 @@ function elasticApmAwsLambda(agent) { // Look for trace-context info in headers or messageAttributes. let traceparent; let tracestate; + if ( + triggerType === TRIGGER_GENERIC && + event.traceparent && + event.tracestate + ) { + traceparent = event.traceparent; + tracestate = event.tracestate; + } if ( (triggerType === TRIGGER_API_GATEWAY || triggerType === TRIGGER_ELB) && event.headers