mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-03-07 18:37:56 -05:00
refactor: get_global_attr_
This commit is contained in:
parent
20efd01366
commit
1cd536cb8e
1 changed files with 10 additions and 14 deletions
|
|
@ -227,27 +227,23 @@ module Globals = struct
|
||||||
|> List.map parse_pair
|
|> List.map parse_pair
|
||||||
with _ -> []
|
with _ -> []
|
||||||
|
|
||||||
|
let get_global_attr_ key =
|
||||||
|
global_attributes
|
||||||
|
|> List.find_map (fun kv ->
|
||||||
|
if kv.key = key then
|
||||||
|
match kv.value with Some (String_value v) -> Some v | _ -> None
|
||||||
|
else None)
|
||||||
|
|
||||||
|
|
||||||
(** Main service name metadata *)
|
(** Main service name metadata *)
|
||||||
let service_name =
|
let service_name =
|
||||||
let n =
|
let n = get_global_attr_ Conventions.Attributes.Service.name in
|
||||||
global_attributes
|
|
||||||
|> List.find_map (fun kv ->
|
|
||||||
if kv.key = Conventions.Attributes.Service.name then
|
|
||||||
match kv.value with Some (String_value v) -> Some v | _ -> None
|
|
||||||
else None)
|
|
||||||
in
|
|
||||||
let n = match n with Some v -> v | None -> "unknown_service" in
|
let n = match n with Some v -> v | None -> "unknown_service" in
|
||||||
ref n
|
ref n
|
||||||
|
|
||||||
(** Namespace for the service *)
|
(** Namespace for the service *)
|
||||||
let service_namespace =
|
let service_namespace =
|
||||||
let n =
|
let n = get_global_attr_ Conventions.Attributes.Service.namespace in
|
||||||
global_attributes
|
|
||||||
|> List.find_map (fun kv ->
|
|
||||||
if kv.key = Conventions.Attributes.Service.namespace then
|
|
||||||
match kv.value with Some (String_value v) -> Some v | _ -> None
|
|
||||||
else None)
|
|
||||||
in
|
|
||||||
ref n
|
ref n
|
||||||
|
|
||||||
let instrumentation_library =
|
let instrumentation_library =
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue