Commit graph

189 commits

Author SHA1 Message Date
Simon Cruanes
6e07d48d5d
small refactor 2026-03-06 11:32:35 -05:00
Simon Cruanes
875101de9b
debug in bounded queue sync 2026-03-04 13:11:04 -05:00
Simon Cruanes
7c1eb2321b
fix self_trace by just relying on Trace_provider 2026-03-03 17:46:30 -05:00
Simon Cruanes
f1f379d2e1
client: use self-debug and new provider config 2026-03-03 17:15:53 -05:00
Simon Cruanes
a514ff8fe2
compat 4.08 2026-02-27 14:57:32 -05:00
Simon Cruanes
e3da59dd97
per signal provider, update to trace 0.12 2026-02-27 14:56:21 -05:00
Simon Cruanes
210b7991c9
rework tracer/meter/logger interfaces
- Meter is new, and makes more sense than
Metrics_callbacks/Metrics_emitter
- Instrument in core, with some basic counters, gauges, and histograms,
+ the possibility to do one's own
2026-02-20 12:31:15 -05:00
Simon Cruanes
07070e3d4a emitter: add self_metrics, track batch n_dropped, sampler rate 2026-02-17 20:59:58 -05:00
Simon Cruanes
71bb7d1996 various fixes 2026-02-17 20:59:58 -05:00
Simon Cruanes
33a0ee69ba
refactor: extract should_retry 2026-02-15 15:35:15 -05:00
Simon Cruanes
a44c50581b
Support http/json protocol, carry protocol to HTTP emitter
- Regenerate proto bindings with yojson support
- Add JSON encoding path in Resource_signal.Encode
- Pass protocol from config to generic_http_consumer
- Set Content-Type/Accept headers based on protocol
- Remove hardcoded protobuf headers from all HTTP client implementations
- Add yojson dependency
2026-02-15 15:35:15 -05:00
Simon Cruanes
e9485c97da
Add retry with exponential backoff to HTTP client
- Add retry_max_attempts, retry_initial_delay_ms, retry_max_delay_ms, retry_backoff_multiplier to config
- Retry on network failures, 5xx errors, 429 (rate limit), 408 (timeout)
- No retry on 4xx client errors or user interrupt (Sysbreak)
- Default: 3 attempts, 100ms initial delay, 5s max delay, 2x multiplier
- Uses existing IO.sleep_s from generic_io
2026-02-15 15:17:27 -05:00
Simon Cruanes
e2aa473cf9
slight refactor 2026-02-15 15:08:30 -05:00
Simon Cruanes
8b9ea57a02
tweaks 2026-02-13 20:38:03 -05:00
Simon Cruanes
5114b6a8e7
client ocurl: handle config.sdk_disabled 2026-02-12 21:27:20 -05:00
Simon Cruanes
69d1d512e3
add missing OTEL env variables
- Rename http_config to exporter_config with deprecated alias
- add OTEL_SDK_DISABLED support (sdk_disabled field)
- add OTEL_EXPORTER_OTLP_PROTOCOL support (Http_protobuf | Http_json)
- add OTEL_LOG_LEVEL support (log_level field replacing debug bool)
- add OTEL_EXPORTER_OTLP_TIMEOUT and per-signal timeout variants
- add per-signal headers
(OTEL_EXPORTER_OTLP_{TRACES,METRICS,LOGS}_HEADERS)
- add OTEL_SERVICE_NAME support

also remove some globals and put most config in `exporter_config.ml`,
which is no longer a private record.
2026-02-12 21:04:28 -05:00
Simon Cruanes
1ebd474423 fix: critical bugs found in code review
Bug #1: Fix worker count logic in generic_consumer
- Was: min 2 (max 500 n_workers) - always created 2 workers
- Now: max 2 (min 500 n_workers) - properly clamps between 2-500
- Impact: Worker configuration was completely ignored

