mirror of
https://github.com/ocaml-tracing/ocaml-trace.git
synced 2026-03-07 18:37:56 -05:00
make add_data implicit (no span argument)
This commit is contained in:
parent
83baf45207
commit
4137985d69
3 changed files with 21 additions and 12 deletions
|
|
@ -53,10 +53,15 @@ module type S = sig
|
|||
(** Exit an explicit span.
|
||||
@since 0.3 *)
|
||||
|
||||
val add_data_to_span : span -> (string * user_data) list -> unit
|
||||
(** @since Adds data to the given span.
|
||||
val add_data : (string * user_data) list -> unit
|
||||
(** @since Adds data to the ambient span.
|
||||
NEXT_RELEASE *)
|
||||
|
||||
val add_data_to_manual_span :
|
||||
explicit_span -> (string * user_data) list -> unit
|
||||
(** Adds data to the given span.
|
||||
@since NEXT_RELEASE *)
|
||||
|
||||
val message : ?span:span -> data:(string * user_data) list -> string -> unit
|
||||
(** Emit a message with associated metadata. *)
|
||||
|
||||
|
|
|
|||
|
|
@ -55,15 +55,19 @@ let[@inline] exit_manual_span espan : unit =
|
|||
| None -> ()
|
||||
| Some (module C) -> C.exit_manual_span espan
|
||||
|
||||
let[@inline] add_data_to_span (span : span) data : unit =
|
||||
let[@inline] add_data data : unit =
|
||||
if data <> [] then (
|
||||
match A.get collector with
|
||||
| None -> ()
|
||||
| Some (module C) -> C.add_data_to_span span data
|
||||
| Some (module C) -> C.add_data data
|
||||
)
|
||||
|
||||
let[@inline] add_data_to_explicit_span esp data : unit =
|
||||
add_data_to_span esp.span data
|
||||
let[@inline] add_data_to_manual_span esp data : unit =
|
||||
if data <> [] then (
|
||||
match A.get collector with
|
||||
| None -> ()
|
||||
| Some (module C) -> C.add_data_to_manual_span esp data
|
||||
)
|
||||
|
||||
let message_collector_ (module C : Collector.S) ?span ?(data = fun () -> []) msg
|
||||
: unit =
|
||||
|
|
|
|||
|
|
@ -34,8 +34,9 @@ val with_span :
|
|||
see {!enter_manual_span}.
|
||||
*)
|
||||
|
||||
val add_data_to_span : span -> (string * user_data) list -> unit
|
||||
(** Add structured data to the given span.
|
||||
val add_data : (string * user_data) list -> unit
|
||||
(** Add structured data to the current span (the ambient {!with_span}).
|
||||
Behavior is not specified if there is no current span.
|
||||
@since NEXT_RELEASE *)
|
||||
|
||||
val enter_manual_sub_span :
|
||||
|
|
@ -79,10 +80,9 @@ val exit_manual_span : explicit_span -> unit
|
|||
{!enter_manual_toplevel_span}.
|
||||
@since 0.3 *)
|
||||
|
||||
val add_data_to_explicit_span :
|
||||
explicit_span -> (string * user_data) list -> unit
|
||||
(** [add_data_explicit esp data] is [add_data_to_span esp.span data], ie. it adds
|
||||
the pairs [k:v] from [data] to the span inside [esp].
|
||||
val add_data_to_manual_span : explicit_span -> (string * user_data) list -> unit
|
||||
(** [add_data_explicit esp data] adds [data] to the span [esp].
|
||||
The behavior is not specified is the span has been exited already.
|
||||
@since NEXT_RELEASE *)
|
||||
|
||||
val message :
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue