mirror of
https://github.com/ocaml-tracing/ocaml-trace.git
synced 2026-03-07 18:37:56 -05:00
fix: beware of dummy trace id
This commit is contained in:
parent
94a061cef7
commit
d737022e11
2 changed files with 8 additions and 2 deletions
|
|
@ -11,7 +11,10 @@ open struct
|
||||||
let spf = Printf.sprintf
|
let spf = Printf.sprintf
|
||||||
|
|
||||||
let[@inline] int64_of_trace_id_ (id : Trace_core.trace_id) : int64 =
|
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
|
end
|
||||||
|
|
||||||
open Util
|
open Util
|
||||||
|
|
|
||||||
|
|
@ -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 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 =
|
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
|
module Mock_ = struct
|
||||||
let enabled = ref false
|
let enabled = ref false
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue