mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-03-09 12:23:32 -04:00
enable warnings and fix them
This commit is contained in:
parent
de0d5ea197
commit
8e1a69d886
8 changed files with 3 additions and 26 deletions
2
dune
2
dune
|
|
@ -1,3 +1,3 @@
|
|||
(env
|
||||
(_
|
||||
(flags :standard -warn-error -a+8 -strict-sequence)))
|
||||
(flags :standard -warn-error -a+8 -w +a-4-30-40-41-42-44-70 -strict-sequence)))
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
open Lwt.Syntax
|
||||
module Atomic = Opentelemetry_atomic.Atomic
|
||||
|
||||
let[@inline] ( let@ ) f x = f x
|
||||
|
|
|
|||
|
|
@ -164,16 +164,8 @@ end
|
|||
module Batch : sig
|
||||
type 'a t
|
||||
|
||||
val push : 'a t -> 'a -> bool
|
||||
(** [push batch x] pushes [x] into the batch, and heuristically
|
||||
returns [true] if the batch is ready to be emitted (to know if we should
|
||||
wake up the sending thread, if any) *)
|
||||
|
||||
val push' : 'a t -> 'a -> unit
|
||||
|
||||
val is_ready : now:Mtime.t -> _ t -> bool
|
||||
(** is the batch ready to be sent? This is heuristic. *)
|
||||
|
||||
val pop_if_ready : ?force:bool -> now:Mtime.t -> 'a t -> 'a list option
|
||||
(** Is the batch ready to be emitted? If batching is disabled,
|
||||
this is true as soon as {!is_empty} is false. If a timeout is provided
|
||||
|
|
@ -205,8 +197,6 @@ end = struct
|
|||
high_watermark;
|
||||
}
|
||||
|
||||
let is_empty_ self = self.size = 0
|
||||
|
||||
let timeout_expired_ ~now self : bool =
|
||||
match self.timeout with
|
||||
| Some t ->
|
||||
|
|
@ -219,8 +209,6 @@ end = struct
|
|||
| None -> self.size > 0
|
||||
| Some b -> self.size >= b
|
||||
|
||||
let is_ready ~now self : bool = is_full_ self || timeout_expired_ ~now self
|
||||
|
||||
let pop_if_ready ?(force = false) ~now (self : _ t) : _ list option =
|
||||
if self.size > 0 && (force || is_full_ self || timeout_expired_ ~now self)
|
||||
then (
|
||||
|
|
|
|||
|
|
@ -143,7 +143,6 @@ end = struct
|
|||
?parent:(Option.map (fun scope -> scope.Otel.Trace.span_id) scope)
|
||||
?links name
|
||||
(fun scope ->
|
||||
let open Lwt.Syntax in
|
||||
let req = set_trace_context scope req in
|
||||
f req)
|
||||
end
|
||||
|
|
@ -152,7 +151,7 @@ let client ?(scope : Otel.Scope.t option) (module C : Cohttp_lwt.S.Client) =
|
|||
let module Traced = struct
|
||||
open Lwt.Syntax
|
||||
|
||||
let attrs_for ~uri ~meth () =
|
||||
let attrs_for ~uri ~meth:_ () =
|
||||
[
|
||||
"http.method", `String (Code.string_of_method `GET);
|
||||
"http.url", `String (Uri.to_string uri);
|
||||
|
|
|
|||
|
|
@ -58,7 +58,6 @@ module Trace = struct
|
|||
end
|
||||
|
||||
module Metrics = struct
|
||||
open Proto.Metrics
|
||||
include Metrics
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -252,8 +252,6 @@ module Trace_id : sig
|
|||
|
||||
val of_hex : string -> t
|
||||
end = struct
|
||||
open Proto.Trace
|
||||
|
||||
type t = bytes
|
||||
|
||||
let to_bytes self = self
|
||||
|
|
@ -294,8 +292,6 @@ module Span_id : sig
|
|||
|
||||
val of_hex : string -> t
|
||||
end = struct
|
||||
open Proto.Trace
|
||||
|
||||
type t = bytes
|
||||
|
||||
let to_bytes self = self
|
||||
|
|
|
|||
|
|
@ -28,8 +28,6 @@ let[@inline] get_exn (self : _ t) =
|
|||
|
||||
let[@inline] get self = try Some (get_exn self) with Not_found -> None
|
||||
|
||||
let[@inline] get_or ~default self = try get_exn self with Not_found -> default
|
||||
|
||||
(* remove reference for the key *)
|
||||
let remove_ref_ self key : unit =
|
||||
while
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@ module TLS = Otel.Thread_local
|
|||
|
||||
type span = Trace.span
|
||||
|
||||
let ( let@ ) = ( @@ )
|
||||
|
||||
(** Table indexed by Trace spans *)
|
||||
module Span_tbl = Hashtbl.Make (struct
|
||||
include Int64
|
||||
|
|
@ -119,7 +117,7 @@ let collector () : Trace.collector =
|
|||
|
||||
()
|
||||
|
||||
let message ?span ~data msg : unit =
|
||||
let message ?span ~data:_ msg : unit =
|
||||
(* gather information from context *)
|
||||
let old_scope = Otel.Scope.get_surrounding () in
|
||||
let trace_id = Option.map (fun sc -> sc.Otel.Scope.trace_id) old_scope in
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue