Commit graph

32 commits

Author SHA1 Message Date
Simon Cruanes
44f87bdd6b
trace: remove meta_map, not used anymore 2026-01-17 22:39:25 -05:00
Simon Cruanes
67b3deb191
add Trace.with_setup_collector 2026-01-17 20:53:12 -05:00
Simon Cruanes
c89a031e43
core: enter_span takes an optional flavor
it's a core extension, it should be easy to use
2026-01-14 22:29:32 -05:00
Simon Cruanes
5018a9ead7
refactor core library
much cleaner now, and simpler.

- `span` is an open sum type, so it can carry as much info as we want
from enter to exit. This means most collectors shouldn't even need a
global table for spans!
- merge manual spans and spans. It's just spans now. Keep old
Trace_core.xxx_manual_xxx functions but deprecate them
- add `extension_parameter` to carry additional info to collector (eg
OTEL span kind, TEF sync/async, maybe span links, etc)
- make the collector into a record of callbacks + a state, for
efficiency (but also to make it easier to extend in the future with
callbacks that have a default implementation
)
2026-01-14 20:29:33 -05:00
Simon Cruanes
aeb2aff3b7
breaking: require subscribers to provide mk_span/mk_trace_id
we want control over this!
2025-12-04 12:31:14 -05:00
Simon Cruanes
d9cd7621f5
prepare for 0.10 2025-05-27 09:58:19 -04:00
Simon Cruanes
384dca93e2
fix: better retrocompat for enter_manual_{toplevel,sub}_span 2025-05-02 09:19:35 -04:00
Simon Cruanes
44fdc9557d
restore enter_manual_{sub,toplevel}_span, but deprecated
this will ease migration
2025-05-01 22:48:18 -04:00
Simon Cruanes
46242cd817
format 2025-04-11 12:25:47 -04:00
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
064e6e26bb
prepare for 0.9 2025-01-13 10:17:57 -05: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
62063f3f94
prepare for 0.7 2024-03-08 11:59:24 -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
f3ae3397de
fix docs 2023-10-11 13:29:37 -04: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
5d04850997
update doc
Co-authored-by: ELLIOTTCABLE <github.com@from.ec>
2023-08-30 20:23: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
96fb44e6bb
trace-tef: emit function name, if provided, as a metadata key/value pair
the key is "function". It is visible when selecting the span, typically.
2023-08-19 17:13:56 -04:00
Simon Cruanes
91c9da3b66
prepare for 0.3 2023-08-09 00:29:24 -04:00
Simon Cruanes
0eb6a84982 feat: add ?flavor argument to manual spans. 2023-08-09 00:26:21 -04:00
Simon Cruanes
dc4037a14e Update src/core/trace_core.mli
Co-authored-by: ELLIOTTCABLE <github.com@from.ec>
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
4ca766166f Update src/core/trace_core.mli
Co-authored-by: Corentin Leruth <corentin.leruth@gmail.com>
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
Renamed from src/trace.mli (Browse further)