ocurl: more info in debug mode

This commit is contained in:
Simon Cruanes 2024-03-07 11:31:30 -05:00
parent 4534b789ef
commit 03d9a6f9a2
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4

View file

@ -181,7 +181,9 @@ end = struct
in 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 ->
if !debug_ || config.debug then
Printf.eprintf "opentelemetry: got response code=%d\n%!" code
| Ok { code; body; headers = _; info = _ } -> | Ok { code; body; headers = _; info = _ } ->
Atomic.incr n_errors; Atomic.incr n_errors;
Self_trace.add_event _sc Self_trace.add_event _sc
@ -196,7 +198,8 @@ end = struct
with _ -> with _ ->
spf "(could not decode status)\nraw bytes: %s" (str_to_hex body) spf "(could not decode status)\nraw bytes: %s" (str_to_hex body)
in in
Printf.eprintf "error while sending:\n code=%d\n %s\n%!" code body Printf.eprintf
"opentelemetry: error while sending:\n code=%d\n %s\n%!" code body
); );
() ()
| exception Sys.Break -> | exception Sys.Break ->