From e98c11c9e027cbc00a459db25c036b503532e383 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Sat, 17 Jan 2026 10:42:45 -0500 Subject: [PATCH] remove dead code and `on_tracing_error` --- src/fuchsia/collector_fuchsia.ml | 2 -- src/fuchsia/collector_fuchsia.mli | 6 ----- src/fuchsia/common_.ml | 3 --- src/fuchsia/trace_fuchsia.ml | 3 --- src/fuchsia/trace_fuchsia.mli | 2 -- src/tef-tldrs/trace_tef_tldrs.mli | 2 -- src/tef/collector_tef.ml | 38 ------------------------------- src/tef/collector_tef.mli | 6 ----- src/tef/trace_tef.ml | 2 -- src/tef/trace_tef.mli | 2 -- 10 files changed, 66 deletions(-) diff --git a/src/fuchsia/collector_fuchsia.ml b/src/fuchsia/collector_fuchsia.ml index 157e938..54710b5 100644 --- a/src/fuchsia/collector_fuchsia.ml +++ b/src/fuchsia/collector_fuchsia.ml @@ -2,8 +2,6 @@ open Common_ open Types open Trace_core -let on_tracing_error = on_tracing_error - type t = { active: bool A.t; pid: int; diff --git a/src/fuchsia/collector_fuchsia.mli b/src/fuchsia/collector_fuchsia.mli index f771548..d47b7cb 100644 --- a/src/fuchsia/collector_fuchsia.mli +++ b/src/fuchsia/collector_fuchsia.mli @@ -13,9 +13,3 @@ val callbacks : t Collector.Callbacks.t val collector : t -> Collector.t (** Subscriber that writes json into this writer *) - -(**/**) - -val on_tracing_error : (string -> unit) ref - -(**/**) diff --git a/src/fuchsia/common_.ml b/src/fuchsia/common_.ml index b48ced2..e193b66 100644 --- a/src/fuchsia/common_.ml +++ b/src/fuchsia/common_.ml @@ -1,8 +1,5 @@ module A = Trace_core.Internal_.Atomic_ -let on_tracing_error = - ref (fun s -> Printf.eprintf "trace-fuchsia error: %s\n%!" s) - let ( let@ ) = ( @@ ) let spf = Printf.sprintf diff --git a/src/fuchsia/trace_fuchsia.ml b/src/fuchsia/trace_fuchsia.ml index 5cbebc6..3fed5c9 100644 --- a/src/fuchsia/trace_fuchsia.ml +++ b/src/fuchsia/trace_fuchsia.ml @@ -1,4 +1,3 @@ -open Common_ module Buf = Buf module Buf_chain = Buf_chain module Buf_pool = Buf_pool @@ -49,6 +48,4 @@ module Internal_ = struct let mock_all_ () = Trace_util.Mock_.mock_all (); () - - let on_tracing_error = on_tracing_error end diff --git a/src/fuchsia/trace_fuchsia.mli b/src/fuchsia/trace_fuchsia.mli index b512439..93e69aa 100644 --- a/src/fuchsia/trace_fuchsia.mli +++ b/src/fuchsia/trace_fuchsia.mli @@ -41,8 +41,6 @@ val with_setup : ?out:[< output | `Env > `Env ] -> unit -> (unit -> 'a) -> 'a (**/**) module Internal_ : sig - val on_tracing_error : (string -> unit) ref - val mock_all_ : unit -> unit (** use fake, deterministic timestamps, TID, PID *) end diff --git a/src/tef-tldrs/trace_tef_tldrs.mli b/src/tef-tldrs/trace_tef_tldrs.mli index 02cbf40..2329b87 100644 --- a/src/tef-tldrs/trace_tef_tldrs.mli +++ b/src/tef-tldrs/trace_tef_tldrs.mli @@ -33,8 +33,6 @@ val with_setup : ?out:[ output | `Env ] -> unit -> (unit -> 'a) -> 'a module Private_ : sig val mock_all_ : unit -> unit (** use fake, deterministic timestamps, TID, PID *) - - val on_tracing_error : (string -> unit) ref end (**/**) diff --git a/src/tef/collector_tef.ml b/src/tef/collector_tef.ml index 5976167..5a61774 100644 --- a/src/tef/collector_tef.ml +++ b/src/tef/collector_tef.ml @@ -16,21 +16,6 @@ open struct Int64.div t 1_000L |> Int64.to_float 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 = { active: bool A.t; pid: int; @@ -40,29 +25,6 @@ type t = { } (** 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 = if A.exchange self.active false then (* FIXME: print_non_closed_spans_warning self.spans; *) diff --git a/src/tef/collector_tef.mli b/src/tef/collector_tef.mli index a37224b..bf0fcfd 100644 --- a/src/tef/collector_tef.mli +++ b/src/tef/collector_tef.mli @@ -21,9 +21,3 @@ val callbacks_collector : t Collector.Callbacks.t val collector : t -> Collector.t (** Subscriber that writes json into this writer *) - -(**/**) - -val on_tracing_error : (string -> unit) ref - -(**/**) diff --git a/src/tef/trace_tef.ml b/src/tef/trace_tef.ml index a3935df..d26b78a 100644 --- a/src/tef/trace_tef.ml +++ b/src/tef/trace_tef.ml @@ -104,8 +104,6 @@ module Private_ = struct Trace_util.Mock_.mock_all (); () - let on_tracing_error = Collector_tef.on_tracing_error - let collector_jsonl ~finally ~out () : collector = collector_ ~finally ~mode:`Jsonl ~out () diff --git a/src/tef/trace_tef.mli b/src/tef/trace_tef.mli index d9cfb16..b66e3fa 100644 --- a/src/tef/trace_tef.mli +++ b/src/tef/trace_tef.mli @@ -43,8 +43,6 @@ module Private_ : sig val mock_all_ : unit -> unit (** use fake, deterministic timestamps, TID, PID *) - val on_tracing_error : (string -> unit) ref - val collector_jsonl : finally:(unit -> unit) -> out:[ `File_append of string | `Output of out_channel ] ->