From 9fbcab03dc31b571d22de6b73251c4adde436901 Mon Sep 17 00:00:00 2001 From: Francis Eytan Dortort Date: Sun, 24 May 2026 11:38:17 -0400 Subject: [PATCH] fix: correct unit mismatch in php.compilation.total_time_ms PR #2230 replaced _get_microseconds() (which returned microseconds via clock_gettime) with zend_hrtime() (which returns nanoseconds) without updating the accumulator. The serializer divides by 1000 expecting microseconds, so the metric has been reporting microseconds labeled as milliseconds since v0.98.0. Convert nanoseconds to microseconds at the accumulator to restore correct behavior, matching the pattern used in circuit_breaker.c from the same PR. Fixes #3914 --- ext/engine_hooks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/engine_hooks.c b/ext/engine_hooks.c index a315cb32aa3..1dadab9726a 100644 --- a/ext/engine_hooks.c +++ b/ext/engine_hooks.c @@ -77,7 +77,7 @@ static zend_op_array *_dd_compile_file(zend_file_handle *file_handle, int type) zend_op_array *res; uint64_t start = zend_hrtime(); res = _prev_compile_file(file_handle, type); - DDTRACE_G(compile_time_microseconds) += (int64_t)(zend_hrtime() - start); + DDTRACE_G(compile_time_microseconds) += (int64_t)((zend_hrtime() - start) / 1000); return res; }