imandra-ai / ocaml-opentelemetry

Instrumentation for https://opentelemetry.io
http://docs.imandra.ai/ocaml-opentelemetry/
33 stars 7 forks source link

Allow for more verbose debugging information #35

Open ELLIOTTCABLE opened 1 year ago

ELLIOTTCABLE commented 1 year ago

At the moment, enabling debugging via OTEL_OCAML_DEBUG=true ./binary.exe only prints information like the following:

opentelemetry: send http POST to http://127.0.0.1:5996/v1/traces (963B)
opentelemetry: send http POST to http://127.0.0.1:5996/v1/traces (963B)

I'd like, additionally, the ability to print on every single span entered and exited — effectively a verbose mode.

Is this better attached to OTEL_OCAML_DEBUG=true, implemented as a new payload like OTEL_OCAML_DEBUG=verbose, or as a separate env-var, like OTEL_OCAML_VERBOSE=true?

c-cube commented 1 year ago

After discussion: possibility to debug signals not being emitted because a collector hasn't been setup:

    let backend : backend option ref = ref None

could become:

    let backend : backend option ref =
     ref (match Sys.getenv_opt "OTEL_OCAML_DEBUG" with
       | Some _ -> Some debug_collector_
       | None -> None)

where debug_collector_ intercepts all spans/metrics/logs and prints them on stderr with a warning like "span ignored because no collector was setup".

ELLIOTTCABLE commented 1 year ago

(Though to be clear, that ^^ is a separate problem from "span-entry / span-exit debugging details, regardless of collector status)