mirror of
https://github.com/ocaml-tracing/ocaml-trace.git
synced 2026-03-08 03:47:57 -04:00
remove dead code and on_tracing_error
This commit is contained in:
parent
40335815b3
commit
e98c11c9e0
10 changed files with 0 additions and 66 deletions
|
|
@ -2,8 +2,6 @@ open Common_
|
||||||
open Types
|
open Types
|
||||||
open Trace_core
|
open Trace_core
|
||||||
|
|
||||||
let on_tracing_error = on_tracing_error
|
|
||||||
|
|
||||||
type t = {
|
type t = {
|
||||||
active: bool A.t;
|
active: bool A.t;
|
||||||
pid: int;
|
pid: int;
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,3 @@ val callbacks : t Collector.Callbacks.t
|
||||||
|
|
||||||
val collector : t -> Collector.t
|
val collector : t -> Collector.t
|
||||||
(** Subscriber that writes json into this writer *)
|
(** Subscriber that writes json into this writer *)
|
||||||
|
|
||||||
(**/**)
|
|
||||||
|
|
||||||
val on_tracing_error : (string -> unit) ref
|
|
||||||
|
|
||||||
(**/**)
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,5 @@
|
||||||
module A = Trace_core.Internal_.Atomic_
|
module A = Trace_core.Internal_.Atomic_
|
||||||
|
|
||||||
let on_tracing_error =
|
|
||||||
ref (fun s -> Printf.eprintf "trace-fuchsia error: %s\n%!" s)
|
|
||||||
|
|
||||||
let ( let@ ) = ( @@ )
|
let ( let@ ) = ( @@ )
|
||||||
let spf = Printf.sprintf
|
let spf = Printf.sprintf
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
open Common_
|
|
||||||
module Buf = Buf
|
module Buf = Buf
|
||||||
module Buf_chain = Buf_chain
|
module Buf_chain = Buf_chain
|
||||||
module Buf_pool = Buf_pool
|
module Buf_pool = Buf_pool
|
||||||
|
|
@ -49,6 +48,4 @@ module Internal_ = struct
|
||||||
let mock_all_ () =
|
let mock_all_ () =
|
||||||
Trace_util.Mock_.mock_all ();
|
Trace_util.Mock_.mock_all ();
|
||||||
()
|
()
|
||||||
|
|
||||||
let on_tracing_error = on_tracing_error
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,6 @@ val with_setup : ?out:[< output | `Env > `Env ] -> unit -> (unit -> 'a) -> 'a
|
||||||
(**/**)
|
(**/**)
|
||||||
|
|
||||||
module Internal_ : sig
|
module Internal_ : sig
|
||||||
val on_tracing_error : (string -> unit) ref
|
|
||||||
|
|
||||||
val mock_all_ : unit -> unit
|
val mock_all_ : unit -> unit
|
||||||
(** use fake, deterministic timestamps, TID, PID *)
|
(** use fake, deterministic timestamps, TID, PID *)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,6 @@ val with_setup : ?out:[ output | `Env ] -> unit -> (unit -> 'a) -> 'a
|
||||||
module Private_ : sig
|
module Private_ : sig
|
||||||
val mock_all_ : unit -> unit
|
val mock_all_ : unit -> unit
|
||||||
(** use fake, deterministic timestamps, TID, PID *)
|
(** use fake, deterministic timestamps, TID, PID *)
|
||||||
|
|
||||||
val on_tracing_error : (string -> unit) ref
|
|
||||||
end
|
end
|
||||||
|
|
||||||
(**/**)
|
(**/**)
|
||||||
|
|
|
||||||
|
|
@ -16,21 +16,6 @@ open struct
|
||||||
Int64.div t 1_000L |> Int64.to_float
|
Int64.div t 1_000L |> Int64.to_float
|
||||||
end
|
end
|
||||||
|
|
||||||
let on_tracing_error = ref (fun s -> Printf.eprintf "%s\n%!" s)
|
|
||||||
|
|
||||||
(*
|
|
||||||
type span_info = {
|
|
||||||
tid: int;
|
|
||||||
name: string;
|
|
||||||
start_us: float;
|
|
||||||
mutable data: (string * user_data) list;
|
|
||||||
(* NOTE: thread safety: this is supposed to only be modified by the thread
|
|
||||||
that's running this (synchronous, stack-abiding) span. *)
|
|
||||||
}
|
|
||||||
(** Information we store about a span begin event, to emit a complete event when
|
|
||||||
we meet the corresponding span end event *)
|
|
||||||
*)
|
|
||||||
|
|
||||||
type t = {
|
type t = {
|
||||||
active: bool A.t;
|
active: bool A.t;
|
||||||
pid: int;
|
pid: int;
|
||||||
|
|
@ -40,29 +25,6 @@ type t = {
|
||||||
}
|
}
|
||||||
(** Subscriber state *)
|
(** Subscriber state *)
|
||||||
|
|
||||||
(* TODO: this is nice to have, can we make it optional?
|
|
||||||
open struct
|
|
||||||
let print_non_closed_spans_warning spans =
|
|
||||||
let module Str_set = Set.Make (String) in
|
|
||||||
let spans = Span_tbl.to_list spans in
|
|
||||||
if spans <> [] then (
|
|
||||||
!on_tracing_error
|
|
||||||
@@ Printf.sprintf "trace-tef: warning: %d spans were not closed"
|
|
||||||
(List.length spans);
|
|
||||||
let names =
|
|
||||||
List.fold_left
|
|
||||||
(fun set (_, span) -> Str_set.add span.name set)
|
|
||||||
Str_set.empty spans
|
|
||||||
in
|
|
||||||
Str_set.iter
|
|
||||||
(fun name ->
|
|
||||||
!on_tracing_error @@ Printf.sprintf " span %S was not closed" name)
|
|
||||||
names;
|
|
||||||
flush stderr
|
|
||||||
)
|
|
||||||
end
|
|
||||||
*)
|
|
||||||
|
|
||||||
let close (self : t) : unit =
|
let close (self : t) : unit =
|
||||||
if A.exchange self.active false then
|
if A.exchange self.active false then
|
||||||
(* FIXME: print_non_closed_spans_warning self.spans; *)
|
(* FIXME: print_non_closed_spans_warning self.spans; *)
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,3 @@ val callbacks_collector : t Collector.Callbacks.t
|
||||||
|
|
||||||
val collector : t -> Collector.t
|
val collector : t -> Collector.t
|
||||||
(** Subscriber that writes json into this writer *)
|
(** Subscriber that writes json into this writer *)
|
||||||
|
|
||||||
(**/**)
|
|
||||||
|
|
||||||
val on_tracing_error : (string -> unit) ref
|
|
||||||
|
|
||||||
(**/**)
|
|
||||||
|
|
|
||||||
|
|
@ -104,8 +104,6 @@ module Private_ = struct
|
||||||
Trace_util.Mock_.mock_all ();
|
Trace_util.Mock_.mock_all ();
|
||||||
()
|
()
|
||||||
|
|
||||||
let on_tracing_error = Collector_tef.on_tracing_error
|
|
||||||
|
|
||||||
let collector_jsonl ~finally ~out () : collector =
|
let collector_jsonl ~finally ~out () : collector =
|
||||||
collector_ ~finally ~mode:`Jsonl ~out ()
|
collector_ ~finally ~mode:`Jsonl ~out ()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,6 @@ module Private_ : sig
|
||||||
val mock_all_ : unit -> unit
|
val mock_all_ : unit -> unit
|
||||||
(** use fake, deterministic timestamps, TID, PID *)
|
(** use fake, deterministic timestamps, TID, PID *)
|
||||||
|
|
||||||
val on_tracing_error : (string -> unit) ref
|
|
||||||
|
|
||||||
val collector_jsonl :
|
val collector_jsonl :
|
||||||
finally:(unit -> unit) ->
|
finally:(unit -> unit) ->
|
||||||
out:[ `File_append of string | `Output of out_channel ] ->
|
out:[ `File_append of string | `Output of out_channel ] ->
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue