tef: emit last message when worker exits

This commit is contained in:
Simon Cruanes 2023-12-07 16:15:21 -05:00
parent 721212be27
commit 079949d139
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4

View file

@ -328,6 +328,11 @@ let bg_thread ~out (events : event B_queue.t) : unit =
List.iter handle_ev local List.iter handle_ev local
done done
with B_queue.Closed -> with B_queue.Closed ->
(* write a message about us closing *)
Writer.emit_instant_event ~name:"tef-worker.exit"
~tid:(Thread.id @@ Thread.self ())
~ts:(now_us ()) ~args:[] writer;
(* warn if app didn't close all spans *) (* warn if app didn't close all spans *)
if Span_tbl.length spans > 0 then if Span_tbl.length spans > 0 then
Printf.eprintf "trace-tef: warning: %d spans were not closed\n%!" Printf.eprintf "trace-tef: warning: %d spans were not closed\n%!"