Commit graph

17 commits

Author SHA1 Message Date
Simon Cruanes
151d80d0f1
breaking: feat(trace): pass a string trace_id in manual spans
- in entering manual spans, we now pass an explicit span_ctx that
  contains a trace_id (bytes) and the parent span id (int64).
- this makes compat with OTEL easier as we want this sort
  of span_ctx to be passed around.
2025-04-09 09:28:09 -04:00
Simon Cruanes
4dfa319003
feat: add an extensible sum type for extending the library
libraries and collectors can now define their own "events" that
collectors will handle (or not), without having to contribute them to
ocaml-trace at all.
2024-10-29 09:21:09 -04:00
Simon Cruanes
e76a977330 fixes: check for dummy spans in some operations 2024-03-08 11:45:28 -05:00
Simon Cruanes
b52f15068d add get_default_level() 2024-03-08 11:45:28 -05:00
Simon Cruanes
de8b51a9a2 feat: add levels to Trace_core.
these levels are used to control the verbosity levels.
2024-03-08 11:45:28 -05:00
Simon Cruanes
ef15941936
functions to enter/exit implicit spans 2023-12-22 20:10:58 -05:00
Simon Cruanes
0135a613a9 add ?data to counter_int and counter_float
this makes sense to add metadata in, say, opentelemetry
2023-09-16 21:29:01 -04:00
Simon Cruanes
431811c995
rename add_data_to_current_span; give it span explicitly 2023-09-13 14:43:16 -04:00
Simon Cruanes
e0fe99f500
rename add_data to add_data_to_current_span 2023-09-06 09:50:54 -04:00
Simon Cruanes
4137985d69
make add_data implicit (no span argument) 2023-08-30 20:23:52 -04:00
Simon Cruanes
c683f6331b
add add_data_to_span and add_data_to_explicit_span 2023-08-30 20:23:51 -04:00
Simon Cruanes
0eb6a84982 feat: add ?flavor argument to manual spans. 2023-08-09 00:26:21 -04:00
Simon Cruanes
1b5e827d65 fix inconsistency 2023-08-09 00:26:21 -04:00
Simon Cruanes
50b4691ab6 rename explicit span API 2023-08-09 00:26:21 -04:00
Simon Cruanes
a09a4fc69a refactor collector API as well.
After long discussions with @ELLIOTTCABLE, the collector should only
provide a `with_`-like function for regular spans. This allows
each concurrency library to use its native mechanism for local storage,
which is almost always based on such a scope function.
2023-08-09 00:26:21 -04:00
Simon Cruanes
b44e2f2923 Add explicit spans, for async tracing.
These spans require the user to pass the surrounding span, if any, when
entering a new span. They use the information inside (which is collector
specific) to track what asynchronous task is currently being executed.

Wrappers around `trace`, specific to an async library (e.g. Eio, lwt,
Async, etc.) can then smooth this over by providing a `with_async_span`
construct that uses some implicit contextual storage to carry the
`surrounding` scope around.
2023-08-09 00:26:21 -04:00
Simon Cruanes
ee2e5dd651
refactor: avoid the cursed stdlib Trace module by adding trace.core
this way, we can actually use only `trace.core` when we also expect to
use compiler-libs.toplevel (which contains a naked `Trace` module, which
would cause .cmi collisions). The library `trace` still exists, and just
forwards to `trace.core`.
2023-06-12 13:12:41 -04:00