mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-03-08 20:07:55 -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
|
module Signal = Client.Signal
|
||||||
open Lwt.Syntax
|
open Lwt.Syntax
|
||||||
|
|
||||||
|
let debug =
|
||||||
|
match Sys.getenv_opt "DEBUG" with
|
||||||
|
| Some "1" -> true
|
||||||
|
| _ -> false
|
||||||
|
|
||||||
(* Server to collect telemetry data *)
|
(* Server to collect telemetry data *)
|
||||||
module Server = struct
|
module Server = struct
|
||||||
let dbg_request kind req pp data : unit Lwt.t =
|
let dbg_request kind req pp data : unit Lwt.t =
|
||||||
let _ = kind, req, pp, data in
|
if debug then (
|
||||||
(* NOTE: Uncomment for debugging *)
|
let _ = kind, req, pp, data in
|
||||||
(* let* () = *)
|
let req : string = Format.asprintf "%a" Http.Request.pp req in
|
||||||
(* let req : string = Format.asprintf "%a" Http.Request.pp req in *)
|
let data_s : string = Format.asprintf "%a" pp data in
|
||||||
(* let data_s : string = Format.asprintf "%a" pp data in *)
|
Lwt_io.fprintf Lwt_io.stderr "# received %s\nREQUEST: %s\nBODY: %s\n@."
|
||||||
(* Lwt_io.fprintf Lwt_io.stderr "# received %s\nREQUEST: %s\nBODY: %s\n@." *)
|
kind req data_s
|
||||||
(* kind req data_s *)
|
) else
|
||||||
(* in *)
|
Lwt.return_unit
|
||||||
Lwt.return ()
|
|
||||||
|
|
||||||
let handler push_signal _socket (request : Http.Request.t)
|
let handler push_signal _socket (request : Http.Request.t)
|
||||||
(body : Cohttp_lwt.Body.t) =
|
(body : Cohttp_lwt.Body.t) =
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue