Skip to content

Commit

Permalink
Merge pull request #5241 from snwoods/private/stevenwo/CP-46004
Browse files Browse the repository at this point in the history
CP-46004: Finish eventgen span to remove spans table clutter
  • Loading branch information
robhoes authored Nov 16, 2023
2 parents 08e8ec0 + f8bf6bb commit ea23c70
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
6 changes: 6 additions & 0 deletions ocaml/libs/tracing/tracing.ml
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,12 @@ module Export = struct
[
("export.span.count", List.length all_spans |> string_of_int)
; ("export.endpoint", endpoint_to_string endpoint)
; ( "xs.tracing.spans_table.count"
, Hashtbl.length Spans.spans |> string_of_int
)
; ( "xs.tracing.finished_spans_table.count"
, Hashtbl.length traces |> string_of_int
)
]
in
let@ _ = with_tracing ~parent ~attributes ~name in
Expand Down
9 changes: 7 additions & 2 deletions ocaml/xapi/eventgen.ml
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ let events_of_other_tbl_refs other_tbl_refs =
open Db_cache_types
open Db_action_helper

let database_callback event db =
let context = Context.make "eventgen" in
let database_callback_inner event db context =
let other_tbl_refs tblname = follow_references tblname in
let other_tbl_refs_for_this_field tblname fldname =
List.filter (fun (_, fld) -> fld = fldname) (other_tbl_refs tblname)
Expand Down Expand Up @@ -258,3 +257,9 @@ let database_callback event db =
events_notify ~snapshot:s tbl "mod" ref
)
other_tbl_events

let database_callback event db =
let context = Context.make "eventgen" in
Xapi_stdext_pervasives.Pervasiveext.finally
(fun () -> database_callback_inner event db context)
(fun () -> Context.complete_tracing context)

0 comments on commit ea23c70

Please sign in to comment.