@@ -12,7 +12,7 @@ import { extractTriggerTags, extractHTTPStatusCodeTag } from "./trigger";
1212import { ColdStartTracerConfig , ColdStartTracer } from "./cold-start-tracer" ;
1313
1414import { logDebug , tagObject } from "../utils" ;
15- import { didFunctionColdStart } from "../utils/cold-start" ;
15+ import { didFunctionColdStart , isProactiveInitialization } from "../utils/cold-start" ;
1616import { datadogLambdaVersion } from "../constants" ;
1717import { Source , ddtraceVersion , parentSpanFinishTimeHeader , authorizingRequestIdHeader } from "./constants" ;
1818import { patchConsole } from "./patch-console" ;
@@ -160,12 +160,15 @@ export class TraceListener {
160160 if ( coldStartNodes . length > 0 ) {
161161 const coldStartConfig : ColdStartTracerConfig = {
162162 tracerWrapper : this . tracerWrapper ,
163- parentSpan : didFunctionColdStart ( ) ? this . inferredSpan || this . wrappedCurrentSpan : this . wrappedCurrentSpan ,
163+ parentSpan :
164+ didFunctionColdStart ( ) || isProactiveInitialization ( )
165+ ? this . inferredSpan || this . wrappedCurrentSpan
166+ : this . wrappedCurrentSpan ,
164167 lambdaFunctionName : this . context ?. functionName ,
165168 currentSpanStartTime : this . wrappedCurrentSpan ?. startTime ( ) ,
166169 minDuration : this . config . minColdStartTraceDuration ,
167170 ignoreLibs : this . config . coldStartTraceSkipLib ,
168- isColdStart : didFunctionColdStart ( ) ,
171+ isColdStart : didFunctionColdStart ( ) || isProactiveInitialization ( ) ,
169172 } ;
170173 const coldStartTracer = new ColdStartTracer ( coldStartConfig ) ;
171174 coldStartTracer . trace ( coldStartNodes ) ;
@@ -257,6 +260,9 @@ export class TraceListener {
257260 datadog_lambda : datadogLambdaVersion ,
258261 dd_trace : ddtraceVersion ,
259262 } ;
263+ if ( isProactiveInitialization ( ) ) {
264+ options . tags . proactive_initialization = true ;
265+ }
260266 if (
261267 ( this . contextService . traceSource === Source . Xray && this . config . mergeDatadogXrayTraces ) ||
262268 this . contextService . traceSource === Source . Event
0 commit comments