feat: add Globals.service_version

This commit is contained in:
Simon Cruanes 2025-06-12 09:14:45 -04:00
parent f8d4ac7c3c
commit 4ee29d8504

View file

@ -687,6 +687,10 @@ module Globals = struct
(** Unique identifier for the service *)
let service_instance_id = ref None
(** Version for the service
@since NEXT_RELEASE *)
let service_version = ref None
let instrumentation_library =
default_instrumentation_scope ~version:"%%VERSION_NUM%%" ~name:"ocaml-otel"
()
@ -746,6 +750,14 @@ module Globals = struct
~value:(Some (String_value v)) ()
:: l
in
let l =
match !service_version with
| None -> l
| Some v ->
default_key_value ~key:Conventions.Attributes.Service.version
~value:(Some (String_value v)) ()
:: l
in
l |> merge_global_attributes_
end