[BugFix] Correct OTEL span start time for Dynamo compilation (#40698)

Signed-off-by: emricksini-h <emrick.birivoutin@hcompany.ai> Co-authored-by: Simon Mo <simon.mo@hey.com>

emricksini-h committed Jul 13, 2026 at 16:25 UTC fec64fea75103a1490e7fa0874c55a2292c110b1
1 file changed +6 -3
vllm/compilation/backends.py
+6 -3
@@ -1144,16 +1144,19 @@ class VllmBackend:
1144 compilation_counter.num_graphs_seen += 1
1145 from .monitor import torch_compile_start_time
1146
1147 - dynamo_time = time.perf_counter() - torch_compile_start_time
1147 + current_perf = time.perf_counter()
1148 + current_epoch = time.time()
1149 + dynamo_time = current_perf - torch_compile_start_time
1150 logger.info_once(
1151 "Dynamo bytecode transform time: %.2f s",
1152 dynamo_time,
1153 )
1154
1155 # Record Dynamo time in tracing if available
1154 - start_time = int(torch_compile_start_time * 1e9)
1156 + real_start_time = current_epoch - dynamo_time
1157 + start_time_ns = int(real_start_time * 1e9)
1158 attributes = {"dynamo.time_seconds": dynamo_time}
1156 - instrument_manual("Dynamo bytecode transform", start_time, None, attributes)
1159 + instrument_manual("Dynamo bytecode transform", start_time_ns, None, attributes)
1160
1161 # we control the compilation process, each instance can only be
1162 # called once