Skip to content
Open
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
357 commits
Select commit Hold shift + click to select a range
f1437a8
feat client: generic consumer, notifier, etc.
c-cube Dec 6, 2025
f1ee614
refactor ocurl, ocurl_lwt, cohttp_lwt clients to use generic consumer
c-cube Dec 6, 2025
cd4eb06
improve notifier_lwt
c-cube Dec 6, 2025
e0ff144
move Util_thread.MCond to Notifier_sync
c-cube Dec 6, 2025
6eeb0b9
todo
c-cube Dec 6, 2025
8de53d9
refactor eio client
c-cube Dec 6, 2025
1ef992c
update opam files
c-cube Dec 6, 2025
da6ac17
wip: fix tests
c-cube Dec 6, 2025
ee40e44
fix notifier_sync
c-cube Dec 6, 2025
c24dbeb
fix metrics_callbacks' API to make it easier
c-cube Dec 6, 2025
2e3120f
wip: fix tests
c-cube Dec 6, 2025
27a59d9
fix dune files
c-cube Dec 6, 2025
d49346c
fix test_implicit_scope_sync
c-cube Dec 6, 2025
6e3f7e5
client eio: fixes
c-cube Dec 8, 2025
b429336
export more from opentelemetry_lwt
c-cube Dec 8, 2025
5daef68
client config: improve printer
c-cube Dec 8, 2025
9f5506c
refactor
c-cube Dec 8, 2025
386879b
wip: fix tests
c-cube Dec 8, 2025
3a52b16
fix warnings
c-cube Dec 8, 2025
abe022d
feat batch: get rid of `Mutex`
c-cube Dec 2, 2025
f55775a
feat: opentelemetry.domain shim
c-cube Dec 2, 2025
eeae5bf
perf batch: proper backoff strategy
c-cube Dec 2, 2025
25afa20
feat batch: proper closing of `wrap_emitter`; default batch=100
c-cube Dec 8, 2025
61f17fa
better exporter/emitter combinators; better cleanup (now `shutdown`)
c-cube Dec 8, 2025
ee91fa4
feat util: add Aswitch and Util_atomic
c-cube Dec 8, 2025
18b653a
add Any_signal_l; modify Exporter to use Aswitch
c-cube Dec 8, 2025
3026ad4
use Aswitch in main library
c-cube Dec 8, 2025
1526827
client: start heavily refactoring to use Aswitch, also fix bugs
c-cube Dec 8, 2025
0bf561b
update client libraries, remove `stop:bool atomic` in favor of switches
c-cube Dec 8, 2025
2a3295a
update emitter tests
c-cube Dec 8, 2025
87ccde2
stray debug msg
c-cube Dec 8, 2025
e3c6c41
wip: bugfixing
c-cube Dec 8, 2025
6436f0e
utils in Any_signal_l
c-cube Dec 9, 2025
d7da4c4
feat client: overhaul of bounded queue; generic_consumer
c-cube Dec 9, 2025
b044203
update HTTP clients
c-cube Dec 9, 2025
83ba6d2
chore: remove dep on saturn
c-cube Dec 9, 2025
6151fe0
basic emit1_stdout test exe
c-cube Dec 9, 2025
173131c
warnings
c-cube Dec 9, 2025
0eb2717
fix batch: default high watermark was wrong
c-cube Dec 10, 2025
374a67c
fix bounded queue: `try_pop` should drain a closed queue
c-cube Dec 10, 2025
631f7cd
refactor, remove debug print
c-cube Dec 10, 2025
03f5741
emit1: more options
c-cube Dec 10, 2025
0986c2a
emit1: no syscall for sleep=0
c-cube Dec 10, 2025
6c832df
test binary
c-cube Dec 10, 2025
2d8939a
fix batch: make sure high_watermark>=batch, also put a max on batch size
c-cube Dec 10, 2025
239d9d5
feat exporter: add self_metrics
c-cube Dec 10, 2025
bfde770
ocurl: add an `?after_shutdown` callback
c-cube Dec 10, 2025
3eba3df
fix emit1: count alloc spans properly; self tracing
c-cube Dec 10, 2025
4a61ab4
metrics: do not add a default `start_time_unix_nano`
c-cube Dec 10, 2025
fda8700
generic consumer: sanity check on queue size
c-cube Dec 10, 2025
dd29cdd
detail
c-cube Dec 10, 2025
a0738e5
fix warning
c-cube Dec 10, 2025
370c2a7
move Util_mutex to client
c-cube Dec 10, 2025
41e650d
perf batch: try to improve hotpath
c-cube Dec 10, 2025
650f4c5
fix warnings
c-cube Dec 10, 2025
e3c4b6f
rename self-tracing metrics
c-cube Dec 10, 2025
4e0d59d
add basic test file for ocurl-lwt
c-cube Dec 10, 2025
212ff39
doc
c-cube Dec 10, 2025
ed69b89
more self tracing
c-cube Dec 10, 2025
a6bf817
better semantic conventions for self tracing; bounded_queue.high_wate…
c-cube Dec 10, 2025
b555986
add after_shutdown to ocurl-lwt client
c-cube Dec 10, 2025
30baf34
use an interval limiter for the metrics_callbacks
c-cube Dec 10, 2025
18226a6
add Span.dummy
c-cube Dec 10, 2025
a2a7a6c
re-export in dune
c-cube Dec 10, 2025
30175db
feat trace: add set_span_status
c-cube Dec 10, 2025
fe8316d
add picos backend to ambient-context
c-cube Dec 10, 2025
0d34f9d
feat trace: move to regular Otrace.span for extensions
c-cube Dec 11, 2025
9e11659
compat with older OCaml
c-cube Dec 11, 2025
26bc862
change default batch size for metrics
c-cube Dec 12, 2025
dfb0bef
perf: little optim in opentelemetry_trace
c-cube Dec 12, 2025
09e4620
rename Client_config to Http_config
c-cube Dec 15, 2025
03c687b
chore: update makefile to add doc targets
c-cube Dec 15, 2025
b4c8803
fix tests after renaming Http_config
c-cube Dec 16, 2025
a954deb
refactor opentelemetry.trace to cleanly separate trace spans from OTE…
c-cube Dec 16, 2025
a3e1fcc
add clock
c-cube Dec 17, 2025
f2635cc
move timestamp to util
c-cube Dec 17, 2025
34429ea
implicit trans deps=false
c-cube Dec 17, 2025
57a915e
chore: update dune files after implicit_trans_deps=false
c-cube Dec 17, 2025
061d2ad
more dune files
c-cube Dec 17, 2025
e4063e0
batch: change ~now to ~mtime
c-cube Dec 17, 2025
092b9a5
have a clock in exporter, pass a mtime in `tick`
c-cube Dec 17, 2025
dd2fe8f
add opentelemetry_ptime with a clock
c-cube Dec 17, 2025
ec584b4
update otel trace
c-cube Dec 17, 2025
e2c4a4e
tracer/logger/metrics_emitter now pair emitter and clock
c-cube Dec 17, 2025
43cd3aa
merge back ptime clock into `Clock`, make it default
c-cube Dec 17, 2025
bef4bd8
use Clock.ptime_clock where it makes sense
c-cube Dec 17, 2025
14cd25d
fix in otel-lwt related to termination
c-cube Dec 17, 2025
05ad042
timestamp_ns.pp_debug: use full RFC3339 to print timestamps
c-cube Dec 17, 2025
3c08842
fixes and cleanup in cohttp-eio client
c-cube Dec 17, 2025
dc99897
improvements in clients
c-cube Dec 17, 2025
1853fa7
fix some tests
c-cube Dec 17, 2025
62cd8c0
disable warning 58
c-cube Dec 17, 2025
e4177c2
client: split `opentelemetry-client.sync` off of main client library
c-cube Dec 17, 2025
c9f5a27
test binaries: updates
c-cube Dec 17, 2025
46960e2
otel-cohttp-lwt: simplify cleanup
c-cube Dec 17, 2025
e01a2f7
use the correct clock in logger/metrics; use ptime_clock as default
c-cube Dec 17, 2025
942a56c
use mutex again to protect rand_bytes state
c-cube Dec 17, 2025
bf7eaa9
setup ambient context in lwt/eio client setups
c-cube Dec 17, 2025
5596552
wip: fix the e2e tests
c-cube Dec 17, 2025
3dfbd14
doc
c-cube Dec 21, 2025
95e8c78
merge any_signal/signal into resource_signal, dedup
c-cube Dec 21, 2025
f8269ed
the test library was wrong!!!
c-cube Dec 21, 2025
3b6e239
debug
c-cube Dec 25, 2025
b4b864a
fix otel-lwt: logic for tracer.with_ was invalid
c-cube Dec 25, 2025
d355901
emit1_cohttp: more options, more debug
c-cube Dec 25, 2025
6ddfe17
more e2e tests, including cohttp_lwt
c-cube Dec 25, 2025
f5a13a1
debug
c-cube Dec 26, 2025
ca64820
try to fix CI
c-cube Dec 28, 2025
a2cee3d
fix
c-cube Dec 28, 2025
581590a
fix build
c-cube Dec 28, 2025
dc21341
try to fix compat with versions of cohttp
c-cube Dec 28, 2025
ea1c6ba
CI: pin ocaml-trace to a specific commit
c-cube Dec 28, 2025
d9362ae
feat: add runtime/otel-specific name and version modifiable
c-cube Dec 28, 2025
5622d81
test: change port for test_logs_e2e
c-cube Dec 28, 2025
979a3ab
test: redact current ocaml version from signal-gatherer output
c-cube Dec 28, 2025
b1589cc
stupid fix
c-cube Dec 28, 2025
ae92077
more docs
c-cube Dec 28, 2025
7b5b451
finally redact these logs
c-cube Dec 28, 2025
2d19ae2
compat with 4.08
c-cube Dec 28, 2025
cdd1289
compat 4.08
c-cube Dec 28, 2025
ce33809
ocurl lwt test
c-cube Jan 9, 2026
2d6ec5c
remove temporary code in ambient-context
c-cube Jan 13, 2026
513aafe
span: carry flags over to span_link
c-cube Jan 13, 2026
07d8357
docs
c-cube Jan 13, 2026
008ae6d
add Emitter_add_batching to client library
c-cube Jan 13, 2026
3ba0523
details on Interval_limiter
c-cube Jan 13, 2026
d2d5b33
add Emitter_limit_interval
c-cube Jan 13, 2026
843d10d
detail
c-cube Jan 13, 2026
4f6334d
add Emitter_sample
c-cube Jan 13, 2026
f208a87
remove Rpool, unused
c-cube Jan 13, 2026
55a5d1e
disable nix CI for now
c-cube Jan 13, 2026
31aadeb
typo
c-cube Jan 13, 2026
f31062a
rename batching modules
c-cube Jan 13, 2026
1a77e8d
remove matt from codeowners
c-cube Jan 13, 2026
696a5d4
tidy up src/lib
c-cube Jan 13, 2026
610244a
doc
c-cube Jan 13, 2026
0099bc5
compat 4.08
c-cube Jan 13, 2026
96aef5e
use a separate ambient-context library
c-cube Jan 17, 2026
26e70ed
refactor trace: adapt to newer trace 0.99
c-cube Jan 17, 2026
ee144ae
use an opam pin in CI
c-cube Jan 17, 2026
0c119c3
details
c-cube Jan 18, 2026
95fe450
CI
c-cube Jan 20, 2026
47ce0b2
CI: pin+install ambient-context
c-cube Jan 21, 2026
9af7e07
CI: trace refactor was merged into main
c-cube Jan 21, 2026
a3d375c
CI
c-cube Jan 21, 2026
4183254
update trace, fix opentelemetry.trace
c-cube Jan 22, 2026
c29ac75
opentelemetry.trace: expose sum and hist metrics
c-cube Jan 22, 2026
1ebd474
fix: critical bugs found in code review
c-cube Feb 8, 2026
21e799a
Fix ezcurl 0.3 compatibility issue
c-cube Feb 8, 2026
6f1e162
Merge pull request #117 from ocaml-tracing/simon/refactor-main-otel-api
c-cube Feb 11, 2026
6fe90a3
try to fix CI
c-cube Feb 11, 2026
9696dfb
relax bounds on trace, 0.11 is the one we want
c-cube Feb 11, 2026
69d1d51
add missing OTEL env variables
c-cube Feb 12, 2026
103886e
remove obsolete test
c-cube Feb 13, 2026
ccd4c43
fix test
c-cube Feb 13, 2026
5114b6a
client ocurl: handle config.sdk_disabled
c-cube Feb 13, 2026
649d4b8
handle sdk_disabled in all clients
c-cube Feb 13, 2026
8b9ea57
tweaks
c-cube Feb 14, 2026
e2aa473
slight refactor
c-cube Feb 15, 2026
a54593c
Merge pull request #122 from ocaml-tracing/simon/missing-env-vars
c-cube Feb 15, 2026
e9485c9
Add retry with exponential backoff to HTTP client
c-cube Feb 14, 2026
a43587f
rename hmap keys with more consistent scheme
c-cube Feb 15, 2026
a44c505
Support http/json protocol, carry protocol to HTTP emitter
c-cube Feb 15, 2026
33a0ee6
refactor: extract `should_retry`
c-cube Feb 15, 2026
126e25b
Merge pull request #123 from ocaml-tracing/simon/http-retry
c-cube Feb 15, 2026
71bb7d1
various fixes
c-cube Feb 17, 2026
07070e3
emitter: add self_metrics, track batch n_dropped, sampler rate
c-cube Feb 18, 2026
4387bf8
fix missing dep
c-cube Feb 19, 2026
cb53b54
trace: expose the OTEL span
c-cube Feb 19, 2026
7cc0ee1
CI: remove gh-pages, add format
c-cube Feb 19, 2026
d5f6b56
shortcut in clock
c-cube Feb 20, 2026
210b799
rework tracer/meter/logger interfaces
c-cube Feb 20, 2026
806545f
format
c-cube Feb 22, 2026
e3da59d
per signal provider, update to trace 0.12
c-cube Feb 27, 2026
a514ff8
compat 4.08
c-cube Feb 27, 2026
14e8924
opam
c-cube Feb 27, 2026
fa14ddf
helpers to emit in *_provider
c-cube Mar 3, 2026
478fe1d
otel.trace: have a single collector that always use current *_provider
c-cube Mar 3, 2026
df643c9
add self_debug and provider_config
c-cube Mar 3, 2026
f1f379d
client: use self-debug and new provider config
c-cube Mar 3, 2026
d86b883
clients: setup self-debug as well
c-cube Mar 3, 2026
8d4ca8f
update test binaries
c-cube Mar 3, 2026
7c1eb23
fix self_trace by just relying on Trace_provider
c-cube Mar 3, 2026
20e395a
fix span: missign checks for dummy span
c-cube Mar 3, 2026
e72b986
test: add test to check Span.dummy never gets modified
c-cube Mar 3, 2026
4a09775
revert to no batching by default in Provider_config
c-cube Mar 4, 2026
f70e5ae
fix test
c-cube Mar 4, 2026
875101d
debug in bounded queue sync
c-cube Mar 4, 2026
31190a3
providers: self debug at installation
c-cube Mar 4, 2026
c442f3b
batch: update n_dropped correctly; also self_debug in Emitter_batch
c-cube Mar 4, 2026
e2fe0f6
dune shenanigan
c-cube Mar 5, 2026
05ef03b
Span.record_exception must also set the span status to error
c-cube Mar 5, 2026
e97088f
fix warning
c-cube Mar 5, 2026
a28f24d
metrics: use main clock by default for data points
c-cube Mar 5, 2026
0c29da4
meter: add `emit`
c-cube Mar 5, 2026
b92159c
add Meter_provider.emit_l
c-cube Mar 5, 2026
ba264c7
add auto-generated `Version` module to main lib
c-cube Mar 6, 2026
e0560ac
globals: add sdk name+vesion to resource attributes
c-cube Mar 6, 2026
6e07d48
small refactor
c-cube Mar 6, 2026
d77dbac
fix warning by explicitly including unix
c-cube Mar 6, 2026
068baca
follow otel semconv
c-cube Mar 6, 2026
6faf238
format
c-cube Mar 6, 2026
d974213
fix tests
c-cube Mar 6, 2026
aa9e3f9
try weirder tricks for version generation
c-cube Mar 6, 2026
00d41b5
format
c-cube Mar 6, 2026
d57c182
add config parameter for `self_metrics`
c-cube Mar 6, 2026
aa86fc4
wip changelog
c-cube Mar 6, 2026
ce3c858
http clients: carry a description of the export attempt into error me…
c-cube Mar 9, 2026
31e9812
better logging for http consumer
c-cube Mar 9, 2026
54dc4d0
use newer mirage-crypto-rng-eio
ushitora-anqou Mar 8, 2026
858de42
revert to just dune-build-info
c-cube Mar 13, 2026
74055f5
re_export
c-cube Mar 13, 2026
ceb3fb7
format
c-cube Mar 13, 2026
2c52df1
add pre-commit hook for formatting
c-cube Mar 13, 2026
748f235
move to dune 3.11, remove dune-build-info
c-cube Mar 13, 2026
174e9c6
fix warning
c-cube Mar 13, 2026
470a461
fix warnings
c-cube Mar 13, 2026
c0d9492
format
c-cube Mar 13, 2026
74022be
compatibility with lwt 6 (#128)
raphael-proust Mar 13, 2026
40b8494
ugh
c-cube Mar 13, 2026
d316e2a
update opam files
c-cube Apr 1, 2026
7b06ccb
changelog+docs update
c-cube Apr 1, 2026
9c6245e
fix: compat with mtime < 2.1
c-cube Apr 2, 2026
31cc90a
more robust detection of lwt's version
c-cube Apr 2, 2026
7f9b7d7
fix opam
c-cube Apr 2, 2026
6a46859
preparing for 0.90
c-cube Apr 1, 2026
7691512
fix dumb circular dep
c-cube Apr 4, 2026
8ebc582
add gh-pages back (!)
c-cube Apr 6, 2026
5031be8
use docker images for CI (#130)
c-cube Apr 6, 2026
7555098
fix docker build
c-cube Apr 6, 2026
78e44e9
move from ocurl to curl
c-cube Apr 6, 2026
b766f86
CI
c-cube Apr 6, 2026
e9bb76e
expose Self_debug.level_above
c-cube Apr 9, 2026
7a93a25
better warning in bounded_queue_sync
c-cube Apr 10, 2026
9cb9c10
config: better defaults in Sdk, have batching enabled by default
c-cube Apr 10, 2026
fd47118
fix
c-cube Apr 10, 2026
2401745
fix: retries are self_debug logged at warning level
c-cube Apr 10, 2026
5f3b162
bounded queue: provide a per-item measure function for better errors/…
c-cube Apr 10, 2026
59e2e85
docs
c-cube Apr 15, 2026
a4d9540
better error message for otlp http failures
c-cube Apr 17, 2026
3bf18fe
fix test being in the wrong package
c-cube Apr 21, 2026
0cf7252
fix warning
c-cube Apr 23, 2026
5065cdd
prepare for 0.91
c-cube Apr 20, 2026
7cd974c
fix: in trace, respect ~parent:P_none
c-cube May 8, 2026
5da9efd
fix: lazy init of random generators
c-cube May 8, 2026
3b403aa
prepare for 0.91.1
c-cube May 26, 2026
3b4ec8b
Revert "pin actions"
ajbt200128 Sep 2, 2026
b9f8a73
Revert "Pin GitHub Actions to commit SHAs"
ajbt200128 Sep 2, 2026
e989e9f
Merge upstream/main (v0.91.1) into semgrep fork
ajbt200128 Sep 2, 2026
7f34132
ci: re-pin GitHub Actions to full commit SHAs
ajbt200128 Sep 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
* @c-cube @mattjbray
* @c-cube

18 changes: 18 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: format

on:
push:
branches:
- main
pull_request:

jobs:
format:
name: format
runs-on: ubuntu-latest
container: ghcr.io/ocaml-tracing/ocaml-opentelemetry/ci-4.14:latest

steps:
- uses: actions/checkout@v6
Comment thread
semgrep-zcs-prod-semgrep[bot] marked this conversation as resolved.
Outdated

- run: opam exec -- make format-check
32 changes: 18 additions & 14 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,33 @@ on:
branches:
- main

permissions:
contents: write
packages: read

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
container: ghcr.io/ocaml-tracing/ocaml-opentelemetry/ci-5.4:latest

# needed for depext to work
- run: sudo apt-get update && sudo apt-get install mccs

- uses: ocaml/setup-ocaml@15d660006c1d3110d77c34b7faa3bddefe8b82f0 # v3.7.0
steps:
- uses: actions/checkout@v6
Comment thread
semgrep-zcs-prod-semgrep[bot] marked this conversation as resolved.
Outdated
with:
ocaml-compiler: '5.1.x'
dune-cache: true
allow-prerelease-opam: true
submodules: recursive

- name: Deps
run: opam install odig opentelemetry opentelemetry-lwt opentelemetry-client-ocurl opentelemetry-cohttp-lwt
- name: Install local packages
run: opam exec -- dune build @install && opam exec -- dune install

- name: Build
run: opam exec -- odig odoc --cache-dir=_doc/ opentelemetry opentelemetry-lwt opentelemetry-client-ocurl opentelemetry-cohttp-lwt
- name: Build documentation
run: |
opam exec -- odig odoc --cache-dir=_doc/ \
opentelemetry opentelemetry-client opentelemetry-lwt \
opentelemetry-cohttp-lwt opentelemetry-client-ocurl \
opentelemetry-client-ocurl-lwt opentelemetry-client-cohttp-lwt \
opentelemetry-client-cohttp-eio opentelemetry-logs

- name: Deploy
uses: peaceiris/actions-gh-pages@373f7f263a76c20808c831209c920827a82a2847 # v3.9.3
uses: peaceiris/actions-gh-pages@v3
Comment thread
semgrep-zcs-prod-semgrep[bot] marked this conversation as resolved.
Outdated
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./_doc/html
Expand Down
75 changes: 25 additions & 50 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,62 +11,37 @@ jobs:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
#- windows-latest
#- macos-latest
ocaml-compiler:
- 4.08.x
- 4.13.x
- 5.0.x
- 5.3.x

runs-on: ${{ matrix.os }}
include:
- ocaml-version: "4.08"
container: ghcr.io/ocaml-tracing/ocaml-opentelemetry/ci-4.08:latest
eio: false
- ocaml-version: "4.14"
container: ghcr.io/ocaml-tracing/ocaml-opentelemetry/ci-4.14:latest
eio: false
- ocaml-version: "5.4"
container: ghcr.io/ocaml-tracing/ocaml-opentelemetry/ci-5.4:latest
eio: true

runs-on: ubuntu-latest
container: ${{ matrix.container }}

steps:
- name: Checkout code
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: actions/checkout@v6

@semgrep-zcs-prod-semgrep semgrep-zcs-prod-semgrep Bot Sep 2, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608.

🎈 Fixed in commit 7f34132 🎈

with:
submodules: recursive

# needed for depext to work
- run: sudo apt-get update && sudo apt-get install mccs
if: ${{ matrix.os == 'ubuntu-latest' }}

- name: Use OCaml ${{ matrix.ocaml-compiler }}
uses: ocaml/setup-ocaml@15d660006c1d3110d77c34b7faa3bddefe8b82f0 # v3.7.0
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
opam-depext-flags: --with-test
dune-cache: true
allow-prerelease-opam: true

- run: |
opam pin ocaml-protoc 3.0.1 -y -n
opam pin pbrt 3.0.1 -y -n
opam install pbrt -y

# We cannot install packages that need eio on ocaml versions before 5
- run: |
packages=$(ls ./*.opam | grep -v eio)
opam install $packages --deps-only --with-test --solver=mccs
if: ${{ ! (startsWith(matrix.ocaml-compiler, '5')) }}

# We should be able to install all packages on ocaml 5
- run: opam install . --deps-only --with-test --solver=mccs
if: ${{ startsWith(matrix.ocaml-compiler, '5') }}

- run: opam exec -- dune build @install -p opentelemetry,opentelemetry-lwt,opentelemetry-client-ocurl,opentelemetry-cohttp-lwt,opentelemetry-client-cohttp-lwt,opentelemetry-logs
- name: Build
run: opam exec -- dune build @install -p opentelemetry,opentelemetry-client,opentelemetry-lwt,opentelemetry-cohttp-lwt,opentelemetry-client-ocurl,opentelemetry-client-ocurl-lwt,opentelemetry-client-cohttp-lwt,opentelemetry-logs

- run: opam pin trace --dev -y -n
- run: opam install trace
- run: opam exec -- dune build @install -p opentelemetry
- name: Build eio packages
if: ${{ matrix.eio }}
run: opam exec -- dune build @install -p opentelemetry-client-cohttp-eio,opentelemetry,opentelemetry-client,opentelemetry-lwt,opentelemetry-cohttp-lwt,opentelemetry-client-ocurl,opentelemetry-client-ocurl-lwt,opentelemetry-client-cohttp-lwt,opentelemetry-logs

- run: opam install ocaml-protoc
- run: opam exec -- dune build @lint
- name: Lint (protoc check)
run: opam exec -- dune build @lint

# check that nothing changed
- run: git diff --exit-code
- name: Check no generated files changed
run: git diff --exit-code

- run: opam exec -- dune build @runtest
if: ${{ matrix.os == 'ubuntu-latest' }}
- name: Run tests
run: opam exec -- dune build @runtest
14 changes: 0 additions & 14 deletions .github/workflows/nix.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ _opam
.merlin
*.install
*.exe
*.tmp
/.env
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
repos:
- repo: local
hooks:
- id: ocamlformat
name: ocamlformat check
entry: make format-check
language: system
files: \.(ml|mli)$
pass_filenames: false
stages: [pre-push]
46 changes: 46 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,49 @@
## 0.91.1

- fix: lazy init of random generators
- fix: in trace, respect ~parent:P_none

## 0.91

- expose Self_debug.level_above
- config: better defaults in Sdk, have batching enabled by default

- better error message for otlp http failures
- bounded queue: provide a per-item measure function for better errors/metrics
- fix: retries are self_debug logged at warning level
- move from ocurl to curl as a dep

## 0.90

- major refactor: split library into `opentelemetry.core`, `opentelemetry`,
`opentelemetry.util`, `opentelemetry.emitter`, `opentelemetry.atomic`, revamp internals
- per-signal providers: separate trace, meter, and logger providers replace
the single monolithic exporter
- `opentelemetry.ambient-context` is now a standalone library, once again
- new `opentelemetry-client-ocurl-lwt` package
- client: split `opentelemetry-client-sync` off of the main client library
- client: add support for `http/json` protocol alongside `http/protobuf`
- client: add HTTP retry with exponential backoff
- client: overhaul bounded queue; introduce generic consumer framework
- client: add `Exporter_add_batching`, `Emitter_add_batching`, `Emitter_sample`,
`Emitter_limit_interval` combinators. Batching is factored out of individual
client libraries.
- client: add sampler as an emitter transformer
- client: add `exporter_stdout` and `debug_exporter`
- client: add `self_metrics` and `self_debug` to exporters
- client: add `after_shutdown` callback in ocurl/ocurl-lwt clients
- `Span.dummy`: inert span that is never modified
- `Span.record_exception` now also sets the span status to error
- `Span.set_span_status` added in `opentelemetry.trace`
- `Span`: carry flags to `span_link`
- `Span`: now mutable thanks to ocaml-protoc 4.0, replaces old `Scope.t` entirely
- `Meter.emit` and `Meter_provider.emit_l` added
- emitter: add `flat_map`, `tap`, `to_list`, `enabled` combinators
- clock abstraction added; `ptime` used by default in logger and metrics
- interval limiter used for `metrics_callbacks`
- update to OTEL spec 1.8.0
- update semantic conventions
- various bug fixes and performance improvements

## 0.12

Expand Down
20 changes: 19 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,33 @@ clean:
@dune clean

protoc-gen:
FORCE_GENPROTO=true @dune build @lint
FORCE_GENPROTO=true dune build @lint

update-submodules:
git submodule update --init

doc:
@dune build @doc

PACKAGES=$(shell opam show . -f name)
odig-doc:
@odig odoc --cache-dir=_doc/ $(PACKAGES)

format:
@dune build @fmt --auto-promote

format-check:
@dune build $(DUNE_OPTS) @fmt --display=quiet

setup-githooks:
uvx pre-commit install --hook-type pre-push

WATCH ?= @all
watch:
@dune build $(WATCH) -w $(OPTS)

include deps/Makefile.ci

VERSION=$(shell awk '/^version:/ {print $$2}' opentelemetry.opam)
update_next_tag:
@echo "update version to $(VERSION)..."
Expand Down
74 changes: 48 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ connectors to talk to opentelemetry software such as [jaeger](https://www.jaeger

- library `opentelemetry` should be used to instrument your code
and possibly libraries. It doesn't communicate with anything except
a backend (default: dummy backend);
- library `opentelemetry-client-ocurl` is a backend that communicates
an exporter (default: no-op);
- library `opentelemetry-client-ocurl` is an exporter that communicates
via http+protobuf with some collector (otelcol, datadog-agent, etc.) using cURL bindings;
- library `opentelemetry-client-cohttp-lwt` is a backend that communicates
- library `opentelemetry-client-cohttp-lwt` is an exporter that communicates
via http+protobuf with some collector using cohttp.

## License
Expand Down Expand Up @@ -39,14 +39,14 @@ module Otel = Opentelemetry
let (let@) = (@@)

let foo () =
let@ scope = Otel.Trace.with_ "foo"
let@ span = Otel.Tracer.with_ "foo"
~attrs:["hello", `String "world"] in
do_work();
Otel.Metrics.(
emit [
gauge ~name:"foo.x" [int 42];
]);
do_more_work();
do_work ();
let now = Otel.Clock.now Otel.Meter.default.clock in
Otel.Meter.emit1 Otel.Meter.default
Otel.Metrics.(gauge ~name:"foo.x" [int ~now 42]);
Otel.Span.add_event span (Otel.Event.make "work done");
do_more_work ();
()
```

Expand All @@ -56,14 +56,14 @@ If you're writing a top-level application, you need to perform some initial conf

1. Set the [`service_name`][];
2. optionally configure [ambient-context][] with the appropriate storage for your environment — TLS, Lwt, Eio…;
3. and install a [`Collector`][] (usually by calling your collector's `with_setup` function.)
3. and install an exporter (usually by calling your client library's `with_setup` function.)

For example, if your application is using Lwt, and you're using `ocurl` as your collector, you might do something like this:

```ocaml
let main () =
Otel.Globals.service_name := "my_service";
Otel.GC_metrics.basic_setup();
Otel.Gc_metrics.setup ();

Opentelemetry_ambient_context.set_storage_provider (Opentelemetry_ambient_context_lwt.storage ());
Opentelemetry_client_ocurl.with_setup () @@ fun () ->
Expand All @@ -72,33 +72,55 @@ let main () =
(* … *)
```

[`service_name`]: <https://v3.ocaml.org/p/opentelemetry/0.5/doc/Opentelemetry/Globals/index.html#val-service_name>
[`Collector`]: <https://v3.ocaml.org/p/opentelemetry/0.5/doc/Opentelemetry/Collector/index.html>
[`service_name`]: <https://v3.ocaml.org/p/opentelemetry/latest/doc/Opentelemetry/Globals/index.html#val-service_name>
[ambient-context]: now vendored as `opentelemetry.ambient-context`, formerly <https://v3.ocaml.org/p/ambient-context>

## Migration 0.13 → v0.90

see `doc/migration_guide_v0.90.md`

## Configuration

The library is configurable via `Opentelemetry.Config`, via the standard
opentelemetry env variables, or with some custom environment variables.
### Environment Variables

The library supports standard OpenTelemetry environment variables:

**General:**
- `OTEL_SDK_DISABLED` - disable the SDK (default: false)
- `OTEL_SERVICE_NAME` - service name
- `OTEL_RESOURCE_ATTRIBUTES` - comma-separated key=value resource attributes
- `OTEL_OCAML_DEBUG=1` - print debug messages from the opentelemetry library

**Exporter endpoints:**
- `OTEL_EXPORTER_OTLP_ENDPOINT` - base endpoint (default: http://localhost:4318)
- `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` - traces endpoint
- `OTEL_EXPORTER_OTLP_METRICS_ENDPOINT` - metrics endpoint
- `OTEL_EXPORTER_OTLP_LOGS_ENDPOINT` - logs endpoint

**Exporter configuration:**
- `OTEL_EXPORTER_OTLP_PROTOCOL` - protocol: http/protobuf or http/json (default: http/protobuf)

**Headers:**
- `OTEL_EXPORTER_OTLP_HEADERS` - headers as comma-separated key=value pairs
- `OTEL_EXPORTER_OTLP_TRACES_HEADERS` - traces-specific headers
- `OTEL_EXPORTER_OTLP_METRICS_HEADERS` - metrics-specific headers
- `OTEL_EXPORTER_OTLP_LOGS_HEADERS` - logs-specific headers

- `OTEL_EXPORTER_OTLP_ENDPOINT` sets the http endpoint to send signals to
- `OTEL_OCAML_DEBUG=1` to print some debug messages from the opentelemetry library ide
- `OTEL_RESOURCE_ATTRIBUTES` sets a comma separated list of custom resource attributes

## Collector opentelemetry-client-ocurl
## opentelemetry-client-ocurl

This is a synchronous collector that uses the http+protobuf format
to send signals (metrics, traces, logs) to some other collector (eg. `otelcol`
This is a synchronous exporter that uses the http+protobuf format
to send signals (metrics, traces, logs) to some collector (eg. `otelcol`
or the datadog agent).

Do note that this backend uses a thread pool and is incompatible
Do note that it uses a thread pool and is incompatible
with uses of `fork` on some Unixy systems.
See [#68](https://github.com/imandra-ai/ocaml-opentelemetry/issues/68) for a possible workaround.

## Collector opentelemetry-client-cohttp-lwt
## opentelemetry-client-cohttp-lwt

This is a Lwt-friendly collector that uses cohttp to send
signals to some other collector (e.g. `otelcol`). It must be run
This is a Lwt-friendly exporter that uses cohttp to send
signals to some collector (e.g. `otelcol`). It must be run
inside a `Lwt_main.run` scope.

## Opentelemetry-trace
Expand Down
Loading
Loading