mirror of
https://github.com/ocaml-tracing/ocaml-trace.git
synced 2026-03-07 18:37:56 -05:00
remove subscriber library
it's basically similar to Trace_core.Collector at this point.
This commit is contained in:
parent
66816040aa
commit
fc2fc49e94
8 changed files with 1 additions and 85 deletions
|
|
@ -1,18 +0,0 @@
|
|||
(library
|
||||
(name trace_subscriber)
|
||||
(public_name trace.subscriber)
|
||||
(private_modules time_ thread_)
|
||||
(libraries
|
||||
(re_export trace.core)
|
||||
(select
|
||||
thread_.ml
|
||||
from
|
||||
(threads -> thread_.real.ml)
|
||||
(-> thread_.dummy.ml))
|
||||
(select
|
||||
time_.ml
|
||||
from
|
||||
(mtime mtime.clock.os -> time_.mtime.ml)
|
||||
(mtime mtime.clock.jsoo -> time_.mtime.ml)
|
||||
(unix -> time_.unix.ml)
|
||||
(-> time_.dummy.ml))))
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
(** Subscriber span.
|
||||
|
||||
This is the concrete representation of spans used in [Trace_subscriber].
|
||||
|
||||
@since NEXT_RELEASE *)
|
||||
|
||||
open Trace_core
|
||||
|
||||
type span_id = int64
|
||||
(** Unique ID *)
|
||||
|
||||
type trace_id = int64
|
||||
(** Unique trace ID *)
|
||||
|
||||
let dummy_span_id = Int64.min_int
|
||||
|
||||
type span_flavor =
|
||||
[ `Sync
|
||||
| `Async
|
||||
]
|
||||
|
||||
type t = {
|
||||
id: span_id;
|
||||
name: string;
|
||||
__FUNCTION__: string option;
|
||||
__FILE__: string;
|
||||
__LINE__: int;
|
||||
time_ns: int64; (** Time the span was entered. *)
|
||||
mutable time_exit_ns: int64;
|
||||
(** Time the span was exited. Set at exit, [Int64.max_int] otherwise *)
|
||||
trace_id: trace_id;
|
||||
tid: int; (** Thread in which span was created *)
|
||||
parent: parent;
|
||||
flavor: span_flavor;
|
||||
params: extension_parameter list;
|
||||
mutable data: (string * Trace_core.user_data) list;
|
||||
(** Modified by [add_data_to_span] *)
|
||||
}
|
||||
(** The type of spans used by all subscribers. *)
|
||||
|
|
@ -1 +0,0 @@
|
|||
let[@inline] get_tid () = 0
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
val get_tid : unit -> int
|
||||
(** Get current thread ID *)
|
||||
|
|
@ -1 +0,0 @@
|
|||
let[@inline] get_tid () = Thread.id @@ Thread.self ()
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
let[@inline] get_time_ns () : int64 =
|
||||
let t = Mtime_clock.now () in
|
||||
Mtime.to_uint64_ns t
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
let[@inline] get_time_ns () : int64 =
|
||||
let t = Unix.gettimeofday () in
|
||||
Int64.of_float (t *. 1e9)
|
||||
|
|
@ -1,9 +1,6 @@
|
|||
open Trace_core
|
||||
module Callbacks = Callbacks
|
||||
module Subscriber = Subscriber
|
||||
module Span_sub = Span_sub
|
||||
|
||||
type t = Subscriber.t
|
||||
type t = Collector.t
|
||||
|
||||
module Private_ = struct
|
||||
let mock = ref false
|
||||
|
|
@ -131,17 +128,3 @@ end
|
|||
(** A collector that calls the callbacks of subscriber *)
|
||||
let collector (self : Subscriber.t) : collector =
|
||||
Collector.C_some (self, coll_cbs)
|
||||
|
||||
module Span_id_generator = struct
|
||||
type t = int A.t
|
||||
|
||||
let create () = A.make 0
|
||||
let[@inline] gen self = A.fetch_and_add self 1 |> Int64.of_int
|
||||
end
|
||||
|
||||
module Trace_id_generator = struct
|
||||
type t = int A.t
|
||||
|
||||
let create () = A.make 0
|
||||
let[@inline] gen self = A.fetch_and_add self 1 |> Int64.of_int
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue