mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-03-11 21:18:33 -04:00
refine seld tracing
This commit is contained in:
parent
f0750cdfb5
commit
3d16de634f
1 changed files with 7 additions and 0 deletions
|
|
@ -147,11 +147,18 @@ end = struct
|
||||||
("Content-Type", "application/x-protobuf") :: config.headers
|
("Content-Type", "application/x-protobuf") :: config.headers
|
||||||
in
|
in
|
||||||
match
|
match
|
||||||
|
let@ _sc =
|
||||||
|
Trace'.with_ ~kind:Span.Span_kind_internal "curl.post"
|
||||||
|
~attrs:[ "sz", `Int (String.length data) ]
|
||||||
|
in
|
||||||
Ezcurl.post ~headers ~client ~params:[] ~url ~content:(`String data) ()
|
Ezcurl.post ~headers ~client ~params:[] ~url ~content:(`String data) ()
|
||||||
with
|
with
|
||||||
| Ok { code; _ } when code >= 200 && code < 300 -> ()
|
| Ok { code; _ } when code >= 200 && code < 300 -> ()
|
||||||
| Ok { code; body; headers = _; info = _ } ->
|
| Ok { code; body; headers = _; info = _ } ->
|
||||||
Atomic.incr n_errors;
|
Atomic.incr n_errors;
|
||||||
|
Trace'.add_event _sc (fun () ->
|
||||||
|
Opentelemetry.Event.make "error" ~attrs:[ "code", `Int code ]);
|
||||||
|
|
||||||
if !debug_ || config.debug then (
|
if !debug_ || config.debug then (
|
||||||
let dec = Pbrt.Decoder.of_string body in
|
let dec = Pbrt.Decoder.of_string body in
|
||||||
let body =
|
let body =
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue