mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-03-08 03:47:59 -04:00
detail
This commit is contained in:
parent
f1b7a2237c
commit
7cd3d0321b
1 changed files with 13 additions and 9 deletions
|
|
@ -4,18 +4,22 @@ module Client = Opentelemetry_client
|
|||
module Signal = Client.Signal
|
||||
open Lwt.Syntax
|
||||
|
||||
let debug =
|
||||
match Sys.getenv_opt "DEBUG" with
|
||||
| Some "1" -> true
|
||||
| _ -> false
|
||||
|
||||
(* Server to collect telemetry data *)
|
||||
module Server = struct
|
||||
let dbg_request kind req pp data : unit Lwt.t =
|
||||
if debug then (
|
||||
let _ = kind, req, pp, data in
|
||||
(* NOTE: Uncomment for debugging *)
|
||||
(* let* () = *)
|
||||
(* let req : string = Format.asprintf "%a" Http.Request.pp req in *)
|
||||
(* let data_s : string = Format.asprintf "%a" pp data in *)
|
||||
(* Lwt_io.fprintf Lwt_io.stderr "# received %s\nREQUEST: %s\nBODY: %s\n@." *)
|
||||
(* kind req data_s *)
|
||||
(* in *)
|
||||
Lwt.return ()
|
||||
let req : string = Format.asprintf "%a" Http.Request.pp req in
|
||||
let data_s : string = Format.asprintf "%a" pp data in
|
||||
Lwt_io.fprintf Lwt_io.stderr "# received %s\nREQUEST: %s\nBODY: %s\n@."
|
||||
kind req data_s
|
||||
) else
|
||||
Lwt.return_unit
|
||||
|
||||
let handler push_signal _socket (request : Http.Request.t)
|
||||
(body : Cohttp_lwt.Body.t) =
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue