mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-03-08 20:07:55 -04:00
Fix Signal encoder name choice
Don't know why I didn't opt for this clearer name originally.
This commit is contained in:
parent
d3235a1864
commit
39920ed109
4 changed files with 11 additions and 15 deletions
|
|
@ -190,7 +190,6 @@ end
|
|||
let mk_emitter ~stop ~(config : Config.t) () : (module EMITTER) =
|
||||
let open Proto in
|
||||
let open Lwt.Syntax in
|
||||
let module Conv = Signal.Converter in
|
||||
(* local helpers *)
|
||||
let open struct
|
||||
let timeout =
|
||||
|
|
@ -228,13 +227,13 @@ let mk_emitter ~stop ~(config : Config.t) () : (module EMITTER) =
|
|||
Lwt_unix.sleep 3.
|
||||
|
||||
let send_metrics_http client (l : Metrics.resource_metrics list) =
|
||||
Conv.metrics l |> send_http_ client ~url:config.url_metrics
|
||||
Signal.Encode.metrics l |> send_http_ client ~url:config.url_metrics
|
||||
|
||||
let send_traces_http client (l : Trace.resource_spans list) =
|
||||
Conv.traces l |> send_http_ client ~url:config.url_traces
|
||||
Signal.Encode.traces l |> send_http_ client ~url:config.url_traces
|
||||
|
||||
let send_logs_http client (l : Logs.resource_logs list) =
|
||||
Conv.logs l |> send_http_ client ~url:config.url_logs
|
||||
Signal.Encode.logs l |> send_http_ client ~url:config.url_logs
|
||||
|
||||
(* emit metrics, if the batch is full or timeout lapsed *)
|
||||
let emit_metrics_maybe ~now ?force httpc : bool Lwt.t =
|
||||
|
|
|
|||
|
|
@ -201,20 +201,19 @@ end = struct
|
|||
in
|
||||
conv l |> send_http_ ~stop ~config ~url client
|
||||
in
|
||||
let module Conv = Signal.Converter in
|
||||
try
|
||||
while not (Atomic.get stop) do
|
||||
let msg = B_queue.pop self.send_q in
|
||||
match msg with
|
||||
| To_send.Send_trace tr ->
|
||||
send ~name:"send-traces" ~conv:Conv.traces
|
||||
send ~name:"send-traces" ~conv:Signal.Encode.traces
|
||||
~url:config.common.url_traces tr
|
||||
| To_send.Send_metric ms ->
|
||||
send ~name:"send-metrics" ~conv:Conv.metrics
|
||||
send ~name:"send-metrics" ~conv:Signal.Encode.metrics
|
||||
~url:config.common.url_metrics ms
|
||||
| To_send.Send_logs logs ->
|
||||
send ~name:"send-logs" ~conv:Conv.logs ~url:config.common.url_logs
|
||||
logs
|
||||
send ~name:"send-logs" ~conv:Signal.Encode.logs
|
||||
~url:config.common.url_logs logs
|
||||
done
|
||||
with B_queue.Closed -> ()
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ module Span = Opentelemetry.Span
|
|||
|
||||
let ( let@ ) = ( @@ )
|
||||
|
||||
module Converter = struct
|
||||
module Encode = struct
|
||||
let resource_to_string ~encoder ~ctor ~enc resource =
|
||||
let encoder =
|
||||
match encoder with
|
||||
|
|
|
|||
|
|
@ -1,11 +1,9 @@
|
|||
(** Constructing and managing OTel
|
||||
{{:https://opentelemetry.io/docs/concepts/signals/} signals} *)
|
||||
|
||||
(** Convert signals to protobuf encoded strings, ready to be sent over the wire
|
||||
|
||||
NOTE: The converters share an underlying stateful encoder, so each domain or
|
||||
system thread should have its own [Converter] instance *)
|
||||
module Converter : sig
|
||||
(** Encode signals to protobuf encoded strings, ready to be sent over the wire
|
||||
*)
|
||||
module Encode : sig
|
||||
val logs :
|
||||
?encoder:Pbrt.Encoder.t ->
|
||||
Opentelemetry_proto.Logs.resource_logs list ->
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue