{"repo":"ocaml-tracing/ocaml-trace","free":true,"listed":false,"github":"https://github.com/ocaml-tracing/ocaml-trace","clone":"git clone https://github.com/ocaml-tracing/ocaml-trace.git","description":"Common interface for tracing/instrumentation libraries in OCaml","language":"OCaml","stars":35,"topics":["catapult","ocaml","tef","tracing","tracy"],"license":"MIT","category":"analytics","readme_excerpt":"Trace This small library provides basic types that can be used to instrument a library or application, either by hand or via a ppx. Features - [x] spans - [x] messages - [x] counters - [ ] other metrics? - [x] ppx to help instrumentation Usage To instrument your code, you can simply add trace to your dune/opam files, and then write code like such: The file test/t1.ml follows this pattern, using trace-tef as a simple backend that emits one JSON object per span/message: After running this, the file \"trace.json\" will contain something like: Opening it in https://ui.perfetto.dev we get something like this: ppx trace On OCaml = 4.12, and with ppxlib installed, you can install ppx trace . This is a preprocessor that will rewrite like so: This more or less corresponds to: Alternatively, a name can be provided for the span, which is useful if you want to access it and use functions like Trace.add data to span : Dune configuration In your library or executable stanza, add: (preprocess (pps ppx trace)) . The dependency on trace.core is automatically added. You still need to configure a backend to actually do collection. Backends (collector implementations) Concrete tracing or observability formats such as: - [x] Fuchsia (see the spec and tracing. Can be opened in https://ui.perfetto.dev) - Catapult [x] light bindings here with trace-tef . (Can be opened in https://ui.perfetto.dev) [x] backend for tldrs, a small rust daemon that aggregates TEF traces from multiple processes/clients into","default_branch":null,"files":null,"tree":[],"storefront":"/r/ocaml-tracing","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/ocaml-tracing/ocaml-trace/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}