mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-03-09 04:17:56 -04:00
parent
f8079a13ea
commit
041d05eb9f
1 changed files with 12 additions and 4 deletions
|
|
@ -200,11 +200,19 @@ module Internal = struct
|
||||||
in
|
in
|
||||||
|
|
||||||
Otel.Scope.with_ambient_scope sb.scope @@ fun () ->
|
Otel.Scope.with_ambient_scope sb.scope @@ fun () ->
|
||||||
let rv = cb otrace_id in
|
match cb otrace_id with
|
||||||
|
| res ->
|
||||||
|
let otel_span = exit_span' otrace_id sb in
|
||||||
|
Otel.Trace.emit [ otel_span ];
|
||||||
|
res
|
||||||
|
| exception e ->
|
||||||
|
let bt = Printexc.get_raw_backtrace () in
|
||||||
|
|
||||||
let otel_span = exit_span' otrace_id sb in
|
Otel.Scope.record_exception sb.scope e bt;
|
||||||
Otel.Trace.emit [ otel_span ];
|
let otel_span = exit_span' otrace_id sb in
|
||||||
rv
|
Otel.Trace.emit [ otel_span ];
|
||||||
|
|
||||||
|
Printexc.raise_with_backtrace e bt
|
||||||
|
|
||||||
let enter_span ~__FUNCTION__ ~__FILE__ ~__LINE__ ~data name :
|
let enter_span ~__FUNCTION__ ~__FILE__ ~__LINE__ ~data name :
|
||||||
Trace_core.span =
|
Trace_core.span =
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue