mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-03-08 03:47:59 -04:00
add client.Any_resource
This commit is contained in:
parent
4fc76ae3e4
commit
d1a451550b
1 changed files with 27 additions and 0 deletions
27
src/client/any_resource.ml
Normal file
27
src/client/any_resource.ml
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
open Opentelemetry.Proto
|
||||
|
||||
(** A resource *)
|
||||
type t =
|
||||
| R_metrics of Metrics.resource_metrics list
|
||||
| R_spans of Trace.resource_spans list
|
||||
| R_logs of Logs.resource_logs list
|
||||
|
||||
let of_logs logs : t = R_logs [ Util_resources.make_resource_logs logs ]
|
||||
|
||||
open struct
|
||||
let of_x_or_empty ~f l =
|
||||
if l = [] then
|
||||
[]
|
||||
else
|
||||
[ f l ]
|
||||
end
|
||||
|
||||
let of_logs_or_empty logs = of_x_or_empty ~f:of_logs logs
|
||||
|
||||
let of_spans spans : t = R_spans [ Util_resources.make_resource_spans spans ]
|
||||
|
||||
let of_spans_or_empty spans = of_x_or_empty ~f:of_spans spans
|
||||
|
||||
let of_metrics m : t = R_metrics [ Util_resources.make_resource_metrics m ]
|
||||
|
||||
let of_metrics_or_empty ms = of_x_or_empty ~f:of_metrics ms
|
||||
Loading…
Add table
Reference in a new issue