Skip to content

Commit d049d43

Browse files
committed
CP-48195: Add with_tracing helper function
Adds `with_tracing` helper function to `forkhelpers.ml`. This is to show that there are no more cycle dependecies between `tracing` library and `forexecd` and it will be used in a follow-up PR to instrument `forkhelpers` with tracing. Signed-off-by: Gabriel Buica <danutgabriel.buica@cloud.com>
1 parent af2f199 commit d049d43

File tree

5 files changed

+8
-3
lines changed

5 files changed

+8
-3
lines changed

forkexec.opam

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ depends: [
2121
"xapi-log"
2222
"xapi-stdext-pervasives"
2323
"xapi-stdext-unix"
24+
"xapi-tracing"
2425
]
2526
synopsis: "Sub-process control service for xapi"
2627
description:

forkexec.opam.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ depends: [
1919
"xapi-log"
2020
"xapi-stdext-pervasives"
2121
"xapi-stdext-unix"
22+
"xapi-tracing"
2223
]
2324
synopsis: "Sub-process control service for xapi"
2425
description:

ocaml/forkexecd/lib/dune

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
xapi-log
1313
xapi-stdext-pervasives
1414
xapi-stdext-unix
15+
xapi-tracing
1516
)
1617
(preprocess
1718
(pps ppx_deriving_rpc)))

ocaml/forkexecd/lib/forkhelpers.ml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ let test_path =
3636

3737
let runtime_path = Option.value ~default:"/var" test_path
3838

39+
let _with_tracing ?tracing ~name f =
40+
let name = Printf.sprintf "forkhelpers.%s" name in
41+
Tracing.with_tracing ?parent:tracing ~name f
42+
3943
let finally = Xapi_stdext_pervasives.Pervasiveext.finally
4044

4145
type pidty = Unix.file_descr * int

ocaml/tests/test_observer.ml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,7 @@ module TracerProvider = struct
7171
let find_provider_exn ~name =
7272
let providers = get_tracer_providers () in
7373
match
74-
List.find_opt
75-
(fun x -> TracerProvider.get_name_label x = name)
76-
providers
74+
List.find_opt (fun x -> TracerProvider.get_name_label x = name) providers
7775
with
7876
| Some provider ->
7977
provider

0 commit comments

Comments
 (0)