diff --git a/index.html b/index.html index b6275f7..2d23628 100644 --- a/index.html +++ b/index.html @@ -2,7 +2,7 @@
Ppx_traceThe entry point of this library is the module: Ppx_trace.
Trace_fuchsiaval collector :
+ out:[ `File of string | `Stderr | `Stdout ] ->
+ unit ->
+ Trace_core.collectorMake a collector that writes into the given output. See setup for more details.
Output for tracing.
`Stdout will enable tracing and print events on stdout`Stderr will enable tracing and print events on stderr`File "foo" will enable tracing and print events into file named "foo"val setup : ?out:[ output | `Env ] -> unit -> unitsetup () installs the collector depending on out.
val with_setup : ?out:[ output | `Env ] -> unit -> (unit -> 'a) -> 'awith_setup () f (optionally) sets a collector up, calls f(), and makes sure to shutdown before exiting. since 0.2 a () argument was added.
Trace_fuchsia_write.Argumenttype 'a t = string * [< user_data | `Kid of int ] as 'aval size_word :
+ [< `Bool of bool & 'a
+ | `Float of float & 'b
+ | `Int of int
+ | `Kid of int & 'c
+ | `None
+ | `String of string ]
+ t ->
+ intTrace_fuchsia_write.Argumentstype 'a t = 'a Argument.t listval len :
+ [< `Bool of bool
+ | `Float of float
+ | `Int of int
+ | `Kid of int
+ | `None
+ | `String of string ]
+ t ->
+ intval check_valid :
+ [< `Bool of bool
+ | `Float of float
+ | `Int of int
+ | `Kid of int
+ | `None
+ | `String of string ]
+ t ->
+ unitval size_word :
+ [< `Bool of bool & 'a & 'b & 'c & 'd
+ | `Float of float & 'e & 'f & 'g & 'h
+ | `Int of int
+ | `Kid of int & 'i & 'j & 'k & 'l
+ | `None
+ | `String of string ]
+ t ->
+ intTrace_fuchsia_write.Bufval empty : tval create : int -> tval clear : t -> unitval available : t -> intval size : t -> intval add_i64 : t -> int64 -> unitval add_string : t -> string -> unitval to_string : t -> stringBuf_pool.List_with_lenTrace_fuchsia_write.Buf_poolEvent.Async_begintype=5
val size_word :
+ name:string ->
+ t_ref:Thread_ref.t ->
+ args:
+ [< `Bool of bool & 'a & 'b & 'c & 'd
+ | `Float of float & 'e & 'f & 'g & 'h
+ | `Int of int
+ | `Kid of int & 'i & 'j & 'k & 'l
+ | `None
+ | `String of string ]
+ Arguments.t ->
+ unit ->
+ intval encode :
+ Output.t ->
+ name:string ->
+ t_ref:Thread_ref.t ->
+ time_ns:int64 ->
+ async_id:int ->
+ args:
+ [< `Bool of bool & 'a & 'b & 'c & 'd & 'e & 'f & 'g
+ | `Float of float & 'h & 'i & 'j & 'k & 'l & 'm & 'n
+ | `Int of int
+ | `Kid of int & 'o & 'p & 'q & 'r & 's & 't & 'u
+ | `None
+ | `String of string ]
+ Arguments.t ->
+ unit ->
+ unitEvent.Async_endtype=7
val size_word :
+ name:string ->
+ t_ref:Thread_ref.t ->
+ args:
+ [< `Bool of bool & 'a & 'b & 'c & 'd
+ | `Float of float & 'e & 'f & 'g & 'h
+ | `Int of int
+ | `Kid of int & 'i & 'j & 'k & 'l
+ | `None
+ | `String of string ]
+ Arguments.t ->
+ unit ->
+ intval encode :
+ Output.t ->
+ name:string ->
+ t_ref:Thread_ref.t ->
+ time_ns:int64 ->
+ async_id:int ->
+ args:
+ [< `Bool of bool & 'a & 'b & 'c & 'd & 'e & 'f & 'g
+ | `Float of float & 'h & 'i & 'j & 'k & 'l & 'm & 'n
+ | `Int of int
+ | `Kid of int & 'o & 'p & 'q & 'r & 's & 't & 'u
+ | `None
+ | `String of string ]
+ Arguments.t ->
+ unit ->
+ unitEvent.Countertype=1
val size_word :
+ name:string ->
+ t_ref:Thread_ref.t ->
+ args:
+ [< `Bool of bool & 'a & 'b & 'c & 'd
+ | `Float of float & 'e & 'f & 'g & 'h
+ | `Int of int
+ | `Kid of int & 'i & 'j & 'k & 'l
+ | `None
+ | `String of string ]
+ Arguments.t ->
+ unit ->
+ intval encode :
+ Output.t ->
+ name:string ->
+ t_ref:Thread_ref.t ->
+ time_ns:int64 ->
+ args:
+ [< `Bool of bool & 'a & 'b & 'c & 'd & 'e & 'f & 'g
+ | `Float of float & 'h & 'i & 'j & 'k & 'l & 'm & 'n
+ | `Int of int
+ | `Kid of int & 'o & 'p & 'q & 'r & 's & 't & 'u
+ | `None
+ | `String of string ]
+ Arguments.t ->
+ unit ->
+ unitEvent.Duration_begintype=2
val size_word :
+ name:string ->
+ t_ref:Thread_ref.t ->
+ args:
+ [< `Bool of bool & 'a & 'b & 'c & 'd
+ | `Float of float & 'e & 'f & 'g & 'h
+ | `Int of int
+ | `Kid of int & 'i & 'j & 'k & 'l
+ | `None
+ | `String of string ]
+ Arguments.t ->
+ unit ->
+ intval encode :
+ Output.t ->
+ name:string ->
+ t_ref:Thread_ref.t ->
+ time_ns:int64 ->
+ args:
+ [< `Bool of bool & 'a & 'b & 'c & 'd & 'e & 'f & 'g
+ | `Float of float & 'h & 'i & 'j & 'k & 'l & 'm & 'n
+ | `Int of int
+ | `Kid of int & 'o & 'p & 'q & 'r & 's & 't & 'u
+ | `None
+ | `String of string ]
+ Arguments.t ->
+ unit ->
+ unitEvent.Duration_completetype=4
val size_word :
+ name:string ->
+ t_ref:Thread_ref.t ->
+ args:
+ [< `Bool of bool & 'a & 'b & 'c & 'd
+ | `Float of float & 'e & 'f & 'g & 'h
+ | `Int of int
+ | `Kid of int & 'i & 'j & 'k & 'l
+ | `None
+ | `String of string ]
+ Arguments.t ->
+ unit ->
+ intval encode :
+ Output.t ->
+ name:string ->
+ t_ref:Thread_ref.t ->
+ time_ns:int64 ->
+ end_time_ns:int64 ->
+ args:
+ [< `Bool of bool & 'a & 'b & 'c & 'd & 'e & 'f & 'g
+ | `Float of float & 'h & 'i & 'j & 'k & 'l & 'm & 'n
+ | `Int of int
+ | `Kid of int & 'o & 'p & 'q & 'r & 's & 't & 'u
+ | `None
+ | `String of string ]
+ Arguments.t ->
+ unit ->
+ unitEvent.Duration_endtype=3
val size_word :
+ name:string ->
+ t_ref:Thread_ref.t ->
+ args:
+ [< `Bool of bool & 'a & 'b & 'c & 'd
+ | `Float of float & 'e & 'f & 'g & 'h
+ | `Int of int
+ | `Kid of int & 'i & 'j & 'k & 'l
+ | `None
+ | `String of string ]
+ Arguments.t ->
+ unit ->
+ intval encode :
+ Output.t ->
+ name:string ->
+ t_ref:Thread_ref.t ->
+ time_ns:int64 ->
+ args:
+ [< `Bool of bool & 'a & 'b & 'c & 'd & 'e & 'f & 'g
+ | `Float of float & 'h & 'i & 'j & 'k & 'l & 'm & 'n
+ | `Int of int
+ | `Kid of int & 'o & 'p & 'q & 'r & 's & 't & 'u
+ | `None
+ | `String of string ]
+ Arguments.t ->
+ unit ->
+ unitEvent.Instanttype=0
val size_word :
+ name:string ->
+ t_ref:Thread_ref.t ->
+ args:
+ [< `Bool of bool & 'a & 'b & 'c & 'd
+ | `Float of float & 'e & 'f & 'g & 'h
+ | `Int of int
+ | `Kid of int & 'i & 'j & 'k & 'l
+ | `None
+ | `String of string ]
+ Arguments.t ->
+ unit ->
+ intval encode :
+ Output.t ->
+ name:string ->
+ t_ref:Thread_ref.t ->
+ time_ns:int64 ->
+ args:
+ [< `Bool of bool & 'a & 'b & 'c & 'd & 'e & 'f & 'g
+ | `Float of float & 'h & 'i & 'j & 'k & 'l & 'm & 'n
+ | `Int of int
+ | `Kid of int & 'o & 'p & 'q & 'r & 's & 't & 'u
+ | `None
+ | `String of string ]
+ Arguments.t ->
+ unit ->
+ unitTrace_fuchsia_write.Eventrecord type = 4
module Instant : sig ... endtype=0
module Counter : sig ... endtype=1
module Duration_begin : sig ... endtype=2
module Duration_end : sig ... endtype=3
module Duration_complete : sig ... endtype=4
module Async_begin : sig ... endtype=5
module Async_end : sig ... endtype=7
Trace_fuchsia_write.I64include module type of struct include Stdlib.Int64 endTrace_fuchsia_write.Kernel_objectrecord type = 7
val size_word :
+ name:string ->
+ args:
+ [< `Bool of bool & 'a & 'b & 'c & 'd
+ | `Float of float & 'e & 'f & 'g & 'h
+ | `Int of int
+ | `Kid of int & 'i & 'j & 'k & 'l
+ | `None
+ | `String of string ]
+ Arguments.t ->
+ unit ->
+ intval ty_process : tyval ty_thread : tyval encode :
+ Output.t ->
+ name:string ->
+ ty:ty ->
+ kid:int ->
+ args:
+ [< `Bool of bool & 'a & 'b & 'c & 'd & 'e & 'f & 'g
+ | `Float of float & 'h & 'i & 'j & 'k & 'l & 'm & 'n
+ | `Int of int
+ | `Kid of int & 'o & 'p & 'q & 'r & 's & 't & 'u
+ | `None
+ | `String of string ]
+ Arguments.t ->
+ unit ->
+ unitMetadata.Initialization_recordval encode : Output.t -> ticks_per_secs:int64 -> unit -> unitMetadata.Magic_recordFirst record in the trace
Metadata.Provider_infoval encode : Output.t -> id:int -> name:string -> unit -> unitMetadata.Provider_sectionMetadata.Trace_infoTrace_fuchsia_write.Metadatarecord type = 0
module Magic_record : sig ... endFirst record in the trace
module Initialization_record : sig ... endmodule Provider_info : sig ... endmodule Provider_section : sig ... endmodule Trace_info : sig ... endTrace_fuchsia_write.Outputval create : buf_pool:Buf_pool.t -> send_buf:(Buf.t -> unit) -> unit -> tval flush : t -> unitval into_buffer : buf_pool:Buf_pool.t -> Stdlib.Buffer.t -> tval dispose : t -> unitTrace_fuchsia_write.Str_refval inline : int -> tTrace_fuchsia_write.Thread_recordrecord type = 3
val encode : Output.t -> as_ref:int -> pid:int -> tid:int -> unit -> unitRecord that Thread_ref.ref as_ref represents the pair pid, tid
Trace_fuchsia_write.Thread_refval inline : pid:int -> tid:int -> tval ref : int -> tval size_word : t -> intval as_i8 : t -> int8-bit int for the reference
Trace_fuchsia_write.UtilTrace_fuchsia_writeWrite fuchsia events into buffers.
Reference: https://fuchsia.dev/fuchsia-src/reference/tracing/trace-format
module Util : sig ... endmodule Buf : sig ... endmodule Output : sig ... endmodule Buf_pool : sig ... endtype user_data = Trace_core.user_datamodule I64 : sig ... endmodule Str_ref : sig ... endmodule Thread_ref : sig ... endmodule Metadata : sig ... endrecord type = 0
module Argument : sig ... endmodule Arguments : sig ... endmodule Thread_record : sig ... endrecord type = 3
module Event : sig ... endrecord type = 4
module Kernel_object : sig ... endrecord type = 7
The entry point of this library is the module: Trace_fuchsia.
The entry point of this library is the module: Trace_fuchsia_write.
Trace_tefval collector :
+Trace_tef (trace-tef.Trace_tef) Module Trace_tef
val collector :
out:[ `File of string | `Stderr | `Stdout ] ->
unit ->
- Trace.collectorMake a collector that writes into the given output. See setup for more details.
Output for tracing.
`Stdout will enable tracing and print events on stdout`Stderr will enable tracing and print events on stderr`File "foo" will enable tracing and print events into file named "foo"
val setup : ?out:[ output | `Env ] -> unit -> unitsetup () installs the collector depending on out.
val with_setup : ?out:[ output | `Env ] -> unit -> (unit -> 'a) -> 'awith_setup () f (optionally) sets a collector up, calls f(), and makes sure to shutdown before exiting. since 0.2 a () argument was added.
\ No newline at end of file
+ Trace_core.collectorMake a collector that writes into the given output. See setup for more details.
Output for tracing.
`Stdout will enable tracing and print events on stdout`Stderr will enable tracing and print events on stderr`File "foo" will enable tracing and print events into file named "foo"val setup : ?out:[ output | `Env ] -> unit -> unitsetup () installs the collector depending on out.
val with_setup : ?out:[ output | `Env ] -> unit -> (unit -> 'a) -> 'awith_setup () f (optionally) sets a collector up, calls f(), and makes sure to shutdown before exiting. since 0.2 a () argument was added.
The entry point of this library is the module: Trace_tef.
The entry point of this library is the module: Trace_tef.
Trace.CollectorA global collector.
The collector, if present, is responsible for collecting messages and spans, and storing them, recording them, forward them, or offering them to other services and processes.
module type S = sig ... endSignature for a collector.
Collector.SSignature for a collector.
This is only relevant to implementors of tracing backends; to instrument your code you only need to look at the Trace module.
Traceinclude module type of struct include Trace_core endUser defined data, generally passed as key/value pairs to whatever collector is installed (if any).
module Collector = Trace_core.CollectorIs there a collector?
This is fast, so that the traced program can check it before creating any span or message
val enter_span :
- ?__FUNCTION__:string ->
- __FILE__:string ->
- __LINE__:int ->
- ?data:(unit -> (string * user_data) list) ->
- string ->
- spanEnter a span. A span is a delimited period of time with a start instant ("enter") and stop instant ("exit"), associated with some metadata about the code entering/exiting some piece of code.
In particular the entrypoint comes with the location of the code (you can use __FILE__ and __LINE__ directly in OCaml), a mandatory name, and some optional metadata in a JSON-like representation.
val exit_span : span -> unitExit the span.
This should be called exactly once per span (even in case of exception). Once this is called, a timestamp might be recorded, and the span is considered finished and can't be used anymore
val with_span :
+Trace (trace.Trace) Module Trace
include module type of struct include Trace_core end
User defined data, generally passed as key/value pairs to whatever collector is installed (if any).
type explicit_span = Trace_core.explicit_span = {span : span;(*Identifier for this span. Several explicit spans might share the same identifier since we can differentiate between them via meta.
*)mutable meta : Trace_core.Meta_map.t;(*Metadata for this span (and its context)
*)
}Explicit span, with collector-specific metadata
module Collector = Trace_core.Collectormodule Meta_map = Trace_core.Meta_mapTracing
Is there a collector?
This is fast, so that the traced program can check it before creating any span or message.
val with_span :
?__FUNCTION__:string ->
__FILE__:string ->
__LINE__:int ->
?data:(unit -> (string * user_data) list) ->
string ->
(span -> 'a) ->
- 'awith_span ~__FILE__ ~__LINE__ name f enters a new span sp, and calls f sp. sp might be a dummy span if no collector is installed. When f sp returns or raises, the span sp is exited.
This is the recommended way to instrument most code.
with_span ~__FILE__ ~__LINE__ name f enters a new span sp, and calls f sp. sp might be a dummy span if no collector is installed. When f sp returns or raises, the span sp is exited.
This is the recommended way to instrument most code.
NOTE an important restriction is that this is only supposed to work for synchronous, direct style code. Monadic concurrency, Effect-based fibers, etc. might not play well with this style of spans on some or all backends. If you use cooperative concurrency, see enter_manual_span.
val exit_span : span -> unitAdd structured data to the given active span (see with_span). Behavior is not specified if the span has been exited.
val enter_manual_sub_span :
+ parent:explicit_span ->
+ ?flavor:[ `Sync | `Async ] ->
+ ?__FUNCTION__:string ->
+ __FILE__:string ->
+ __LINE__:int ->
+ ?data:(unit -> (string * user_data) list) ->
+ string ->
+ explicit_spanLike with_span but the caller is responsible for obtaining the parent span from their own caller, and carry the resulting explicit_span to the matching exit_manual_span.
val enter_manual_toplevel_span :
+ ?flavor:[ `Sync | `Async ] ->
+ ?__FUNCTION__:string ->
+ __FILE__:string ->
+ __LINE__:int ->
+ ?data:(unit -> (string * user_data) list) ->
+ string ->
+ explicit_spanLike with_span but the caller is responsible for carrying this explicit_span around until it's exited with exit_manual_span. The span can be used as a parent in enter_manual_sub_span.
val exit_manual_span : explicit_span -> unitExit an explicit span. This can be on another thread, in a fiber or lightweight thread, etc. and will be supported by backends nonetheless. The span can be obtained via enter_manual_sub_span or enter_manual_toplevel_span.
val add_data_to_manual_span :
+ explicit_span ->
+ (string * user_data) list ->
+ unitadd_data_explicit esp data adds data to the span esp. The behavior is not specified is the span has been exited already.
val message :
?span:span ->
?data:(unit -> (string * user_data) list) ->
string ->
@@ -20,4 +38,12 @@
?span:span ->
?data:(unit -> (string * user_data) list) ->
((('a, Stdlib.Format.formatter, unit, unit) Stdlib.format4 -> 'a) -> unit) ->
- unitmessagef (fun k->k"hello %s %d!" "world" 42) is like message "hello world 42!" but only computes the string formatting if a collector is installed.
Give a name to the current thread. This might be used by the collector to display traces in a more informative way.
Give a name to the current process. This might be used by the collector to display traces in a more informative way.
Emit a counter of type int. Counters represent the evolution of some quantity over time.
Emit a counter of type float. See counter_int for more details.
Collector
type collector = (module Collector.S)An event collector.
See Collector for more details.
val setup_collector : collector -> unitsetup_collector c installs c as the current collector.
\ No newline at end of file
+ unitmessagef (fun k->k"hello %s %d!" "world" 42) is like message "hello world 42!" but only computes the string formatting if a collector is installed.
Give a name to the current thread. This might be used by the collector to display traces in a more informative way.
Give a name to the current process. This might be used by the collector to display traces in a more informative way.
val counter_int :
+ ?data:(unit -> (string * user_data) list) ->
+ string ->
+ int ->
+ unitEmit a counter of type int. Counters represent the evolution of some quantity over time.
val counter_float :
+ ?data:(unit -> (string * user_data) list) ->
+ string ->
+ float ->
+ unitEmit a counter of type float. See counter_int for more details.
type collector = (module Collector.S)An event collector.
See Collector for more details.
val setup_collector : collector -> unitsetup_collector c installs c as the current collector.
Trace_core.CollectorA global collector.
The collector, if present, is responsible for collecting messages and spans, and storing them, recording them, forward them, or offering them to other services and processes.
module type S = sig ... endSignature for a collector.
Trace_core.CollectorA global collector.
The collector, if present, is responsible for collecting messages and spans, and storing them, recording them, forward them, or offering them to other services and processes.
module type S = sig ... endSignature for a collector.
Collector.SSignature for a collector.
This is only relevant to implementors of tracing backends; to instrument your code you only need to look at the Trace module.
val enter_span :
- ?__FUNCTION__:string ->
+S (trace.Trace_core.Collector.S) Module type Collector.S
Signature for a collector.
This is only relevant to implementors of tracing backends; to instrument your code you only need to look at the Trace module.
Run the function in a new span.
This replaces the previous enter_span and exit_span which were too flexible to be efficient to implement in async contexts.
val enter_span :
+ __FUNCTION__:string option ->
+ __FILE__:string ->
+ __LINE__:int ->
+ data:
+ (string
+ * [ `Int of int
+ | `String of string
+ | `Bool of bool
+ | `Float of float
+ | `None ])
+ list ->
+ string ->
+ int64Enter a new implicit span. For many uses cases, with_span will be easier to use.
Exit span. This should be called on the same thread as the corresponding enter_span, and nest properly with other calls to enter/exit_span and with_span.
val enter_manual_span :
+ parent:Trace_core__.Types.explicit_span option ->
+ flavor:[ `Sync | `Async ] option ->
+ __FUNCTION__:string option ->
+ __FILE__:string ->
+ __LINE__:int ->
+ data:
+ (string
+ * [ `Int of int
+ | `String of string
+ | `Bool of bool
+ | `Float of float
+ | `None ])
+ list ->
+ string ->
+ Trace_core__.Types.explicit_spanEnter an explicit span. Surrounding scope, if any, is provided by parent, and this function can store as much metadata as it wants in the hmap in the explicit_span's meta field.
This means that the collector doesn't need to implement contextual storage mapping span to scopes, metadata, etc. on its side; everything can be transmitted in the explicit_span.
val add_data_to_span :
+ int64 ->
+ (string
+ * [ `Int of int
+ | `String of string
+ | `Bool of bool
+ | `Float of float
+ | `None ])
+ list ->
+ unit0.4
val add_data_to_manual_span :
+ Trace_core__.Types.explicit_span ->
+ (string
+ * [ `Int of int
+ | `String of string
+ | `Bool of bool
+ | `Float of float
+ | `None ])
+ list ->
+ unitAdds data to the given span.
\ No newline at end of file
+ unitEmit a message with associated metadata.
val counter_int :
+ data:
+ (string
+ * [ `Int of int
+ | `String of string
+ | `Bool of bool
+ | `Float of float
+ | `None ])
+ list ->
+ string ->
+ int ->
+ unitInteger counter.
Meta_map.KeyKeys with a type witness.
A key of type 'a t is used to access the portion of the map or table that associates keys of type 'a to values.
val create : unit -> 'a tMake a new key. This is generative, so calling create () twice with the same return type will produce incompatible keys that cannot see each other's bindings.
Trace_core.Meta_mapAssociative containers with Heterogeneous Values
module Key : sig ... endKeys with a type witness.
Immutable map from Key.t to values
val empty : tval length : t -> intval cardinal : t -> intTrace_coreTrace.
User defined data, generally passed as key/value pairs to whatever collector is installed (if any).
module Collector : sig ... endA global collector.
Is there a collector?
This is fast, so that the traced program can check it before creating any span or message
val enter_span :
- ?__FUNCTION__:string ->
- __FILE__:string ->
- __LINE__:int ->
- ?data:(unit -> (string * user_data) list) ->
- string ->
- spanEnter a span. A span is a delimited period of time with a start instant ("enter") and stop instant ("exit"), associated with some metadata about the code entering/exiting some piece of code.
In particular the entrypoint comes with the location of the code (you can use __FILE__ and __LINE__ directly in OCaml), a mandatory name, and some optional metadata in a JSON-like representation.
val exit_span : span -> unitExit the span.
This should be called exactly once per span (even in case of exception). Once this is called, a timestamp might be recorded, and the span is considered finished and can't be used anymore
val with_span :
+Trace_core (trace.Trace_core) Module Trace_core
Trace.
User defined data, generally passed as key/value pairs to whatever collector is installed (if any).
type explicit_span = {span : span;(*Identifier for this span. Several explicit spans might share the same identifier since we can differentiate between them via meta.
*)mutable meta : Meta_map.t;(*Metadata for this span (and its context)
*)
}Explicit span, with collector-specific metadata
module Collector : sig ... endA global collector.
module Meta_map : sig ... endAssociative containers with Heterogeneous Values
Tracing
Is there a collector?
This is fast, so that the traced program can check it before creating any span or message.
val with_span :
?__FUNCTION__:string ->
__FILE__:string ->
__LINE__:int ->
?data:(unit -> (string * user_data) list) ->
string ->
(span -> 'a) ->
- 'awith_span ~__FILE__ ~__LINE__ name f enters a new span sp, and calls f sp. sp might be a dummy span if no collector is installed. When f sp returns or raises, the span sp is exited.
This is the recommended way to instrument most code.
with_span ~__FILE__ ~__LINE__ name f enters a new span sp, and calls f sp. sp might be a dummy span if no collector is installed. When f sp returns or raises, the span sp is exited.
This is the recommended way to instrument most code.
NOTE an important restriction is that this is only supposed to work for synchronous, direct style code. Monadic concurrency, Effect-based fibers, etc. might not play well with this style of spans on some or all backends. If you use cooperative concurrency, see enter_manual_span.
val exit_span : span -> unitAdd structured data to the given active span (see with_span). Behavior is not specified if the span has been exited.
val enter_manual_sub_span :
+ parent:explicit_span ->
+ ?flavor:[ `Sync | `Async ] ->
+ ?__FUNCTION__:string ->
+ __FILE__:string ->
+ __LINE__:int ->
+ ?data:(unit -> (string * user_data) list) ->
+ string ->
+ explicit_spanLike with_span but the caller is responsible for obtaining the parent span from their own caller, and carry the resulting explicit_span to the matching exit_manual_span.
val enter_manual_toplevel_span :
+ ?flavor:[ `Sync | `Async ] ->
+ ?__FUNCTION__:string ->
+ __FILE__:string ->
+ __LINE__:int ->
+ ?data:(unit -> (string * user_data) list) ->
+ string ->
+ explicit_spanLike with_span but the caller is responsible for carrying this explicit_span around until it's exited with exit_manual_span. The span can be used as a parent in enter_manual_sub_span.
val exit_manual_span : explicit_span -> unitExit an explicit span. This can be on another thread, in a fiber or lightweight thread, etc. and will be supported by backends nonetheless. The span can be obtained via enter_manual_sub_span or enter_manual_toplevel_span.
val add_data_to_manual_span :
+ explicit_span ->
+ (string * user_data) list ->
+ unitadd_data_explicit esp data adds data to the span esp. The behavior is not specified is the span has been exited already.
val message :
?span:span ->
?data:(unit -> (string * user_data) list) ->
string ->
@@ -20,4 +38,12 @@
?span:span ->
?data:(unit -> (string * user_data) list) ->
((('a, Stdlib.Format.formatter, unit, unit) Stdlib.format4 -> 'a) -> unit) ->
- unitmessagef (fun k->k"hello %s %d!" "world" 42) is like message "hello world 42!" but only computes the string formatting if a collector is installed.
Give a name to the current thread. This might be used by the collector to display traces in a more informative way.
Give a name to the current process. This might be used by the collector to display traces in a more informative way.
Emit a counter of type int. Counters represent the evolution of some quantity over time.
Emit a counter of type float. See counter_int for more details.
Collector
type collector = (module Collector.S)An event collector.
See Collector for more details.
val setup_collector : collector -> unitsetup_collector c installs c as the current collector.
\ No newline at end of file
+ unitmessagef (fun k->k"hello %s %d!" "world" 42) is like message "hello world 42!" but only computes the string formatting if a collector is installed.
Give a name to the current thread. This might be used by the collector to display traces in a more informative way.
Give a name to the current process. This might be used by the collector to display traces in a more informative way.
val counter_int :
+ ?data:(unit -> (string * user_data) list) ->
+ string ->
+ int ->
+ unitEmit a counter of type int. Counters represent the evolution of some quantity over time.
val counter_float :
+ ?data:(unit -> (string * user_data) list) ->
+ string ->
+ float ->
+ unitEmit a counter of type float. See counter_int for more details.
type collector = (module Collector.S)An event collector.
See Collector for more details.
val setup_collector : collector -> unitsetup_collector c installs c as the current collector.
Trace_private_util.B_queueBasic Blocking Queue
val create : unit -> _ tval push : 'a t -> 'a -> unitpush q x pushes x into q, and returns ().
val pop_all : 'a t -> 'a listpop_all bq returns all items presently in bq, in the same order, and clears bq. It blocks if no element is in bq.
val close : _ t -> unitClose the queue, meaning there won't be any more push allowed.
Trace_private_util.Domain_utilTrace_private_util.Mpsc_bagA multi-producer, single-consumer bag
val create : unit -> 'a tval add : 'a t -> 'a -> unitadd q x adds x in the bag.
val pop_all : 'a t -> 'a list optionReturn all current items in the insertion order.
Trace_private_utilmodule B_queue : sig ... endBasic Blocking Queue
module Domain_util : sig ... endmodule Mpsc_bag : sig ... endA multi-producer, single-consumer bag
The entry point of this library is the module: Trace.
The entry point of this library is the module: Trace_core.
The entry point of this library is the module: Trace.
The entry point of this library is the module: Trace_core.
The entry point of this library is the module: Trace_private_util.