diff --git a/src/client/util_resources.ml b/src/client/util_resources.ml index c64802e2..7ca16496 100644 --- a/src/client/util_resources.ml +++ b/src/client/util_resources.ml @@ -7,8 +7,7 @@ let make_resource_logs ?service_name ?attrs (logs : Proto.Logs.log_record list) 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 ()) + Proto.Logs.make_scope_logs ~scope:OTEL.Globals.instrumentation_library ~log_records:logs () in Proto.Logs.make_resource_logs ~resource ~scope_logs:[ ll ] () @@ -16,8 +15,7 @@ let make_resource_logs ?service_name ?attrs (logs : Proto.Logs.log_record list) let make_resource_spans ?service_name ?attrs spans : Proto.Trace.resource_spans = let ils = - Proto.Trace.make_scope_spans - ~scope:(OTEL.Globals.instrumentation_library ()) + Proto.Trace.make_scope_spans ~scope:OTEL.Globals.instrumentation_library ~spans () in let attributes = OTEL.Globals.mk_attributes ?service_name ?attrs () in @@ -29,9 +27,7 @@ let make_resource_metrics ?service_name ?attrs (l : OTEL.Metrics.t list) : Proto.Metrics.resource_metrics = let open Proto.Metrics in let lm = - make_scope_metrics - ~scope:(OTEL.Globals.instrumentation_library ()) - ~metrics:l () + 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 diff --git a/src/lib/globals.ml b/src/lib/globals.ml index a6be5231..c4d3c55b 100644 --- a/src/lib/globals.ml +++ b/src/lib/globals.ml @@ -16,14 +16,8 @@ let service_instance_id = ref None @since 0.12 *) let service_version = ref None -let instrumentation_name = ref "ocaml-otel" - -let instrumentation_runtime_version = ref "%%VERSION_NUM%%" - -let instrumentation_library () = - make_instrumentation_scope - ~version:!instrumentation_runtime_version - ~name:!instrumentation_name () +let instrumentation_library = + make_instrumentation_scope ~version:"%%VERSION_NUM%%" ~name:"ocaml-otel" () (** Global attributes, initially set via OTEL_RESOURCE_ATTRIBUTES and modifiable by the user code. They will be attached to each outgoing metrics/traces. *) diff --git a/tests/bin/emit_logs_cohttp.ml b/tests/bin/emit_logs_cohttp.ml index bc8fda98..80a744ef 100644 --- a/tests/bin/emit_logs_cohttp.ml +++ b/tests/bin/emit_logs_cohttp.ml @@ -69,7 +69,6 @@ let () = Sys.catch_break true; T.Globals.service_name := "t1"; T.Globals.service_namespace := Some "ocaml-otel.test"; - T.Globals.instrumentation_runtime_version := ""; let debug = ref false in let batch_traces = ref 400 in diff --git a/tests/logs/test_logs_e2e.ml b/tests/logs/test_logs_e2e.ml index a71ce7fa..8739a249 100644 --- a/tests/logs/test_logs_e2e.ml +++ b/tests/logs/test_logs_e2e.ml @@ -3,7 +3,7 @@ module L = Opentelemetry_proto.Logs (* NOTE: This port must be different from that used by other integration tests, to prevent socket binding clashes. *) -let port = 4359 +let port = 4399 let url = Printf.sprintf "http://localhost:%d" port