fix: beware of dummy trace id

This commit is contained in:
Simon Cruanes 2025-04-11 12:25:10 -04:00
parent 94a061cef7
commit d737022e11
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
2 changed files with 8 additions and 2 deletions

View file

@ -11,7 +11,10 @@ open struct
let spf = Printf.sprintf
let[@inline] int64_of_trace_id_ (id : Trace_core.trace_id) : int64 =
Bytes.get_int64_le (Bytes.unsafe_of_string id) 0
if id == Trace_core.Collector.dummy_trace_id then
0L
else
Bytes.get_int64_le (Bytes.unsafe_of_string id) 0
end
open Util

View file

@ -7,7 +7,10 @@ module A = Trace_core.Internal_.Atomic_
let on_tracing_error = ref (fun s -> Printf.eprintf "trace-tef error: %s\n%!" s)
let[@inline] int64_of_trace_id_ (id : Trace_core.trace_id) : int64 =
Bytes.get_int64_le (Bytes.unsafe_of_string id) 0
if id == Trace_core.Collector.dummy_trace_id then
0L
else
Bytes.get_int64_le (Bytes.unsafe_of_string id) 0
module Mock_ = struct
let enabled = ref false