Skip to content

Commit

Permalink
update for more recent trace
Browse files Browse the repository at this point in the history
  • Loading branch information
c-cube committed Sep 13, 2023
1 parent 921b5da commit 47839c7
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/trace/opentelemetry_trace.ml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module Active_spans = struct
parent_span: Otel.Span_id.t option;
start_time: int64;
name: string;
data: (string * Trace_core.user_data) list;
mutable data: (string * Trace_core.user_data) list;
__FILE__: string;
__LINE__: int;
new_scope: Otel.Scope.t;
Expand Down Expand Up @@ -89,6 +89,17 @@ let collector () : Trace_core.collector =
data;
} )

let add_data_to_span span data : unit =
let active_spans = Active_spans.get () in
match Span_tbl.find_opt active_spans.tbl span with
| None -> () (* TODO: log warning *)
| Some bsp -> bsp.data <- List.rev_append data bsp.data

let add_data_to_manual_span (es : Trace_core.explicit_span) data =
match Meta_map.find k_begin_span es.meta with
| None -> () (* TODO: log warning *)
| Some bsp -> bsp.data <- List.rev_append data bsp.data

let enter_span ?__FUNCTION__:_ ~__FILE__ ~__LINE__ ~data name : span =
let span, bsp = enter_span_ ~__FILE__ ~__LINE__ ~data name in
let active_spans = Active_spans.get () in
Expand Down

0 comments on commit 47839c7

Please sign in to comment.