mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-03-07 18:37:56 -05:00
small refactor
This commit is contained in:
parent
e0560ac730
commit
6e07d48d5d
1 changed files with 9 additions and 6 deletions
|
|
@ -2,14 +2,19 @@
|
|||
|
||||
open Common_
|
||||
|
||||
open struct
|
||||
let mk_resources ?service_name ?attrs () =
|
||||
let attributes = OTEL.Globals.mk_attributes ?service_name ?attrs () in
|
||||
Proto.Resource.make_resource ~attributes ()
|
||||
end
|
||||
|
||||
let make_resource_logs ?service_name ?attrs (logs : Proto.Logs.log_record list)
|
||||
: Proto.Logs.resource_logs =
|
||||
let attributes = OTEL.Globals.mk_attributes ?service_name ?attrs () in
|
||||
let resource = Proto.Resource.make_resource ~attributes () in
|
||||
let ll =
|
||||
Proto.Logs.make_scope_logs ~scope:OTEL.Globals.instrumentation_library
|
||||
~log_records:logs ()
|
||||
in
|
||||
let resource = mk_resources ?service_name ?attrs () in
|
||||
Proto.Logs.make_resource_logs ~resource ~scope_logs:[ ll ] ()
|
||||
|
||||
let make_resource_spans ?service_name ?attrs spans : Proto.Trace.resource_spans
|
||||
|
|
@ -18,8 +23,7 @@ let make_resource_spans ?service_name ?attrs spans : Proto.Trace.resource_spans
|
|||
Proto.Trace.make_scope_spans ~scope:OTEL.Globals.instrumentation_library
|
||||
~spans ()
|
||||
in
|
||||
let attributes = OTEL.Globals.mk_attributes ?service_name ?attrs () in
|
||||
let resource = Proto.Resource.make_resource ~attributes () in
|
||||
let resource = mk_resources ?service_name ?attrs () in
|
||||
Proto.Trace.make_resource_spans ~resource ~scope_spans:[ ils ] ()
|
||||
|
||||
(** Aggregate metrics into a {!Proto.Metrics.resource_metrics} *)
|
||||
|
|
@ -29,6 +33,5 @@ let make_resource_metrics ?service_name ?attrs (l : OTEL.Metrics.t list) :
|
|||
let lm =
|
||||
make_scope_metrics ~scope:OTEL.Globals.instrumentation_library ~metrics:l ()
|
||||
in
|
||||
let attributes = OTEL.Globals.mk_attributes ?service_name ?attrs () in
|
||||
let resource = Proto.Resource.make_resource ~attributes () in
|
||||
let resource = mk_resources ?service_name ?attrs () in
|
||||
Proto.Metrics.make_resource_metrics ~scope_metrics:[ lm ] ~resource ()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue