package trace
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
A stub for tracing/observability, agnostic in how data is collected
Install
dune-project
Dependency
Authors
Maintainers
Sources
trace-0.10.1.tbz
sha256=0b5121a2b3ca0f0d850017865333259f313ce83f77bba54da956f9cafbba6e34
sha512=06476b3b450d3f382ba7e5287591e2bb0f928d38b698af0bd6083d1518fcac93bf498815710d26ecbe9c80c71888638919c0166a79e447ee64ed625afd56dc4b
doc/src/trace.event/subscriber.ml.html
Source file subscriber.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57(** Subscriber that emits events *) open Trace_core open Event type event_consumer = { on_event: Event.t -> unit } [@@unboxed] (** Callback for events. *) module Callbacks : Sub.Callbacks.S with type st = event_consumer = struct type st = event_consumer let on_init (self : st) ~time_ns = self.on_event (E_init { time_ns }) let on_shutdown (self : st) ~time_ns = self.on_event (E_shutdown { time_ns }) let on_name_process (self : st) ~time_ns:_ ~tid:_ ~name : unit = self.on_event @@ E_name_process { name } let on_name_thread (self : st) ~time_ns:_ ~tid ~name : unit = self.on_event @@ E_name_thread { tid; name } let[@inline] on_enter_span (self : st) ~__FUNCTION__:fun_name ~__FILE__:_ ~__LINE__:_ ~time_ns ~tid ~data ~name span : unit = self.on_event @@ E_define_span { tid; name; time_ns; id = span; fun_name; data } let on_exit_span (self : st) ~time_ns ~tid:_ span : unit = self.on_event @@ E_exit_span { id = span; time_ns } let on_add_data (self : st) ~data span = if data <> [] then self.on_event @@ E_add_data { id = span; data } let on_message (self : st) ~time_ns ~tid ~span:_ ~data msg : unit = self.on_event @@ E_message { tid; time_ns; msg; data } let on_counter (self : st) ~time_ns ~tid ~data:_ ~name f : unit = self.on_event @@ E_counter { name; n = f; time_ns; tid } let on_enter_manual_span (self : st) ~__FUNCTION__:fun_name ~__FILE__:_ ~__LINE__:_ ~time_ns ~tid ~parent:_ ~data ~name ~flavor ~trace_id _span : unit = self.on_event @@ E_enter_manual_span { id = trace_id; time_ns; tid; data; name; fun_name; flavor } let on_exit_manual_span (self : st) ~time_ns ~tid ~name ~data ~flavor ~trace_id (_ : span) : unit = self.on_event @@ E_exit_manual_span { tid; id = trace_id; name; time_ns; data; flavor } let on_extension_event (self : st) ~time_ns ~tid ext : unit = self.on_event @@ E_extension_event { tid; time_ns; ext } end (** A subscriber that turns calls into events that are passed to the {! event_consumer} *) let subscriber (consumer : event_consumer) : Sub.t = Sub.Subscriber.Sub { st = consumer; callbacks = (module Callbacks) }
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>