@@ -44,6 +44,7 @@ class ManagedSupervisor {
4444
4545 private readonly podCleaner ?: PodCleaner ;
4646 private readonly failedPodHandler ?: FailedPodHandler ;
47+ private readonly tracing ?: OtlpTraceService ;
4748
4849 private readonly isKubernetes = isKubernetesEnvironment ( env . KUBERNETES_FORCE_ENABLED ) ;
4950 private readonly warmStartUrl = env . TRIGGER_WARM_START_URL ;
@@ -92,6 +93,12 @@ class ManagedSupervisor {
9293
9394 const callbackUrl = `${ env . TRIGGER_WORKLOAD_API_PROTOCOL } ://${ env . TRIGGER_WORKLOAD_API_DOMAIN } :${ env . TRIGGER_WORKLOAD_API_PORT_EXTERNAL } /api/v1/compute/snapshot-complete` ;
9495
96+ if ( env . COMPUTE_TRACE_SPANS_ENABLED ) {
97+ this . tracing = new OtlpTraceService ( {
98+ endpointUrl : env . OTEL_EXPORTER_OTLP_ENDPOINT ,
99+ } ) ;
100+ }
101+
95102 const computeManager = new ComputeWorkloadManager ( {
96103 ...workloadManagerOptions ,
97104 gateway : {
@@ -104,9 +111,7 @@ class ManagedSupervisor {
104111 delayMs : env . COMPUTE_SNAPSHOT_DELAY_MS ,
105112 callbackUrl,
106113 } ,
107- tracing : env . COMPUTE_TRACE_SPANS_ENABLED
108- ? new OtlpTraceService ( { endpointUrl : env . OTEL_EXPORTER_OTLP_ENDPOINT } )
109- : undefined ,
114+ tracing : this . tracing ,
110115 runner : {
111116 instanceName : env . TRIGGER_WORKER_INSTANCE_NAME ,
112117 otelEndpoint : env . OTEL_EXPORTER_OTLP_ENDPOINT ,
@@ -404,6 +409,7 @@ class ManagedSupervisor {
404409 workerClient : this . workerSession . httpClient ,
405410 checkpointClient : this . checkpointClient ,
406411 computeManager : this . computeManager ,
412+ tracing : this . tracing ,
407413 } ) ;
408414
409415 this . workloadServer . on ( "runConnected" , this . onRunConnected . bind ( this ) ) ;
0 commit comments