Skip to content

Commit 6fe1395

Browse files
authored
CP-50836: Add VM_migrate_downtime and request_shutdown spans to help visualise potential optimisations (xapi-project#6379)
Also simplify two tracing functions which could just use Span.get_trace_context directly
2 parents 2c87860 + caea30d commit 6fe1395

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

ocaml/libs/tracing/tracing.ml

+1-4
Original file line numberDiff line numberDiff line change
@@ -437,10 +437,7 @@ module Span = struct
437437

438438
let to_propagation_context span =
439439
let traceparent = span |> get_context |> SpanContext.to_traceparent in
440-
span
441-
|> get_context
442-
|> SpanContext.context_of_span_context
443-
|> TraceContext.with_traceparent (Some traceparent)
440+
span |> get_trace_context |> TraceContext.with_traceparent (Some traceparent)
444441

445442
let with_trace_context span trace_context =
446443
let span_context =

ocaml/libs/tracing/tracing_export.ml

+1-4
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,7 @@ module Content = struct
8383
)
8484
in
8585
let tags =
86-
let span_context = Span.get_context s in
87-
let trace_context =
88-
SpanContext.context_of_span_context span_context
89-
in
86+
let trace_context = Span.get_trace_context s in
9087
let baggage =
9188
TraceContext.baggage_of trace_context |> Option.value ~default:[]
9289
in

ocaml/xenopsd/lib/xenops_server.ml

+1
Original file line numberDiff line numberDiff line change
@@ -2988,6 +2988,7 @@ and perform_exn ?result (op : operation) (t : Xenops_task.task_handle) : unit =
29882988
]
29892989
)
29902990
t ;
2991+
with_tracing ~task:t ~name:"VM_migrate_downtime_end" Fun.id ;
29912992
Handshake.send s Handshake.Success ;
29922993
debug "VM.receive_memory: Synchronisation point 4"
29932994
with e ->

ocaml/xenopsd/xc/xenops_server_xen.ml

+8
Original file line numberDiff line numberDiff line change
@@ -2517,6 +2517,7 @@ module VM = struct
25172517
@@ fun () -> pre_suspend_callback task
25182518
) ;
25192519

2520+
with_tracing ~task ~name:"VM_save_request_shutdown" @@ fun () ->
25202521
if
25212522
not
25222523
( with_tracing ~task
@@ -2525,6 +2526,13 @@ module VM = struct
25252526
)
25262527
then
25272528
raise (Xenopsd_error Failed_to_acknowledge_suspend_request) ;
2529+
(* If this is for a migration, record the begin time *)
2530+
( match data with
2531+
| FD _ ->
2532+
with_tracing ~task ~name:"VM_migrate_downtime_begin" Fun.id
2533+
| _ ->
2534+
()
2535+
) ;
25282536
if
25292537
not
25302538
( with_tracing ~task

0 commit comments

Comments
 (0)