mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-03-09 04:17:56 -04:00
update for more recent trace
This commit is contained in:
parent
30c36bb85a
commit
d01b951fcd
1 changed files with 12 additions and 1 deletions
|
|
@ -18,7 +18,7 @@ module Active_spans = struct
|
||||||
parent_span: Otel.Span_id.t option;
|
parent_span: Otel.Span_id.t option;
|
||||||
start_time: int64;
|
start_time: int64;
|
||||||
name: string;
|
name: string;
|
||||||
data: (string * Trace_core.user_data) list;
|
mutable data: (string * Trace_core.user_data) list;
|
||||||
__FILE__: string;
|
__FILE__: string;
|
||||||
__LINE__: int;
|
__LINE__: int;
|
||||||
new_scope: Otel.Scope.t;
|
new_scope: Otel.Scope.t;
|
||||||
|
|
@ -89,6 +89,17 @@ let collector () : Trace_core.collector =
|
||||||
data;
|
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 enter_span ?__FUNCTION__:_ ~__FILE__ ~__LINE__ ~data name : span =
|
||||||
let span, bsp = enter_span_ ~__FILE__ ~__LINE__ ~data name in
|
let span, bsp = enter_span_ ~__FILE__ ~__LINE__ ~data name in
|
||||||
let active_spans = Active_spans.get () in
|
let active_spans = Active_spans.get () in
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue