@@ -30,7 +30,7 @@ export class SpanInferrer {
30
30
) : any {
31
31
const eventSource = parseEventSource ( event ) ;
32
32
if ( eventSource === eventTypes . lambdaUrl ) {
33
- return this . createInferredSpanForLambdaUrl ( event , context ) ;
33
+ return this . createInferredSpanForLambdaUrl ( event , context , parentSpanContext ) ;
34
34
}
35
35
if ( eventSource === eventTypes . apiGateway ) {
36
36
return this . createInferredSpanForApiGateway ( event , context , parentSpanContext , decodeAuthorizerContext ) ;
@@ -158,7 +158,11 @@ export class SpanInferrer {
158
158
return new SpanWrapper ( this . traceWrapper . startSpan ( "aws.apigateway" , options ) , spanWrapperOptions ) ;
159
159
}
160
160
161
- createInferredSpanForLambdaUrl ( event : any , context : Context | undefined ) : any {
161
+ createInferredSpanForLambdaUrl (
162
+ event : any ,
163
+ context : Context | undefined ,
164
+ parentSpanContext : SpanContext | undefined ,
165
+ ) : any {
162
166
const options : SpanOptions = { } ;
163
167
const domain = event . requestContext . domainName ;
164
168
const path = event . rawPath ;
@@ -188,6 +192,9 @@ export class SpanInferrer {
188
192
const spanWrapperOptions = {
189
193
isAsync : false ,
190
194
} ;
195
+ if ( parentSpanContext ) {
196
+ options . childOf = parentSpanContext ;
197
+ }
191
198
return new SpanWrapper ( this . traceWrapper . startSpan ( "aws.lambda.url" , options ) , spanWrapperOptions ) ;
192
199
}
193
200
0 commit comments