From fec64fea75103a1490e7fa0874c55a2292c110b1 Mon Sep 17 00:00:00 2001 From: emricksini-h Date: Mon, 13 Jul 2026 16:25:03 -0700 Subject: [PATCH] [BugFix] Correct OTEL span start time for Dynamo compilation (#40698) Signed-off-by: emricksini-h Co-authored-by: Simon Mo --- vllm/compilation/backends.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/vllm/compilation/backends.py b/vllm/compilation/backends.py index dc12acbaf4..f80498c813 100644 --- a/vllm/compilation/backends.py +++ b/vllm/compilation/backends.py @@ -1144,16 +1144,19 @@ class VllmBackend: compilation_counter.num_graphs_seen += 1 from .monitor import torch_compile_start_time - dynamo_time = time.perf_counter() - torch_compile_start_time + current_perf = time.perf_counter() + current_epoch = time.time() + dynamo_time = current_perf - torch_compile_start_time logger.info_once( "Dynamo bytecode transform time: %.2f s", dynamo_time, ) # Record Dynamo time in tracing if available - start_time = int(torch_compile_start_time * 1e9) + real_start_time = current_epoch - dynamo_time + start_time_ns = int(real_start_time * 1e9) attributes = {"dynamo.time_seconds": dynamo_time} - instrument_manual("Dynamo bytecode transform", start_time, None, attributes) + instrument_manual("Dynamo bytecode transform", start_time_ns, None, attributes) # we control the compilation process, each instance can only be # called once