Bug #2: Handle missing dot in __FUNCTION__ name
- Added exception handling for String.rindex in trace span creation
- Prevents crash when tracing top-level or non-module functions
- Uses option type for module_path when no dot is present
- Scoped try/catch to only parsing logic
2026-02-08 06:16:05 +00:00
Simon Cruanes
96aef5e021
use a separate ambient-context library 2026-01-20 00:15:31 -05:00
Simon Cruanes
f31062a602
rename batching modules 2026-01-20 00:15:30 -05:00
Simon Cruanes
31aadebfd6
typo 2026-01-20 00:15:30 -05:00
Simon Cruanes
f208a87eb8
remove Rpool, unused 2026-01-20 00:15:30 -05:00
Simon Cruanes
4f6334dac0
add Emitter_sample 2026-01-20 00:15:30 -05:00
Simon Cruanes
843d10dae1
detail 2026-01-20 00:15:30 -05:00
Simon Cruanes
d2d5b33751
add Emitter_limit_interval 2026-01-20 00:15:30 -05:00
Simon Cruanes
008ae6ddfd
add Emitter_add_batching to client library
fronting an emitter with a batch belongs in its own module
2026-01-20 00:15:29 -05:00
Simon Cruanes
07d8357cfb
docs 2026-01-20 00:15:29 -05:00
Simon Cruanes
cdd1289c1d
compat 4.08 2026-01-20 00:15:29 -05:00
Simon Cruanes
2d19ae2c46
compat with 4.08 2026-01-20 00:15:29 -05:00
Simon Cruanes
ae92077389
more docs 2026-01-20 00:15:29 -05:00
Simon Cruanes
5622d81ae7
test: change port for test_logs_e2e
otherwise sometimes it clashes with the ocurl client test
2026-01-20 00:15:28 -05:00
Simon Cruanes
d9362ae788
feat: add runtime/otel-specific name and version modifiable
this way we can mock them in tests, but we can also change the name
"ocaml-otel" to something else, e.g. if we have specific conventions.
2026-01-20 00:15:28 -05:00
Simon Cruanes
f5a13a1248
debug 2026-01-20 00:15:28 -05:00
Simon Cruanes
95e8c78ff8
merge any_signal/signal into resource_signal, dedup
we had duplication there! my bad.
2026-01-20 00:15:27 -05:00
Simon Cruanes
3dfbd14508
doc 2026-01-20 00:15:27 -05:00
Simon Cruanes
bf7eaa97bd
setup ambient context in lwt/eio client setups 2026-01-20 00:15:27 -05:00
Simon Cruanes
942a56c879
use mutex again to protect rand_bytes state
shard over 8 distinct random generators, though.
2026-01-20 00:15:26 -05:00
Simon Cruanes
e01a2f773b
use the correct clock in logger/metrics; use ptime_clock as default 2026-01-20 00:15:26 -05:00
Simon Cruanes
e4177c2843
client: split opentelemetry-client.sync off of main client library
that's the place for the synchronous primitives.
2026-01-20 00:15:26 -05:00
Simon Cruanes
e2c4a4e680
tracer/logger/metrics_emitter now pair emitter and clock
- clock is needed because timestamps need to be provided now
- explicit types are good anyway
- have at least one helper to emit the signal with optional
tracer/logger/metrics_emitter
- easier logger with `log` and `logf`
2026-01-20 00:15:25 -05:00
Simon Cruanes
092b9a5d2e
have a clock in exporter, pass a mtime in tick 2026-01-20 00:15:25 -05:00
Simon Cruanes
e4063e082e
batch: change ~now to ~mtime 2026-01-20 00:15:25 -05:00
Simon Cruanes
57a915e880
chore: update dune files after implicit_trans_deps=false 2026-01-20 00:15:25 -05:00
Simon Cruanes
09e4620603
rename Client_config to Http_config
more accurate, really.
2026-01-20 00:15:24 -05:00
Simon Cruanes
26bc862940
change default batch size for metrics 2026-01-20 00:15:24 -05:00
Simon Cruanes
a6bf8171bb
better semantic conventions for self tracing; bounded_queue.high_watermark 2026-01-20 00:15:23 -05:00
Simon Cruanes
ed69b89bf1
more self tracing 2026-01-20 00:15:23 -05:00
Simon Cruanes
212ff39d0b
doc 2026-01-20 00:15:23 -05:00
Simon Cruanes
e3c4b6fa3a
rename self-tracing metrics 2026-01-20 00:15:22 -05:00
Simon Cruanes
650f4c554f
fix warnings 2026-01-20 00:15:22 -05:00
Simon Cruanes
41e650d461
perf batch: try to improve hotpath
in particular, no need to look at the clock when checking if the batch
is full
2026-01-20 00:15:22 -05:00