Skip to content

Commit

Permalink
improved logging for ocurl exporter
Browse files Browse the repository at this point in the history
  • Loading branch information
c-cube committed Jul 6, 2022
1 parent d3b366f commit 16667a3
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/client/opentelemetry_client_ocurl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ end = struct
let { curl; buf_res } = self in
Curl.reset curl;
if !debug_ then Curl.set_verbose curl true;
Curl.set_url curl (!url ^ path);
let full_url = !url ^ path in
Curl.set_url curl full_url;
Curl.set_httppost curl [];
let to_http_header (k, v) = Printf.sprintf "%s: %s" k v in
let http_headers = List.map to_http_header !headers in
Expand Down Expand Up @@ -146,11 +147,11 @@ end = struct
Error
(`Failure
(spf
"decoding of status (code=%d) failed with:\n\
"httpc: decoding of status (url=%S, code=%d) failed with:\n\
%s\n\
status: %S\n\
%s"
code (Printexc.to_string e) str bt))
full_url code (Printexc.to_string e) str bt))
)
| exception Sys.Break -> Error `Sysbreak
| exception Curl.CurlException (_, code, msg) ->
Expand All @@ -165,11 +166,11 @@ end = struct
| e ->
let bt = Printexc.get_backtrace () in
Error
(`Failure (spf "httpc: failed with:\n%s\n%s" (Printexc.to_string e) bt))
(`Failure
(spf "httpc: post on url=%S failed with:\n%s\n%s" full_url
(Printexc.to_string e) bt))
end

module type BATCH = sig end

(** Batch of resources to be pushed later.
This type is thread-safe. *)
Expand Down

0 comments on commit 16667a3

Please sign in to comment.