mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-03-09 12:23:32 -04:00
Add common type for signals
This commit is contained in:
parent
b6448b330d
commit
a44e0cd3b5
2 changed files with 17 additions and 2 deletions
|
|
@ -5,6 +5,13 @@ module Span = Opentelemetry.Span
|
|||
|
||||
let ( let@ ) = ( @@ )
|
||||
|
||||
module Proto = Opentelemetry.Proto
|
||||
|
||||
type t =
|
||||
| Traces of Proto.Trace.resource_spans list
|
||||
| Metrics of Proto.Metrics.resource_metrics list
|
||||
| Logs of Proto.Logs.resource_logs list
|
||||
|
||||
module Encode = struct
|
||||
let resource_to_string ~encoder ~ctor ~enc resource =
|
||||
let encoder =
|
||||
|
|
@ -63,8 +70,6 @@ module Decode = struct
|
|||
end
|
||||
|
||||
module Pp = struct
|
||||
module Proto = Opentelemetry.Proto
|
||||
|
||||
let logs = Format.pp_print_list Proto.Logs.pp_resource_logs
|
||||
|
||||
let metrics = Format.pp_print_list Proto.Metrics.pp_resource_metrics
|
||||
|
|
|
|||
|
|
@ -1,6 +1,16 @@
|
|||
(** Constructing and managing OTel
|
||||
{{:https://opentelemetry.io/docs/concepts/signals/} signals} *)
|
||||
|
||||
(** The type of signals
|
||||
|
||||
This is not the principle type of signals from the perspective of what gets
|
||||
encoded and sent via protocl buffers, but it is the principle type that
|
||||
collector clients needs to reason about. *)
|
||||
type t =
|
||||
| Traces of Opentelemetry_proto.Trace.resource_spans list
|
||||
| Metrics of Opentelemetry_proto.Metrics.resource_metrics list
|
||||
| Logs of Opentelemetry_proto.Logs.resource_logs list
|
||||
|
||||
(** Encode signals to protobuf encoded strings, ready to be sent over the wire
|
||||
*)
|
||||
module Encode : sig
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue