[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>
This commit is contained in:
emricksini-h
2026-07-13 16:25:03 -07:00
committed by GitHub
co-authored by Simon Mo
parent 8b8af2caf7
commit fec64fea75
+6 -3
View File
@@ -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