mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-05-05 08:54:27 -04:00
Compare commits
23 commits
40b84944a7
...
5065cdd985
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5065cdd985 | ||
|
|
0cf72525b2 | ||
|
|
3bf18fed69 | ||
|
|
a4d95409ee | ||
|
|
59e2e854e5 | ||
|
|
5f3b162290 | ||
|
|
2401745f1a | ||
|
|
fd47118c51 | ||
|
|
9cb9c1081c | ||
|
|
7a93a2582b | ||
|
|
e9bb76edd1 | ||
|
|
b766f86019 | ||
|
|
78e44e916c | ||
|
|
755509893e | ||
|
|
5031be8d91 | ||
|
|
8ebc582a00 | ||
|
|
7691512ace | ||
|
|
6a468594e0 | ||
|
|
7f9b7d7c83 | ||
|
|
31cc90abb4 | ||
|
|
9c6245e88d | ||
|
|
7b06ccb4e2 | ||
|
|
d316e2a4f1 |
49 changed files with 420 additions and 276 deletions
20
.github/workflows/format.yml
vendored
20
.github/workflows/format.yml
vendored
|
|
@ -1,5 +1,3 @@
|
||||||
|
|
||||||
|
|
||||||
name: format
|
name: format
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
|
@ -11,20 +9,10 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
format:
|
format:
|
||||||
name: format
|
name: format
|
||||||
strategy:
|
runs-on: ubuntu-latest
|
||||||
matrix:
|
container: ghcr.io/ocaml-tracing/ocaml-opentelemetry/ci-4.14:latest
|
||||||
ocaml-compiler:
|
|
||||||
- '5.3'
|
|
||||||
runs-on: 'ubuntu-latest'
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@main
|
- uses: actions/checkout@v6
|
||||||
- name: Use OCaml ${{ matrix.ocaml-compiler }}
|
|
||||||
uses: ocaml/setup-ocaml@v3
|
|
||||||
with:
|
|
||||||
ocaml-compiler: ${{ matrix.ocaml-compiler }}
|
|
||||||
dune-cache: true
|
|
||||||
allow-prerelease-opam: true
|
|
||||||
|
|
||||||
- run: opam install ocamlformat.0.27.0 lwt.6.1.1
|
|
||||||
- run: opam exec -- make format-check
|
- run: opam exec -- make format-check
|
||||||
|
|
||||||
|
|
|
||||||
38
.github/workflows/gh-pages.yml
vendored
Normal file
38
.github/workflows/gh-pages.yml
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
name: github pages
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
packages: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container: ghcr.io/ocaml-tracing/ocaml-opentelemetry/ci-5.4:latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: Install local packages
|
||||||
|
run: opam exec -- dune build @install && opam exec -- dune install
|
||||||
|
|
||||||
|
- 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@v3
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
publish_dir: ./_doc/html
|
||||||
|
enable_jekyll: false
|
||||||
76
.github/workflows/main.yml
vendored
76
.github/workflows/main.yml
vendored
|
|
@ -11,65 +11,37 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os:
|
include:
|
||||||
- ubuntu-latest
|
- ocaml-version: "4.08"
|
||||||
#- windows-latest
|
container: ghcr.io/ocaml-tracing/ocaml-opentelemetry/ci-4.08:latest
|
||||||
#- macos-latest
|
eio: false
|
||||||
ocaml-compiler:
|
- ocaml-version: "4.14"
|
||||||
- 4.08.x
|
container: ghcr.io/ocaml-tracing/ocaml-opentelemetry/ci-4.14:latest
|
||||||
- 4.13.x
|
eio: false
|
||||||
- 5.0.x
|
- ocaml-version: "5.4"
|
||||||
- 5.3.x
|
container: ghcr.io/ocaml-tracing/ocaml-opentelemetry/ci-5.4:latest
|
||||||
|
eio: true
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ubuntu-latest
|
||||||
|
container: ${{ matrix.container }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- uses: actions/checkout@v6
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
|
|
||||||
# needed for depext to work
|
- name: Build
|
||||||
- run: sudo apt-get update && sudo apt-get install mccs
|
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
|
||||||
if: ${{ matrix.os == 'ubuntu-latest' }}
|
|
||||||
|
|
||||||
- name: Use OCaml ${{ matrix.ocaml-compiler }}
|
- name: Build eio packages
|
||||||
uses: ocaml/setup-ocaml@v3
|
if: ${{ matrix.eio }}
|
||||||
with:
|
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
|
||||||
ocaml-compiler: ${{ matrix.ocaml-compiler }}
|
|
||||||
opam-depext-flags: --with-test
|
|
||||||
dune-cache: true
|
|
||||||
allow-prerelease-opam: true
|
|
||||||
|
|
||||||
- run: |
|
- name: Lint (protoc check)
|
||||||
opam install pbrt.4.0 -y
|
run: opam exec -- dune build @lint
|
||||||
opam install ambient-context lwt.5.9.2
|
|
||||||
|
|
||||||
# We cannot install packages that need eio on ocaml versions before 5
|
- name: Check no generated files changed
|
||||||
- run: |
|
run: git diff --exit-code
|
||||||
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
|
- name: Run tests
|
||||||
- run: opam install . --deps-only --with-test --solver=mccs
|
run: opam exec -- dune build @runtest
|
||||||
if: ${{ startsWith(matrix.ocaml-compiler, '5') }}
|
|
||||||
|
|
||||||
- run: opam exec -- dune build @install -p opentelemetry,opentelemetry-client,opentelemetry-lwt,opentelemetry-client-ocurl,opentelemetry-cohttp-lwt,opentelemetry-client-cohttp-lwt,opentelemetry-logs
|
|
||||||
|
|
||||||
- run: opam install trace
|
|
||||||
- run: opam exec -- dune build @install -p opentelemetry
|
|
||||||
|
|
||||||
- run: opam install lwt.6.1.1 -y
|
|
||||||
if: ${{ matrix.ocaml-compiler == '5.3.x' }}
|
|
||||||
- run: opam exec -- dune build @install -p opentelemetry,opentelemetry-client,opentelemetry-lwt,opentelemetry-client-cohttp-lwt
|
|
||||||
if: ${{ matrix.ocaml-compiler == '5.3.x' }}
|
|
||||||
|
|
||||||
- run: opam install ocaml-protoc
|
|
||||||
- run: opam exec -- dune build @lint
|
|
||||||
|
|
||||||
# check that nothing changed
|
|
||||||
- run: git diff --exit-code
|
|
||||||
|
|
||||||
- run: opam exec -- dune build @runtest
|
|
||||||
if: ${{ matrix.os == 'ubuntu-latest' }}
|
|
||||||
|
|
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -7,3 +7,4 @@ _opam
|
||||||
*.install
|
*.install
|
||||||
*.exe
|
*.exe
|
||||||
*.tmp
|
*.tmp
|
||||||
|
/.env
|
||||||
|
|
|
||||||
12
CHANGES.md
12
CHANGES.md
|
|
@ -1,5 +1,15 @@
|
||||||
|
|
||||||
## 0.20
|
## 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`,
|
- major refactor: split library into `opentelemetry.core`, `opentelemetry`,
|
||||||
`opentelemetry.util`, `opentelemetry.emitter`, `opentelemetry.atomic`, revamp internals
|
`opentelemetry.util`, `opentelemetry.emitter`, `opentelemetry.atomic`, revamp internals
|
||||||
|
|
|
||||||
2
Makefile
2
Makefile
|
|
@ -36,6 +36,8 @@ WATCH ?= @all
|
||||||
watch:
|
watch:
|
||||||
@dune build $(WATCH) -w $(OPTS)
|
@dune build $(WATCH) -w $(OPTS)
|
||||||
|
|
||||||
|
include deps/Makefile.ci
|
||||||
|
|
||||||
VERSION=$(shell awk '/^version:/ {print $$2}' opentelemetry.opam)
|
VERSION=$(shell awk '/^version:/ {print $$2}' opentelemetry.opam)
|
||||||
update_next_tag:
|
update_next_tag:
|
||||||
@echo "update version to $(VERSION)..."
|
@echo "update version to $(VERSION)..."
|
||||||
|
|
|
||||||
|
|
@ -75,9 +75,9 @@ let main () =
|
||||||
[`service_name`]: <https://v3.ocaml.org/p/opentelemetry/latest/doc/Opentelemetry/Globals/index.html#val-service_name>
|
[`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>
|
[ambient-context]: now vendored as `opentelemetry.ambient-context`, formerly <https://v3.ocaml.org/p/ambient-context>
|
||||||
|
|
||||||
## Migration v012 → v0.13
|
## Migration 0.13 → v0.90
|
||||||
|
|
||||||
see `doc/migration_guide_v0.13.md`
|
see `doc/migration_guide_v0.90.md`
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
|
|
|
||||||
44
deps/Makefile.ci
vendored
Normal file
44
deps/Makefile.ci
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
# CI Docker images — included by top-level Makefile
|
||||||
|
CI_REGISTRY = ghcr.io/ocaml-tracing/ocaml-opentelemetry
|
||||||
|
CI_VERSIONS = 4.08 4.14 5.4
|
||||||
|
# To update: curl -s https://api.github.com/repos/ocaml/opam-repository/commits/master | jq -r .sha
|
||||||
|
OPAM_REPO_COMMIT ?= 67472cd54293d750a62d6d4423024d55f77268b0
|
||||||
|
CI_BASE_OS_PACKAGES = pkg-config libcurl4-openssl-dev libgmp-dev mccs
|
||||||
|
|
||||||
|
CI_COMMON_PACKAGES = ptime hmap pbrt pbrt_yojson ambient-context mtime \
|
||||||
|
thread-local-storage lwt_ppx ambient-context-lwt \
|
||||||
|
cohttp cohttp-lwt cohttp-lwt-unix \
|
||||||
|
ezcurl ezcurl-lwt ocurl logs alcotest containers \
|
||||||
|
trace ocaml-protoc
|
||||||
|
|
||||||
|
CI_PACKAGES_408 = $(CI_COMMON_PACKAGES) lwt.5.9.2
|
||||||
|
CI_PACKAGES_414 = $(CI_COMMON_PACKAGES) lwt.5.9.2 ocamlformat.0.27.0
|
||||||
|
CI_PACKAGES_54 = $(CI_COMMON_PACKAGES) lwt.6.1.1 \
|
||||||
|
ambient-context-eio cohttp-eio tls-eio ca-certs mirage-crypto-rng eio_main odig
|
||||||
|
|
||||||
|
CI_BUILD = docker build -f deps/dockerfile.ocaml \
|
||||||
|
--build-arg OPAM_REPO_COMMIT=$(OPAM_REPO_COMMIT) \
|
||||||
|
--build-arg "BASE_OS_PACKAGES=$(CI_BASE_OS_PACKAGES)"
|
||||||
|
|
||||||
|
build-ci-docker:
|
||||||
|
$(CI_BUILD) --build-arg OCAML_VERSION=4.08.1 --build-arg "BASE_PACKAGES=$(CI_PACKAGES_408)" -t $(CI_REGISTRY)/ci-4.08:latest .
|
||||||
|
$(CI_BUILD) --build-arg OCAML_VERSION=4.14.2 --build-arg "BASE_PACKAGES=$(CI_PACKAGES_414)" -t $(CI_REGISTRY)/ci-4.14:latest .
|
||||||
|
$(CI_BUILD) --build-arg OCAML_VERSION=5.4.1 --build-arg "BASE_PACKAGES=$(CI_PACKAGES_54)" -t $(CI_REGISTRY)/ci-5.4:latest .
|
||||||
|
|
||||||
|
CI_NON_EIO_PACKAGES = opentelemetry,opentelemetry-client,opentelemetry-lwt,opentelemetry-cohttp-lwt,opentelemetry-client-ocurl,opentelemetry-client-ocurl-lwt,opentelemetry-client-cohttp-lwt,opentelemetry-logs
|
||||||
|
CI_RUN = docker run --pull=never --rm -t -v $(PWD):/src:z -w /src
|
||||||
|
|
||||||
|
run-ci:
|
||||||
|
@for v in $(CI_VERSIONS); do \
|
||||||
|
echo "=== OCaml $$v ===" ; \
|
||||||
|
$(CI_RUN) $(CI_REGISTRY)/ci-$$v:latest \
|
||||||
|
sh -c "opam exec -- dune build @install -p $(CI_NON_EIO_PACKAGES) && opam exec -- dune build @runtest" \
|
||||||
|
|| exit 1 ; \
|
||||||
|
done
|
||||||
|
$(CI_RUN) $(CI_REGISTRY)/ci-5.4:latest \
|
||||||
|
opam exec -- dune build @install -p opentelemetry-client-cohttp-eio
|
||||||
|
|
||||||
|
upload-ci-docker:
|
||||||
|
@for v in $(CI_VERSIONS); do \
|
||||||
|
docker push $(CI_REGISTRY)/ci-$$v:latest ; \
|
||||||
|
done || ( echo "to login: docker login ghcr.io -u <your-github-username>" ; exit 1 )
|
||||||
40
deps/dockerfile.ocaml
vendored
Normal file
40
deps/dockerfile.ocaml
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
ARG BASE_OS=ubuntu:24.04
|
||||||
|
|
||||||
|
# --- Stage 1: base (shared, no OCaml) ---
|
||||||
|
FROM $BASE_OS AS base
|
||||||
|
ARG BASE_OS_PACKAGES=""
|
||||||
|
ENV OPAMROOTISOK=1 OPAMYES=1 OPAMCONFIRMLEVEL=unsafe-yes
|
||||||
|
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
||||||
|
--mount=type=cache,target=/var/lib/apt,sharing=locked \
|
||||||
|
rm -f /etc/apt/apt.conf.d/docker-clean && \
|
||||||
|
apt-get update && \
|
||||||
|
apt-get install -y --no-install-recommends ca-certificates curl git unzip build-essential netbase $BASE_OS_PACKAGES
|
||||||
|
RUN curl -fsSL https://github.com/ocaml/opam/releases/download/2.5.0/opam-2.5.0-x86_64-linux -o /usr/local/bin/opam && \
|
||||||
|
chmod +x /usr/local/bin/opam && \
|
||||||
|
git config --system --add safe.directory '*'
|
||||||
|
WORKDIR /root/w
|
||||||
|
|
||||||
|
# --- Stage 2: opam-setup (builds the switch, discarded) ---
|
||||||
|
FROM base AS opam-setup
|
||||||
|
ARG OCAML_VERSION
|
||||||
|
ARG OPAM_REPO_COMMIT=master
|
||||||
|
ARG BASE_PACKAGES=""
|
||||||
|
|
||||||
|
RUN git init /tmp/opam-repo && cd /tmp/opam-repo && \
|
||||||
|
git remote add origin https://github.com/ocaml/opam-repository.git && \
|
||||||
|
git fetch --depth 1 origin $OPAM_REPO_COMMIT && \
|
||||||
|
git checkout FETCH_HEAD
|
||||||
|
|
||||||
|
RUN opam init --disable-sandboxing --bare --no-setup -k local /tmp/opam-repo && \
|
||||||
|
opam switch create /root/w --packages=ocaml-base-compiler.$OCAML_VERSION
|
||||||
|
|
||||||
|
RUN opam install --no-depexts $BASE_PACKAGES && \
|
||||||
|
opam clean -a -y && \
|
||||||
|
rm -rf /tmp/opam-repo
|
||||||
|
|
||||||
|
# --- Stage 3: final image (base + switch only) ---
|
||||||
|
FROM base
|
||||||
|
COPY --from=opam-setup /root/.opam /root/.opam
|
||||||
|
COPY --from=opam-setup /root/w/_opam /root/w/_opam
|
||||||
|
ENV OPAMROOT=/root/.opam OPAMSWITCH=/root/w PATH=/root/w/_opam/bin:$PATH
|
||||||
|
WORKDIR /root/w
|
||||||
|
|
@ -1,23 +1,23 @@
|
||||||
# Migration guide: v0.12 → v0.13
|
# Migration guide: v0.13 → v0.90
|
||||||
|
|
||||||
This guide covers breaking changes when upgrading from v0.12.
|
This guide covers breaking changes when upgrading from v0.13.
|
||||||
|
|
||||||
## 1. Backend setup: `Collector` → `Sdk` + `Exporter`
|
## 1. Backend setup: `Collector` → `Sdk` + `Exporter`
|
||||||
|
|
||||||
v0.12 used a first-class module `BACKEND` installed into a global slot via
|
v0.13 used a first-class module `BACKEND` installed into a global slot via
|
||||||
`Collector.set_backend`. v0.13 replaces this with a plain record `Exporter.t`
|
`Collector.set_backend`. v0.90 replaces this with a plain record `Exporter.t`
|
||||||
installed via `Sdk.set`.
|
installed via `Sdk.set`.
|
||||||
|
|
||||||
The `with_setup` helper in each client library still exists, so if you use that
|
The `with_setup` helper in each client library still exists, so if you use that
|
||||||
you mainly need to rename the module.
|
you mainly need to rename the module.
|
||||||
|
|
||||||
```ocaml
|
```ocaml
|
||||||
(* v0.12 *)
|
(* v0.13 *)
|
||||||
Opentelemetry_client_ocurl.with_setup ~config () (fun () ->
|
Opentelemetry_client_ocurl.with_setup ~config () (fun () ->
|
||||||
(* your code *)
|
(* your code *)
|
||||||
())
|
())
|
||||||
|
|
||||||
(* v0.13: same call, internals changed; ~stop removed, ~after_shutdown added *)
|
(* v0.90: same call, internals changed; ~stop removed, ~after_shutdown added *)
|
||||||
Opentelemetry_client_ocurl.with_setup
|
Opentelemetry_client_ocurl.with_setup
|
||||||
~after_shutdown:(fun _exp -> ())
|
~after_shutdown:(fun _exp -> ())
|
||||||
~config () (fun () ->
|
~config () (fun () ->
|
||||||
|
|
@ -28,12 +28,12 @@ Opentelemetry_client_ocurl.with_setup
|
||||||
If you called `setup`/`remove_backend` manually:
|
If you called `setup`/`remove_backend` manually:
|
||||||
|
|
||||||
```ocaml
|
```ocaml
|
||||||
(* v0.12 *)
|
(* v0.13 *)
|
||||||
Opentelemetry_client_ocurl.setup ~config ()
|
Opentelemetry_client_ocurl.setup ~config ()
|
||||||
(* ... *)
|
(* ... *)
|
||||||
Opentelemetry_client_ocurl.remove_backend ()
|
Opentelemetry_client_ocurl.remove_backend ()
|
||||||
|
|
||||||
(* v0.13 *)
|
(* v0.90 *)
|
||||||
Opentelemetry_client_ocurl.setup ~config ()
|
Opentelemetry_client_ocurl.setup ~config ()
|
||||||
(* ... *)
|
(* ... *)
|
||||||
Opentelemetry_client_ocurl.remove_exporter ()
|
Opentelemetry_client_ocurl.remove_exporter ()
|
||||||
|
|
@ -48,14 +48,14 @@ The most common migration. The module is renamed and the callback argument type
|
||||||
changes from `Scope.t` to `Span.t`.
|
changes from `Scope.t` to `Span.t`.
|
||||||
|
|
||||||
```ocaml
|
```ocaml
|
||||||
(* v0.12 *)
|
(* v0.13 *)
|
||||||
Trace.with_ "my-op" ~attrs:["k", `String "v"] (fun (scope : Scope.t) ->
|
Trace.with_ "my-op" ~attrs:["k", `String "v"] (fun (scope : Scope.t) ->
|
||||||
Scope.add_event scope (fun () -> Event.make "something happened");
|
Scope.add_event scope (fun () -> Event.make "something happened");
|
||||||
Scope.add_attrs scope (fun () -> ["extra", `Int 42]);
|
Scope.add_attrs scope (fun () -> ["extra", `Int 42]);
|
||||||
do_work ()
|
do_work ()
|
||||||
)
|
)
|
||||||
|
|
||||||
(* v0.13 *)
|
(* v0.90 *)
|
||||||
Tracer.with_ "my-op" ~attrs:["k", `String "v"] (fun (span : Span.t) ->
|
Tracer.with_ "my-op" ~attrs:["k", `String "v"] (fun (span : Span.t) ->
|
||||||
Span.add_event span (Event.make "something happened");
|
Span.add_event span (Event.make "something happened");
|
||||||
Span.add_attrs span ["extra", `Int 42];
|
Span.add_attrs span ["extra", `Int 42];
|
||||||
|
|
@ -67,7 +67,7 @@ Tracer.with_ "my-op" ~attrs:["k", `String "v"] (fun (span : Span.t) ->
|
||||||
|
|
||||||
Key differences on the callback argument:
|
Key differences on the callback argument:
|
||||||
|
|
||||||
| v0.12 (`Scope.t`) | v0.13 (`Span.t`) |
|
| v0.13 (`Scope.t`) | v0.90 (`Span.t`) |
|
||||||
|--------------------------------------------|--------------------------------------|
|
|--------------------------------------------|--------------------------------------|
|
||||||
| `scope.trace_id` | `Span.trace_id span` |
|
| `scope.trace_id` | `Span.trace_id span` |
|
||||||
| `scope.span_id` | `Span.id span` |
|
| `scope.span_id` | `Span.id span` |
|
||||||
|
|
@ -82,10 +82,10 @@ Key differences on the callback argument:
|
||||||
The `~scope` parameter of `Trace.with_` is renamed to `~parent`:
|
The `~scope` parameter of `Trace.with_` is renamed to `~parent`:
|
||||||
|
|
||||||
```ocaml
|
```ocaml
|
||||||
(* v0.12 *)
|
(* v0.13 *)
|
||||||
Trace.with_ "child" ~scope:parent_scope (fun child -> ...)
|
Trace.with_ "child" ~scope:parent_scope (fun child -> ...)
|
||||||
|
|
||||||
(* v0.13 *)
|
(* v0.90 *)
|
||||||
Tracer.with_ "child" ~parent:parent_span (fun child -> ...)
|
Tracer.with_ "child" ~parent:parent_span (fun child -> ...)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -100,7 +100,7 @@ Direct construction of log records and batch-emit is replaced by convenience
|
||||||
functions.
|
functions.
|
||||||
|
|
||||||
```ocaml
|
```ocaml
|
||||||
(* v0.12 *)
|
(* v0.13 *)
|
||||||
Logs.emit [
|
Logs.emit [
|
||||||
Logs.make_str ~severity:Severity_number_warn "something went wrong"
|
Logs.make_str ~severity:Severity_number_warn "something went wrong"
|
||||||
]
|
]
|
||||||
|
|
@ -109,22 +109,22 @@ Logs.emit [
|
||||||
Logs.make_strf ~severity:Severity_number_info "processed %d items" n
|
Logs.make_strf ~severity:Severity_number_info "processed %d items" n
|
||||||
]
|
]
|
||||||
|
|
||||||
(* v0.13: simple string *)
|
(* v0.90: simple string *)
|
||||||
Logger.log ~severity:Severity_number_warn "something went wrong"
|
Logger.log ~severity:Severity_number_warn "something went wrong"
|
||||||
|
|
||||||
(* v0.13: formatted *)
|
(* v0.90: formatted *)
|
||||||
Logger.logf ~severity:Severity_number_info (fun k -> k "processed %d items" n)
|
Logger.logf ~severity:Severity_number_info (fun k -> k "processed %d items" n)
|
||||||
```
|
```
|
||||||
|
|
||||||
If you need to keep the trace/span correlation:
|
If you need to keep the trace/span correlation:
|
||||||
|
|
||||||
```ocaml
|
```ocaml
|
||||||
(* v0.12 *)
|
(* v0.13 *)
|
||||||
Logs.emit [
|
Logs.emit [
|
||||||
Logs.make_str ~trace_id ~span_id ~severity:Severity_number_info "ok"
|
Logs.make_str ~trace_id ~span_id ~severity:Severity_number_info "ok"
|
||||||
]
|
]
|
||||||
|
|
||||||
(* v0.13 *)
|
(* v0.90 *)
|
||||||
Logger.log ~trace_id ~span_id ~severity:Severity_number_info "ok"
|
Logger.log ~trace_id ~span_id ~severity:Severity_number_info "ok"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -133,17 +133,17 @@ records manually and emit them via a `Logger.t`.
|
||||||
|
|
||||||
## 4. `Metrics.emit` → emit via a `Meter`
|
## 4. `Metrics.emit` → emit via a `Meter`
|
||||||
|
|
||||||
In v0.12 `Metrics.emit` was a top-level function that sent directly to the
|
In v0.13 `Metrics.emit` was a top-level function that sent directly to the
|
||||||
collector. In v0.13 metrics go through a `Meter.t`. For most code the change
|
collector. In v0.90 metrics go through a `Meter.t`. For most code the change
|
||||||
is mechanical:
|
is mechanical:
|
||||||
|
|
||||||
```ocaml
|
```ocaml
|
||||||
(* v0.12 *)
|
(* v0.13 *)
|
||||||
Metrics.emit [
|
Metrics.emit [
|
||||||
Metrics.gauge ~name:"queue.depth" [ Metrics.int ~now depth ]
|
Metrics.gauge ~name:"queue.depth" [ Metrics.int ~now depth ]
|
||||||
]
|
]
|
||||||
|
|
||||||
(* v0.13: Meter.default emits to the global provider *)
|
(* v0.90: Meter.default emits to the global provider *)
|
||||||
Meter.emit1 Meter.default
|
Meter.emit1 Meter.default
|
||||||
(Metrics.gauge ~name:"queue.depth" [ Metrics.int ~now depth ])
|
(Metrics.gauge ~name:"queue.depth" [ Metrics.int ~now depth ])
|
||||||
```
|
```
|
||||||
|
|
@ -151,11 +151,11 @@ Meter.emit1 Meter.default
|
||||||
`now` is now obtained from the meter's clock rather than `Timestamp_ns.now_unix_ns ()`:
|
`now` is now obtained from the meter's clock rather than `Timestamp_ns.now_unix_ns ()`:
|
||||||
|
|
||||||
```ocaml
|
```ocaml
|
||||||
(* v0.12 *)
|
(* v0.13 *)
|
||||||
let now = Timestamp_ns.now_unix_ns () in
|
let now = Timestamp_ns.now_unix_ns () in
|
||||||
Metrics.emit [ Metrics.sum ~name:"counter" [ Metrics.int ~now n ] ]
|
Metrics.emit [ Metrics.sum ~name:"counter" [ Metrics.int ~now n ] ]
|
||||||
|
|
||||||
(* v0.13 *)
|
(* v0.90 *)
|
||||||
let now = Clock.now Meter.default.clock in
|
let now = Clock.now Meter.default.clock in
|
||||||
Meter.emit1 Meter.default
|
Meter.emit1 Meter.default
|
||||||
(Metrics.sum ~name:"counter" [ Metrics.int ~now n ])
|
(Metrics.sum ~name:"counter" [ Metrics.int ~now n ])
|
||||||
|
|
@ -164,11 +164,11 @@ Meter.emit1 Meter.default
|
||||||
## 5. `Metrics_callbacks.register` → `Meter.add_cb`
|
## 5. `Metrics_callbacks.register` → `Meter.add_cb`
|
||||||
|
|
||||||
```ocaml
|
```ocaml
|
||||||
(* v0.12 *)
|
(* v0.13 *)
|
||||||
Metrics_callbacks.register (fun () ->
|
Metrics_callbacks.register (fun () ->
|
||||||
[ Metrics.gauge ~name:"foo" [ Metrics.int ~now:... 42 ] ])
|
[ Metrics.gauge ~name:"foo" [ Metrics.int ~now:... 42 ] ])
|
||||||
|
|
||||||
(* v0.13: callback now receives a clock *)
|
(* v0.90: callback now receives a clock *)
|
||||||
Meter.add_cb (fun ~clock () ->
|
Meter.add_cb (fun ~clock () ->
|
||||||
let now = Clock.now clock in
|
let now = Clock.now clock in
|
||||||
[ Metrics.gauge ~name:"foo" [ Metrics.int ~now 42 ] ])
|
[ Metrics.gauge ~name:"foo" [ Metrics.int ~now 42 ] ])
|
||||||
|
|
@ -177,11 +177,11 @@ Meter.add_cb (fun ~clock () ->
|
||||||
After registering callbacks you must tell the SDK to drive them:
|
After registering callbacks you must tell the SDK to drive them:
|
||||||
|
|
||||||
```ocaml
|
```ocaml
|
||||||
(* v0.13: call once after setup to schedule periodic emission *)
|
(* v0.90: call once after setup to schedule periodic emission *)
|
||||||
Meter.add_to_main_exporter Meter.default
|
Meter.add_to_main_exporter Meter.default
|
||||||
```
|
```
|
||||||
|
|
||||||
In v0.12 this was automatic once `Metrics_callbacks.register` was called.
|
In v0.13 this was automatic once `Metrics_callbacks.register` was called.
|
||||||
|
|
||||||
## 6. `GC_metrics.basic_setup` signature unchanged, `setup` changed
|
## 6. `GC_metrics.basic_setup` signature unchanged, `setup` changed
|
||||||
|
|
||||||
|
|
@ -191,12 +191,12 @@ to `Gc_metrics`, but the former name persists as a deprecated alias.
|
||||||
If you called the lower-level `GC_metrics.setup exp` directly:
|
If you called the lower-level `GC_metrics.setup exp` directly:
|
||||||
|
|
||||||
```ocaml
|
```ocaml
|
||||||
(* v0.12 *)
|
(* v0.13 *)
|
||||||
GC_metrics.setup exporter
|
GC_metrics.setup exporter
|
||||||
(* or *)
|
(* or *)
|
||||||
GC_metrics.setup_on_main_exporter ()
|
GC_metrics.setup_on_main_exporter ()
|
||||||
|
|
||||||
(* v0.13 *)
|
(* v0.90 *)
|
||||||
Gc_metrics.setup () (* uses Meter.default *)
|
Gc_metrics.setup () (* uses Meter.default *)
|
||||||
(* or with a specific meter: *)
|
(* or with a specific meter: *)
|
||||||
Gc_metrics.setup ~meter:my_meter ()
|
Gc_metrics.setup ~meter:my_meter ()
|
||||||
|
|
@ -207,10 +207,10 @@ Gc_metrics.setup ~meter:my_meter ()
|
||||||
## 7. `Collector.on_tick` → `Sdk.add_on_tick_callback`
|
## 7. `Collector.on_tick` → `Sdk.add_on_tick_callback`
|
||||||
|
|
||||||
```ocaml
|
```ocaml
|
||||||
(* v0.12 *)
|
(* v0.13 *)
|
||||||
Collector.on_tick (fun () -> do_background_work ())
|
Collector.on_tick (fun () -> do_background_work ())
|
||||||
|
|
||||||
(* v0.13 *)
|
(* v0.90 *)
|
||||||
Sdk.add_on_tick_callback (fun () -> do_background_work ())
|
Sdk.add_on_tick_callback (fun () -> do_background_work ())
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -220,10 +220,10 @@ Sdk.add_on_tick_callback (fun () -> do_background_work ())
|
||||||
override. This is no longer supported per-call; set it once globally:
|
override. This is no longer supported per-call; set it once globally:
|
||||||
|
|
||||||
```ocaml
|
```ocaml
|
||||||
(* v0.12 *)
|
(* v0.13 *)
|
||||||
Trace.with_ "op" ~service_name:"my-svc" (fun _ -> ...)
|
Trace.with_ "op" ~service_name:"my-svc" (fun _ -> ...)
|
||||||
|
|
||||||
(* v0.13: set globally before setup *)
|
(* v0.90: set globally before setup *)
|
||||||
Opentelemetry.Globals.service_name := "my-svc"
|
Opentelemetry.Globals.service_name := "my-svc"
|
||||||
Tracer.with_ "op" (fun _ -> ...)
|
Tracer.with_ "op" (fun _ -> ...)
|
||||||
```
|
```
|
||||||
|
|
@ -233,13 +233,13 @@ Tracer.with_ "op" (fun _ -> ...)
|
||||||
If you held a reference to a backend module:
|
If you held a reference to a backend module:
|
||||||
|
|
||||||
```ocaml
|
```ocaml
|
||||||
(* v0.12 *)
|
(* v0.13 *)
|
||||||
let (module B : Collector.BACKEND) =
|
let (module B : Collector.BACKEND) =
|
||||||
Opentelemetry_client_ocurl.create_backend ~config ()
|
Opentelemetry_client_ocurl.create_backend ~config ()
|
||||||
in
|
in
|
||||||
Collector.set_backend (module B)
|
Collector.set_backend (module B)
|
||||||
|
|
||||||
(* v0.13 *)
|
(* v0.90 *)
|
||||||
let exp : Exporter.t =
|
let exp : Exporter.t =
|
||||||
Opentelemetry_client_ocurl.create_exporter ~config ()
|
Opentelemetry_client_ocurl.create_exporter ~config ()
|
||||||
in
|
in
|
||||||
|
|
@ -258,7 +258,7 @@ Sdk.set exp
|
||||||
|
|
||||||
## Quick checklist
|
## Quick checklist
|
||||||
|
|
||||||
- [ ] `Trace.with_` → `Tracer.with_`; callback argument `Scope.t` → `Span.t`
|
- [ ] `Otel.Trace.with_` → `Otel.Tracer.with_`; callback argument `Scope.t` → `Span.t`
|
||||||
- [ ] `Scope.add_event`/`add_attrs` → `Span.add_event`/`add_attrs` (no thunk wrapper)
|
- [ ] `Scope.add_event`/`add_attrs` → `Span.add_event`/`add_attrs` (no thunk wrapper)
|
||||||
- [ ] `~scope:` → `~parent:` in nested `with_` calls
|
- [ ] `~scope:` → `~parent:` in nested `with_` calls
|
||||||
- [ ] `Logs.emit [Logs.make_str ...]` → `Logger.log`/`Logger.logf`
|
- [ ] `Logs.emit [Logs.make_str ...]` → `Logger.log`/`Logger.logf`
|
||||||
45
dune-project
45
dune-project
|
|
@ -5,18 +5,17 @@
|
||||||
(generate_opam_files true)
|
(generate_opam_files true)
|
||||||
|
|
||||||
(source
|
(source
|
||||||
(github imandra-ai/ocaml-opentelemetry))
|
(github ocaml-tracing/ocaml-opentelemetry))
|
||||||
|
|
||||||
(version 0.12)
|
(version 0.91)
|
||||||
|
|
||||||
(implicit_transitive_deps false)
|
(implicit_transitive_deps false)
|
||||||
|
|
||||||
(authors "the Imandra team and contributors")
|
(authors "ocaml-tracing"
|
||||||
|
"ELLIOTTCABLE <opam@ell.io>"
|
||||||
|
"the imandra team")
|
||||||
|
|
||||||
(maintainers
|
(maintainers "ocaml-tracing")
|
||||||
"Simon Cruanes <simon.cruanes.2007@m4x.org>"
|
|
||||||
"Matt Bray <mattjbray@gmail.com>"
|
|
||||||
"ELLIOTTCABLE <opam@ell.io>")
|
|
||||||
|
|
||||||
(license MIT)
|
(license MIT)
|
||||||
|
|
||||||
|
|
@ -95,7 +94,7 @@
|
||||||
(name opentelemetry-client-ocurl)
|
(name opentelemetry-client-ocurl)
|
||||||
(depends
|
(depends
|
||||||
(ocaml
|
(ocaml
|
||||||
(>= "4.08"))
|
(>= "4.11"))
|
||||||
(mtime
|
(mtime
|
||||||
(>= "1.4"))
|
(>= "1.4"))
|
||||||
; for spans
|
; for spans
|
||||||
|
|
@ -107,15 +106,18 @@
|
||||||
(odoc :with-doc)
|
(odoc :with-doc)
|
||||||
(ezcurl
|
(ezcurl
|
||||||
(>= 0.2.3))
|
(>= 0.2.3))
|
||||||
ocurl
|
curl
|
||||||
(alcotest :with-test))
|
(alcotest :with-test)
|
||||||
|
(cohttp-lwt-unix :with-test)
|
||||||
|
(containers :with-test)
|
||||||
|
(logs :with-test))
|
||||||
(synopsis "Collector client for opentelemetry, using http + ezcurl"))
|
(synopsis "Collector client for opentelemetry, using http + ezcurl"))
|
||||||
|
|
||||||
(package
|
(package
|
||||||
(name opentelemetry-client-ocurl-lwt)
|
(name opentelemetry-client-ocurl-lwt)
|
||||||
(depends
|
(depends
|
||||||
(ocaml
|
(ocaml
|
||||||
(>= "4.08"))
|
(>= "4.11"))
|
||||||
(mtime
|
(mtime
|
||||||
(>= "1.4"))
|
(>= "1.4"))
|
||||||
(opentelemetry
|
(opentelemetry
|
||||||
|
|
@ -127,10 +129,14 @@
|
||||||
(>= 0.2.3))
|
(>= 0.2.3))
|
||||||
ocurl
|
ocurl
|
||||||
(lwt
|
(lwt
|
||||||
(>= "5.3"))
|
(>= "5.7.3"))
|
||||||
(lwt_ppx
|
(lwt_ppx
|
||||||
(>= "2.0"))
|
(>= "2.0"))
|
||||||
(alcotest :with-test))
|
ambient-context-lwt
|
||||||
|
(alcotest :with-test)
|
||||||
|
(cohttp-lwt-unix :with-test)
|
||||||
|
(containers :with-test)
|
||||||
|
(logs :with-test))
|
||||||
(synopsis "Collector client for opentelemetry, using ezcurl-lwt"))
|
(synopsis "Collector client for opentelemetry, using ezcurl-lwt"))
|
||||||
|
|
||||||
(package
|
(package
|
||||||
|
|
@ -199,11 +205,7 @@
|
||||||
cohttp-lwt
|
cohttp-lwt
|
||||||
cohttp-lwt-unix
|
cohttp-lwt-unix
|
||||||
(alcotest :with-test)
|
(alcotest :with-test)
|
||||||
(containers :with-test)
|
(containers :with-test))
|
||||||
(opentelemetry-lwt
|
|
||||||
(and
|
|
||||||
:with-test
|
|
||||||
(= :version))))
|
|
||||||
(synopsis "Collector client for opentelemetry, using cohttp + lwt"))
|
(synopsis "Collector client for opentelemetry, using cohttp + lwt"))
|
||||||
|
|
||||||
(package
|
(package
|
||||||
|
|
@ -228,5 +230,10 @@
|
||||||
(>= 2.0.1))
|
(>= 2.0.1))
|
||||||
(alcotest :with-test)
|
(alcotest :with-test)
|
||||||
(containers :with-test)
|
(containers :with-test)
|
||||||
(cohttp-lwt-unix :with-test))
|
(cohttp-lwt-unix :with-test)
|
||||||
|
(logs :with-test)
|
||||||
|
(opentelemetry-lwt
|
||||||
|
(and
|
||||||
|
:with-test
|
||||||
|
(= :version))))
|
||||||
(synopsis "Collector client for opentelemetry, using cohttp + eio"))
|
(synopsis "Collector client for opentelemetry, using cohttp + eio"))
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,12 @@
|
||||||
# This file is generated by dune, edit dune-project instead
|
# This file is generated by dune, edit dune-project instead
|
||||||
opam-version: "2.0"
|
opam-version: "2.0"
|
||||||
version: "0.12"
|
version: "0.91"
|
||||||
synopsis: "Collector client for opentelemetry, using cohttp + eio"
|
synopsis: "Collector client for opentelemetry, using cohttp + eio"
|
||||||
maintainer: [
|
maintainer: ["ocaml-tracing"]
|
||||||
"Simon Cruanes <simon.cruanes.2007@m4x.org>"
|
authors: ["ocaml-tracing" "ELLIOTTCABLE <opam@ell.io>" "the imandra team"]
|
||||||
"Matt Bray <mattjbray@gmail.com>"
|
|
||||||
"ELLIOTTCABLE <opam@ell.io>"
|
|
||||||
]
|
|
||||||
authors: ["the Imandra team and contributors"]
|
|
||||||
license: "MIT"
|
license: "MIT"
|
||||||
homepage: "https://github.com/imandra-ai/ocaml-opentelemetry"
|
homepage: "https://github.com/ocaml-tracing/ocaml-opentelemetry"
|
||||||
bug-reports: "https://github.com/imandra-ai/ocaml-opentelemetry/issues"
|
bug-reports: "https://github.com/ocaml-tracing/ocaml-opentelemetry/issues"
|
||||||
depends: [
|
depends: [
|
||||||
"dune" {>= "3.11"}
|
"dune" {>= "3.11"}
|
||||||
"ocaml" {>= "5.00"}
|
"ocaml" {>= "5.00"}
|
||||||
|
|
@ -27,6 +23,8 @@ depends: [
|
||||||
"alcotest" {with-test}
|
"alcotest" {with-test}
|
||||||
"containers" {with-test}
|
"containers" {with-test}
|
||||||
"cohttp-lwt-unix" {with-test}
|
"cohttp-lwt-unix" {with-test}
|
||||||
|
"logs" {with-test}
|
||||||
|
"opentelemetry-lwt" {with-test & = version}
|
||||||
]
|
]
|
||||||
build: [
|
build: [
|
||||||
["dune" "subst"] {dev}
|
["dune" "subst"] {dev}
|
||||||
|
|
@ -42,4 +40,4 @@ build: [
|
||||||
"@doc" {with-doc}
|
"@doc" {with-doc}
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
dev-repo: "git+https://github.com/imandra-ai/ocaml-opentelemetry.git"
|
dev-repo: "git+https://github.com/ocaml-tracing/ocaml-opentelemetry.git"
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,12 @@
|
||||||
# This file is generated by dune, edit dune-project instead
|
# This file is generated by dune, edit dune-project instead
|
||||||
opam-version: "2.0"
|
opam-version: "2.0"
|
||||||
version: "0.12"
|
version: "0.91"
|
||||||
synopsis: "Collector client for opentelemetry, using cohttp + lwt"
|
synopsis: "Collector client for opentelemetry, using cohttp + lwt"
|
||||||
maintainer: [
|
maintainer: ["ocaml-tracing"]
|
||||||
"Simon Cruanes <simon.cruanes.2007@m4x.org>"
|
authors: ["ocaml-tracing" "ELLIOTTCABLE <opam@ell.io>" "the imandra team"]
|
||||||
"Matt Bray <mattjbray@gmail.com>"
|
|
||||||
"ELLIOTTCABLE <opam@ell.io>"
|
|
||||||
]
|
|
||||||
authors: ["the Imandra team and contributors"]
|
|
||||||
license: "MIT"
|
license: "MIT"
|
||||||
homepage: "https://github.com/imandra-ai/ocaml-opentelemetry"
|
homepage: "https://github.com/ocaml-tracing/ocaml-opentelemetry"
|
||||||
bug-reports: "https://github.com/imandra-ai/ocaml-opentelemetry/issues"
|
bug-reports: "https://github.com/ocaml-tracing/ocaml-opentelemetry/issues"
|
||||||
depends: [
|
depends: [
|
||||||
"dune" {>= "3.11"}
|
"dune" {>= "3.11"}
|
||||||
"ocaml" {>= "4.08"}
|
"ocaml" {>= "4.08"}
|
||||||
|
|
@ -26,7 +22,6 @@ depends: [
|
||||||
"cohttp-lwt-unix"
|
"cohttp-lwt-unix"
|
||||||
"alcotest" {with-test}
|
"alcotest" {with-test}
|
||||||
"containers" {with-test}
|
"containers" {with-test}
|
||||||
"opentelemetry-lwt" {with-test & = version}
|
|
||||||
]
|
]
|
||||||
build: [
|
build: [
|
||||||
["dune" "subst"] {dev}
|
["dune" "subst"] {dev}
|
||||||
|
|
@ -42,4 +37,4 @@ build: [
|
||||||
"@doc" {with-doc}
|
"@doc" {with-doc}
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
dev-repo: "git+https://github.com/imandra-ai/ocaml-opentelemetry.git"
|
dev-repo: "git+https://github.com/ocaml-tracing/ocaml-opentelemetry.git"
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,28 @@
|
||||||
# This file is generated by dune, edit dune-project instead
|
# This file is generated by dune, edit dune-project instead
|
||||||
opam-version: "2.0"
|
opam-version: "2.0"
|
||||||
version: "0.12"
|
version: "0.91"
|
||||||
synopsis: "Collector client for opentelemetry, using ezcurl-lwt"
|
synopsis: "Collector client for opentelemetry, using ezcurl-lwt"
|
||||||
maintainer: [
|
maintainer: ["ocaml-tracing"]
|
||||||
"Simon Cruanes <simon.cruanes.2007@m4x.org>"
|
authors: ["ocaml-tracing" "ELLIOTTCABLE <opam@ell.io>" "the imandra team"]
|
||||||
"Matt Bray <mattjbray@gmail.com>"
|
|
||||||
"ELLIOTTCABLE <opam@ell.io>"
|
|
||||||
]
|
|
||||||
authors: ["the Imandra team and contributors"]
|
|
||||||
license: "MIT"
|
license: "MIT"
|
||||||
homepage: "https://github.com/imandra-ai/ocaml-opentelemetry"
|
homepage: "https://github.com/ocaml-tracing/ocaml-opentelemetry"
|
||||||
bug-reports: "https://github.com/imandra-ai/ocaml-opentelemetry/issues"
|
bug-reports: "https://github.com/ocaml-tracing/ocaml-opentelemetry/issues"
|
||||||
depends: [
|
depends: [
|
||||||
"dune" {>= "3.11"}
|
"dune" {>= "3.11"}
|
||||||
"ocaml" {>= "4.08"}
|
"ocaml" {>= "4.11"}
|
||||||
"mtime" {>= "1.4"}
|
"mtime" {>= "1.4"}
|
||||||
"opentelemetry" {= version}
|
"opentelemetry" {= version}
|
||||||
"opentelemetry-client" {= version}
|
"opentelemetry-client" {= version}
|
||||||
"odoc" {with-doc}
|
"odoc" {with-doc}
|
||||||
"ezcurl-lwt" {>= "0.2.3"}
|
"ezcurl-lwt" {>= "0.2.3"}
|
||||||
"ocurl"
|
"ocurl"
|
||||||
"lwt" {>= "5.3"}
|
"lwt" {>= "5.7.3"}
|
||||||
"lwt_ppx" {>= "2.0"}
|
"lwt_ppx" {>= "2.0"}
|
||||||
|
"ambient-context-lwt"
|
||||||
"alcotest" {with-test}
|
"alcotest" {with-test}
|
||||||
|
"cohttp-lwt-unix" {with-test}
|
||||||
|
"containers" {with-test}
|
||||||
|
"logs" {with-test}
|
||||||
]
|
]
|
||||||
build: [
|
build: [
|
||||||
["dune" "subst"] {dev}
|
["dune" "subst"] {dev}
|
||||||
|
|
@ -38,4 +38,4 @@ build: [
|
||||||
"@doc" {with-doc}
|
"@doc" {with-doc}
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
dev-repo: "git+https://github.com/imandra-ai/ocaml-opentelemetry.git"
|
dev-repo: "git+https://github.com/ocaml-tracing/ocaml-opentelemetry.git"
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,25 @@
|
||||||
# This file is generated by dune, edit dune-project instead
|
# This file is generated by dune, edit dune-project instead
|
||||||
opam-version: "2.0"
|
opam-version: "2.0"
|
||||||
version: "0.12"
|
version: "0.91"
|
||||||
synopsis: "Collector client for opentelemetry, using http + ezcurl"
|
synopsis: "Collector client for opentelemetry, using http + ezcurl"
|
||||||
maintainer: [
|
maintainer: ["ocaml-tracing"]
|
||||||
"Simon Cruanes <simon.cruanes.2007@m4x.org>"
|
authors: ["ocaml-tracing" "ELLIOTTCABLE <opam@ell.io>" "the imandra team"]
|
||||||
"Matt Bray <mattjbray@gmail.com>"
|
|
||||||
"ELLIOTTCABLE <opam@ell.io>"
|
|
||||||
]
|
|
||||||
authors: ["the Imandra team and contributors"]
|
|
||||||
license: "MIT"
|
license: "MIT"
|
||||||
homepage: "https://github.com/imandra-ai/ocaml-opentelemetry"
|
homepage: "https://github.com/ocaml-tracing/ocaml-opentelemetry"
|
||||||
bug-reports: "https://github.com/imandra-ai/ocaml-opentelemetry/issues"
|
bug-reports: "https://github.com/ocaml-tracing/ocaml-opentelemetry/issues"
|
||||||
depends: [
|
depends: [
|
||||||
"dune" {>= "3.11"}
|
"dune" {>= "3.11"}
|
||||||
"ocaml" {>= "4.08"}
|
"ocaml" {>= "4.11"}
|
||||||
"mtime" {>= "1.4"}
|
"mtime" {>= "1.4"}
|
||||||
"opentelemetry" {= version}
|
"opentelemetry" {= version}
|
||||||
"opentelemetry-client" {= version}
|
"opentelemetry-client" {= version}
|
||||||
"odoc" {with-doc}
|
"odoc" {with-doc}
|
||||||
"ezcurl" {>= "0.2.3"}
|
"ezcurl" {>= "0.2.3"}
|
||||||
"ocurl"
|
"curl"
|
||||||
"alcotest" {with-test}
|
"alcotest" {with-test}
|
||||||
|
"cohttp-lwt-unix" {with-test}
|
||||||
|
"containers" {with-test}
|
||||||
|
"logs" {with-test}
|
||||||
]
|
]
|
||||||
build: [
|
build: [
|
||||||
["dune" "subst"] {dev}
|
["dune" "subst"] {dev}
|
||||||
|
|
@ -36,4 +35,4 @@ build: [
|
||||||
"@doc" {with-doc}
|
"@doc" {with-doc}
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
dev-repo: "git+https://github.com/imandra-ai/ocaml-opentelemetry.git"
|
dev-repo: "git+https://github.com/ocaml-tracing/ocaml-opentelemetry.git"
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,13 @@
|
||||||
# This file is generated by dune, edit dune-project instead
|
# This file is generated by dune, edit dune-project instead
|
||||||
opam-version: "2.0"
|
opam-version: "2.0"
|
||||||
version: "0.12"
|
version: "0.91"
|
||||||
synopsis: "Client SDK for https://opentelemetry.io"
|
synopsis: "Client SDK for https://opentelemetry.io"
|
||||||
maintainer: [
|
maintainer: ["ocaml-tracing"]
|
||||||
"Simon Cruanes <simon.cruanes.2007@m4x.org>"
|
authors: ["ocaml-tracing" "ELLIOTTCABLE <opam@ell.io>" "the imandra team"]
|
||||||
"Matt Bray <mattjbray@gmail.com>"
|
|
||||||
"ELLIOTTCABLE <opam@ell.io>"
|
|
||||||
]
|
|
||||||
authors: ["the Imandra team and contributors"]
|
|
||||||
license: "MIT"
|
license: "MIT"
|
||||||
tags: ["tracing" "opentelemetry" "sdk"]
|
tags: ["tracing" "opentelemetry" "sdk"]
|
||||||
homepage: "https://github.com/imandra-ai/ocaml-opentelemetry"
|
homepage: "https://github.com/ocaml-tracing/ocaml-opentelemetry"
|
||||||
bug-reports: "https://github.com/imandra-ai/ocaml-opentelemetry/issues"
|
bug-reports: "https://github.com/ocaml-tracing/ocaml-opentelemetry/issues"
|
||||||
depends: [
|
depends: [
|
||||||
"dune" {>= "3.11"}
|
"dune" {>= "3.11"}
|
||||||
"opentelemetry" {= version}
|
"opentelemetry" {= version}
|
||||||
|
|
@ -33,4 +29,4 @@ build: [
|
||||||
"@doc" {with-doc}
|
"@doc" {with-doc}
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
dev-repo: "git+https://github.com/imandra-ai/ocaml-opentelemetry.git"
|
dev-repo: "git+https://github.com/ocaml-tracing/ocaml-opentelemetry.git"
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,12 @@
|
||||||
# This file is generated by dune, edit dune-project instead
|
# This file is generated by dune, edit dune-project instead
|
||||||
opam-version: "2.0"
|
opam-version: "2.0"
|
||||||
version: "0.12"
|
version: "0.91"
|
||||||
synopsis: "Opentelemetry tracing for Cohttp HTTP servers"
|
synopsis: "Opentelemetry tracing for Cohttp HTTP servers"
|
||||||
maintainer: [
|
maintainer: ["ocaml-tracing"]
|
||||||
"Simon Cruanes <simon.cruanes.2007@m4x.org>"
|
authors: ["ocaml-tracing" "ELLIOTTCABLE <opam@ell.io>" "the imandra team"]
|
||||||
"Matt Bray <mattjbray@gmail.com>"
|
|
||||||
"ELLIOTTCABLE <opam@ell.io>"
|
|
||||||
]
|
|
||||||
authors: ["the Imandra team and contributors"]
|
|
||||||
license: "MIT"
|
license: "MIT"
|
||||||
homepage: "https://github.com/imandra-ai/ocaml-opentelemetry"
|
homepage: "https://github.com/ocaml-tracing/ocaml-opentelemetry"
|
||||||
bug-reports: "https://github.com/imandra-ai/ocaml-opentelemetry/issues"
|
bug-reports: "https://github.com/ocaml-tracing/ocaml-opentelemetry/issues"
|
||||||
depends: [
|
depends: [
|
||||||
"dune" {>= "3.11"}
|
"dune" {>= "3.11"}
|
||||||
"ocaml" {>= "4.08"}
|
"ocaml" {>= "4.08"}
|
||||||
|
|
@ -37,4 +33,4 @@ build: [
|
||||||
"@doc" {with-doc}
|
"@doc" {with-doc}
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
dev-repo: "git+https://github.com/imandra-ai/ocaml-opentelemetry.git"
|
dev-repo: "git+https://github.com/ocaml-tracing/ocaml-opentelemetry.git"
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,12 @@
|
||||||
# This file is generated by dune, edit dune-project instead
|
# This file is generated by dune, edit dune-project instead
|
||||||
opam-version: "2.0"
|
opam-version: "2.0"
|
||||||
version: "0.12"
|
version: "0.91"
|
||||||
synopsis: "Opentelemetry-based reporter for Logs"
|
synopsis: "Opentelemetry-based reporter for Logs"
|
||||||
maintainer: [
|
maintainer: ["ocaml-tracing"]
|
||||||
"Simon Cruanes <simon.cruanes.2007@m4x.org>"
|
authors: ["ocaml-tracing" "ELLIOTTCABLE <opam@ell.io>" "the imandra team"]
|
||||||
"Matt Bray <mattjbray@gmail.com>"
|
|
||||||
"ELLIOTTCABLE <opam@ell.io>"
|
|
||||||
]
|
|
||||||
authors: ["the Imandra team and contributors"]
|
|
||||||
license: "MIT"
|
license: "MIT"
|
||||||
homepage: "https://github.com/imandra-ai/ocaml-opentelemetry"
|
homepage: "https://github.com/ocaml-tracing/ocaml-opentelemetry"
|
||||||
bug-reports: "https://github.com/imandra-ai/ocaml-opentelemetry/issues"
|
bug-reports: "https://github.com/ocaml-tracing/ocaml-opentelemetry/issues"
|
||||||
depends: [
|
depends: [
|
||||||
"dune" {>= "3.11"}
|
"dune" {>= "3.11"}
|
||||||
"ocaml" {>= "4.08"}
|
"ocaml" {>= "4.08"}
|
||||||
|
|
@ -37,4 +33,4 @@ build: [
|
||||||
"@doc" {with-doc}
|
"@doc" {with-doc}
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
dev-repo: "git+https://github.com/imandra-ai/ocaml-opentelemetry.git"
|
dev-repo: "git+https://github.com/ocaml-tracing/ocaml-opentelemetry.git"
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,13 @@
|
||||||
# This file is generated by dune, edit dune-project instead
|
# This file is generated by dune, edit dune-project instead
|
||||||
opam-version: "2.0"
|
opam-version: "2.0"
|
||||||
version: "0.12"
|
version: "0.91"
|
||||||
synopsis: "Lwt-compatible instrumentation for https://opentelemetry.io"
|
synopsis: "Lwt-compatible instrumentation for https://opentelemetry.io"
|
||||||
maintainer: [
|
maintainer: ["ocaml-tracing"]
|
||||||
"Simon Cruanes <simon.cruanes.2007@m4x.org>"
|
authors: ["ocaml-tracing" "ELLIOTTCABLE <opam@ell.io>" "the imandra team"]
|
||||||
"Matt Bray <mattjbray@gmail.com>"
|
|
||||||
"ELLIOTTCABLE <opam@ell.io>"
|
|
||||||
]
|
|
||||||
authors: ["the Imandra team and contributors"]
|
|
||||||
license: "MIT"
|
license: "MIT"
|
||||||
tags: ["instrumentation" "tracing" "opentelemetry" "datadog" "lwt"]
|
tags: ["instrumentation" "tracing" "opentelemetry" "datadog" "lwt"]
|
||||||
homepage: "https://github.com/imandra-ai/ocaml-opentelemetry"
|
homepage: "https://github.com/ocaml-tracing/ocaml-opentelemetry"
|
||||||
bug-reports: "https://github.com/imandra-ai/ocaml-opentelemetry/issues"
|
bug-reports: "https://github.com/ocaml-tracing/ocaml-opentelemetry/issues"
|
||||||
depends: [
|
depends: [
|
||||||
"dune" {>= "3.11"}
|
"dune" {>= "3.11"}
|
||||||
"ocaml" {>= "4.08"}
|
"ocaml" {>= "4.08"}
|
||||||
|
|
@ -37,4 +33,4 @@ build: [
|
||||||
"@doc" {with-doc}
|
"@doc" {with-doc}
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
dev-repo: "git+https://github.com/imandra-ai/ocaml-opentelemetry.git"
|
dev-repo: "git+https://github.com/ocaml-tracing/ocaml-opentelemetry.git"
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,14 @@
|
||||||
# This file is generated by dune, edit dune-project instead
|
# This file is generated by dune, edit dune-project instead
|
||||||
opam-version: "2.0"
|
opam-version: "2.0"
|
||||||
version: "0.12"
|
version: "0.91"
|
||||||
synopsis:
|
synopsis:
|
||||||
"Core library for instrumentation and serialization for https://opentelemetry.io"
|
"Core library for instrumentation and serialization for https://opentelemetry.io"
|
||||||
maintainer: [
|
maintainer: ["ocaml-tracing"]
|
||||||
"Simon Cruanes <simon.cruanes.2007@m4x.org>"
|
authors: ["ocaml-tracing" "ELLIOTTCABLE <opam@ell.io>" "the imandra team"]
|
||||||
"Matt Bray <mattjbray@gmail.com>"
|
|
||||||
"ELLIOTTCABLE <opam@ell.io>"
|
|
||||||
]
|
|
||||||
authors: ["the Imandra team and contributors"]
|
|
||||||
license: "MIT"
|
license: "MIT"
|
||||||
tags: ["instrumentation" "tracing" "opentelemetry" "datadog" "jaeger"]
|
tags: ["instrumentation" "tracing" "opentelemetry" "datadog" "jaeger"]
|
||||||
homepage: "https://github.com/imandra-ai/ocaml-opentelemetry"
|
homepage: "https://github.com/ocaml-tracing/ocaml-opentelemetry"
|
||||||
bug-reports: "https://github.com/imandra-ai/ocaml-opentelemetry/issues"
|
bug-reports: "https://github.com/ocaml-tracing/ocaml-opentelemetry/issues"
|
||||||
depends: [
|
depends: [
|
||||||
"dune" {>= "3.11"}
|
"dune" {>= "3.11"}
|
||||||
"ocaml" {>= "4.08"}
|
"ocaml" {>= "4.08"}
|
||||||
|
|
@ -45,4 +41,4 @@ build: [
|
||||||
"@doc" {with-doc}
|
"@doc" {with-doc}
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
dev-repo: "git+https://github.com/imandra-ai/ocaml-opentelemetry.git"
|
dev-repo: "git+https://github.com/ocaml-tracing/ocaml-opentelemetry.git"
|
||||||
|
|
|
||||||
|
|
@ -169,6 +169,7 @@ let create_exporter ?(config = Config.make ()) ~sw ~env () =
|
||||||
let consumer = create_consumer ~config ~sw ~env () in
|
let consumer = create_consumer ~config ~sw ~env () in
|
||||||
let bq =
|
let bq =
|
||||||
Opentelemetry_client_sync.Bounded_queue_sync.create
|
Opentelemetry_client_sync.Bounded_queue_sync.create
|
||||||
|
~measure:Any_signal_l.length
|
||||||
~high_watermark:Bounded_queue.Defaults.high_watermark ()
|
~high_watermark:Bounded_queue.Defaults.high_watermark ()
|
||||||
in
|
in
|
||||||
Exporter_queued.create ~clock:Clock.ptime_clock ~q:bq ~consumer ()
|
Exporter_queued.create ~clock:Clock.ptime_clock ~q:bq ~consumer ()
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,7 @@ let create_exporter ?(config = Config.make ()) () =
|
||||||
let consumer = create_consumer ~config () in
|
let consumer = create_consumer ~config () in
|
||||||
let bq =
|
let bq =
|
||||||
Opentelemetry_client_sync.Bounded_queue_sync.create
|
Opentelemetry_client_sync.Bounded_queue_sync.create
|
||||||
|
~measure:OTEL.Any_signal_l.length
|
||||||
~high_watermark:Bounded_queue.Defaults.high_watermark ()
|
~high_watermark:Bounded_queue.Defaults.high_watermark ()
|
||||||
in
|
in
|
||||||
Exporter_queued.create ~clock:Clock.ptime_clock ~q:bq ~consumer ()
|
Exporter_queued.create ~clock:Clock.ptime_clock ~q:bq ~consumer ()
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,7 @@ let create_exporter ?(config = Config.make ()) () =
|
||||||
let consumer = create_consumer ~config () in
|
let consumer = create_consumer ~config () in
|
||||||
let bq =
|
let bq =
|
||||||
Opentelemetry_client_sync.Bounded_queue_sync.create
|
Opentelemetry_client_sync.Bounded_queue_sync.create
|
||||||
|
~measure:OTEL.Any_signal_l.length
|
||||||
~high_watermark:Bounded_queue.Defaults.high_watermark ()
|
~high_watermark:Bounded_queue.Defaults.high_watermark ()
|
||||||
in
|
in
|
||||||
Exporter_queued.create ~clock:Clock.ptime_clock ~q:bq ~consumer ()
|
Exporter_queued.create ~clock:Clock.ptime_clock ~q:bq ~consumer ()
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ val setup : ?config:Config.t -> ?enable:bool -> unit -> unit
|
||||||
|
|
||||||
val remove_backend : unit -> unit Lwt.t
|
val remove_backend : unit -> unit Lwt.t
|
||||||
(** Shutdown current backend
|
(** Shutdown current backend
|
||||||
@since NEXT_RELEASE *)
|
@since 0.90 *)
|
||||||
|
|
||||||
val with_setup :
|
val with_setup :
|
||||||
?after_shutdown:(Opentelemetry.Exporter.t -> unit) ->
|
?after_shutdown:(Opentelemetry.Exporter.t -> unit) ->
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,7 @@ let create_exporter ?(config = Config.make ()) () : OTEL.Exporter.t =
|
||||||
let consumer = consumer ~config () in
|
let consumer = consumer ~config () in
|
||||||
let bq =
|
let bq =
|
||||||
Opentelemetry_client_sync.Bounded_queue_sync.create
|
Opentelemetry_client_sync.Bounded_queue_sync.create
|
||||||
|
~measure:OTEL.Any_signal_l.length
|
||||||
~high_watermark:OTELC.Bounded_queue.Defaults.high_watermark ()
|
~high_watermark:OTELC.Bounded_queue.Defaults.high_watermark ()
|
||||||
in
|
in
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ val consumer :
|
||||||
(** Consumer that pulls from a queue *)
|
(** Consumer that pulls from a queue *)
|
||||||
|
|
||||||
val create_exporter : ?config:Config.t -> unit -> Opentelemetry.Exporter.t
|
val create_exporter : ?config:Config.t -> unit -> Opentelemetry.Exporter.t
|
||||||
(** @since NEXT_RELEASE *)
|
(** @since 0.90 *)
|
||||||
|
|
||||||
val create_backend : ?config:Config.t -> unit -> Opentelemetry.Exporter.t
|
val create_backend : ?config:Config.t -> unit -> Opentelemetry.Exporter.t
|
||||||
[@@deprecated "use create_exporter"]
|
[@@deprecated "use create_exporter"]
|
||||||
|
|
@ -26,7 +26,7 @@ val setup : ?config:Config.t -> ?enable:bool -> unit -> unit
|
||||||
after a little while. *)
|
after a little while. *)
|
||||||
|
|
||||||
val remove_exporter : unit -> unit
|
val remove_exporter : unit -> unit
|
||||||
(** @since NEXT_RELEASE *)
|
(** @since 0.90 *)
|
||||||
|
|
||||||
val remove_backend : unit -> unit
|
val remove_backend : unit -> unit
|
||||||
[@@deprecated "use remove_exporter"]
|
[@@deprecated "use remove_exporter"]
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
than [add_batching (limit_interval ~min_interval e)], because in the later
|
than [add_batching (limit_interval ~min_interval e)], because in the later
|
||||||
case we might be dismissing a whole large batch at ine
|
case we might be dismissing a whole large batch at ine
|
||||||
|
|
||||||
@since NEXT_RELEASE *)
|
@since 0.90 *)
|
||||||
|
|
||||||
open Common_.OTEL
|
open Common_.OTEL
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,12 @@ let str_to_hex (s : string) : string =
|
||||||
Opentelemetry_util.Util_bytes_.bytes_to_hex (Bytes.unsafe_of_string s)
|
Opentelemetry_util.Util_bytes_.bytes_to_hex (Bytes.unsafe_of_string s)
|
||||||
|
|
||||||
(** Report the error on stderr. *)
|
(** Report the error on stderr. *)
|
||||||
let report_err ~level:(provided_level : [ `Debug | `Auto ]) (err : t) : unit =
|
let report_err ~level:(provided_level : [ `Debug | `Warning | `Auto ]) (err : t)
|
||||||
|
: unit =
|
||||||
let compute_level lvl =
|
let compute_level lvl =
|
||||||
match provided_level with
|
match provided_level with
|
||||||
| `Debug -> Opentelemetry.Self_debug.Debug
|
| `Debug -> Opentelemetry.Self_debug.Debug
|
||||||
|
| `Warning -> Opentelemetry.Self_debug.Warning
|
||||||
| `Auto -> lvl
|
| `Auto -> lvl
|
||||||
in
|
in
|
||||||
match err with
|
match err with
|
||||||
|
|
@ -24,7 +26,7 @@ let report_err ~level:(provided_level : [ `Debug | `Auto ]) (err : t) : unit =
|
||||||
"opentelemetry: ctrl-c captured, stopping")
|
"opentelemetry: ctrl-c captured, stopping")
|
||||||
| `Failure msg ->
|
| `Failure msg ->
|
||||||
Opentelemetry.Self_debug.log (compute_level Error) (fun () ->
|
Opentelemetry.Self_debug.log (compute_level Error) (fun () ->
|
||||||
Printf.sprintf "opentelemetry: export failed: %s" msg)
|
Printf.sprintf "opentelemetry: export failed:\n%s" msg)
|
||||||
| `Status
|
| `Status
|
||||||
( code,
|
( code,
|
||||||
{
|
{
|
||||||
|
|
@ -57,8 +59,9 @@ let decode_invalid_http_response ~attempt_descr ~code ~url (body : string) : t =
|
||||||
let bt = Printexc.get_backtrace () in
|
let bt = Printexc.get_backtrace () in
|
||||||
`Failure
|
`Failure
|
||||||
(Printf.sprintf
|
(Printf.sprintf
|
||||||
"httpc: decoding of status (url=%S, code=%d) failed with:\n\
|
"http server at %s returned code %d;\n\
|
||||||
|
trying to decode the body as protobuf failed:\n\
|
||||||
%s\n\
|
%s\n\
|
||||||
HTTP body: %s\n\
|
raw HTTP body (hex): %s\n\
|
||||||
%s"
|
%s"
|
||||||
url code (Printexc.to_string e) (str_to_hex body) bt)
|
url code (Printexc.to_string e) (str_to_hex body) bt)
|
||||||
|
|
|
||||||
|
|
@ -75,12 +75,12 @@ type t = {
|
||||||
self_metrics: bool;
|
self_metrics: bool;
|
||||||
(** If true, the OTEL library will regularly emit metrics about itself.
|
(** If true, the OTEL library will regularly emit metrics about itself.
|
||||||
Default [false].
|
Default [false].
|
||||||
@since NEXT_RELEASE *)
|
@since 0.90 *)
|
||||||
http_concurrency_level: int option;
|
http_concurrency_level: int option;
|
||||||
(** How many HTTP requests can be done simultaneously (at most)? This can
|
(** How many HTTP requests can be done simultaneously (at most)? This can
|
||||||
be used to represent the size of a pool of workers where each worker
|
be used to represent the size of a pool of workers where each worker
|
||||||
gets a batch to send, send it, and repeats.
|
gets a batch to send, send it, and repeats.
|
||||||
@since NEXT_RELEASE *)
|
@since 0.90 *)
|
||||||
retry_max_attempts: int;
|
retry_max_attempts: int;
|
||||||
(** Maximum number of retry attempts for failed exports. 0 means no retry,
|
(** Maximum number of retry attempts for failed exports. 0 means no retry,
|
||||||
1 means one retry after initial failure. Default 3. *)
|
1 means one retry after initial failure. Default 3. *)
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ end = struct
|
||||||
| Error err
|
| Error err
|
||||||
when should_retry err && attempt < self.config.retry_max_attempts ->
|
when should_retry err && attempt < self.config.retry_max_attempts ->
|
||||||
let delay_s = delay_ms /. 1000. in
|
let delay_s = delay_ms /. 1000. in
|
||||||
Export_error.report_err ~level:`Debug err;
|
Export_error.report_err ~level:`Warning err;
|
||||||
|
|
||||||
let* () = sleep_s delay_s in
|
let* () = sleep_s delay_s in
|
||||||
let next_delay =
|
let next_delay =
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
Opentelemetry_client
|
Opentelemetry_client
|
||||||
-open
|
-open
|
||||||
Opentelemetry_atomic)
|
Opentelemetry_atomic)
|
||||||
|
(modules :standard \ gen_types_)
|
||||||
(optional) ; lwt
|
(optional) ; lwt
|
||||||
(libraries
|
(libraries
|
||||||
opentelemetry.util
|
opentelemetry.util
|
||||||
|
|
@ -26,18 +27,13 @@
|
||||||
lwt.unix)
|
lwt.unix)
|
||||||
(synopsis "Lwt-specific helpers for opentelemetry-client"))
|
(synopsis "Lwt-specific helpers for opentelemetry-client"))
|
||||||
|
|
||||||
(rule
|
(executable
|
||||||
(enabled_if
|
(name gen_types_)
|
||||||
(and
|
(modules gen_types_))
|
||||||
%{lib-available:lwt}
|
|
||||||
(>= %{version:lwt} 6.0)))
|
|
||||||
(action
|
|
||||||
(copy types_.ml.6 types_.ml)))
|
|
||||||
|
|
||||||
(rule
|
(rule
|
||||||
(enabled_if
|
(enabled_if %{lib-available:lwt})
|
||||||
(and
|
(deps types_.ml.5 types_.ml.6)
|
||||||
%{lib-available:lwt}
|
(target types_.ml)
|
||||||
(< %{version:lwt} 6.0)))
|
|
||||||
(action
|
(action
|
||||||
(copy types_.ml.5 types_.ml)))
|
(run ./gen_types_.exe %{version:lwt})))
|
||||||
|
|
|
||||||
23
src/client/lwt/gen_types_.ml
Normal file
23
src/client/lwt/gen_types_.ml
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
let copy_file src dst =
|
||||||
|
let ic = open_in src in
|
||||||
|
let oc = open_out dst in
|
||||||
|
let buf = Bytes.create 1024 in
|
||||||
|
(try
|
||||||
|
while true do
|
||||||
|
let n = input ic buf 0 (Bytes.length buf) in
|
||||||
|
if n = 0 then raise End_of_file;
|
||||||
|
output oc buf 0 n
|
||||||
|
done
|
||||||
|
with End_of_file -> ());
|
||||||
|
close_in ic;
|
||||||
|
close_out oc
|
||||||
|
|
||||||
|
let () =
|
||||||
|
let version = Sys.argv.(1) in
|
||||||
|
let major =
|
||||||
|
try Scanf.sscanf version "%d.%s" (fun maj _ -> maj) with _ -> 0
|
||||||
|
in
|
||||||
|
if major >= 6 then
|
||||||
|
copy_file "types_.ml.6" "types_.ml"
|
||||||
|
else
|
||||||
|
copy_file "types_.ml.5" "types_.ml"
|
||||||
|
|
@ -88,21 +88,27 @@ type 'a state = {
|
||||||
high_watermark: int;
|
high_watermark: int;
|
||||||
q: 'a Q.t;
|
q: 'a Q.t;
|
||||||
on_non_empty: Cb_set.t;
|
on_non_empty: Cb_set.t;
|
||||||
|
measure: 'a -> int;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let measure_all_ measure xs = List.fold_left (fun acc x -> acc + measure x) 0 xs
|
||||||
|
|
||||||
let push (self : _ state) x =
|
let push (self : _ state) x =
|
||||||
if x <> [] then (
|
if x <> [] then (
|
||||||
match
|
match
|
||||||
Q.push_while_not_full self.q ~high_watermark:self.high_watermark x
|
Q.push_while_not_full self.q ~high_watermark:self.high_watermark x
|
||||||
with
|
with
|
||||||
| Closed ->
|
| Closed ->
|
||||||
ignore (Atomic.fetch_and_add self.n_discarded (List.length x) : int)
|
let n = measure_all_ self.measure x in
|
||||||
|
ignore (Atomic.fetch_and_add self.n_discarded n : int)
|
||||||
| Pushed { num_discarded } ->
|
| Pushed { num_discarded } ->
|
||||||
if num_discarded > 0 then (
|
if num_discarded > 0 then (
|
||||||
ignore (Atomic.fetch_and_add self.n_discarded num_discarded : int);
|
let n_signals = measure_all_ self.measure x in
|
||||||
|
let total = Atomic.fetch_and_add self.n_discarded n_signals in
|
||||||
Opentelemetry.Self_debug.log Warning (fun () ->
|
Opentelemetry.Self_debug.log Warning (fun () ->
|
||||||
Printf.sprintf "otel: dropped %d signals (exporter queue full)"
|
Printf.sprintf
|
||||||
num_discarded)
|
"otel: dropped %d signals (queue full: %d/%d, total dropped: %d)"
|
||||||
|
n_signals (Q.size self.q) self.high_watermark (total + n_signals))
|
||||||
);
|
);
|
||||||
(* wake up potentially asleep consumers *)
|
(* wake up potentially asleep consumers *)
|
||||||
Cb_set.trigger self.on_non_empty
|
Cb_set.trigger self.on_non_empty
|
||||||
|
|
@ -129,13 +135,14 @@ let to_bounded_queue (self : 'a state) : 'a BQ.t =
|
||||||
recv = { try_pop; on_non_empty; common };
|
recv = { try_pop; on_non_empty; common };
|
||||||
}
|
}
|
||||||
|
|
||||||
let create ~high_watermark () : _ BQ.t =
|
let create ?(measure = fun _ -> 1) ~high_watermark () : _ BQ.t =
|
||||||
let st =
|
let st =
|
||||||
{
|
{
|
||||||
high_watermark;
|
high_watermark;
|
||||||
q = Q.create ();
|
q = Q.create ();
|
||||||
n_discarded = Atomic.make 0;
|
n_discarded = Atomic.make 0;
|
||||||
on_non_empty = Cb_set.create ();
|
on_non_empty = Cb_set.create ();
|
||||||
|
measure;
|
||||||
}
|
}
|
||||||
in
|
in
|
||||||
to_bounded_queue st
|
to_bounded_queue st
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,11 @@
|
||||||
|
|
||||||
This is not the fastest queue but it should be versatile. *)
|
This is not the fastest queue but it should be versatile. *)
|
||||||
|
|
||||||
val create : high_watermark:int -> unit -> 'a Bounded_queue.t
|
val create :
|
||||||
|
?measure:('a -> int) -> high_watermark:int -> unit -> 'a Bounded_queue.t
|
||||||
(** [create ~high_watermark ()] creates a new bounded queue based on
|
(** [create ~high_watermark ()] creates a new bounded queue based on
|
||||||
{!Sync_queue} *)
|
{!Sync_queue}.
|
||||||
|
@param measure
|
||||||
|
maps each item to its signal count (e.g. number of spans in a batch). Used
|
||||||
|
to report accurate signal counts when items are dropped. Default:
|
||||||
|
[fun _ -> 1]. *)
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,11 @@ let pp out = function
|
||||||
| Metrics m -> pp_list Proto.Metrics.pp_metric out m
|
| Metrics m -> pp_list Proto.Metrics.pp_metric out m
|
||||||
| Logs l -> pp_list Proto.Logs.pp_log_record out l
|
| Logs l -> pp_list Proto.Logs.pp_log_record out l
|
||||||
|
|
||||||
|
let length = function
|
||||||
|
| Spans l -> List.length l
|
||||||
|
| Metrics l -> List.length l
|
||||||
|
| Logs l -> List.length l
|
||||||
|
|
||||||
let of_logs_or_empty = function
|
let of_logs_or_empty = function
|
||||||
| [] -> []
|
| [] -> []
|
||||||
| l -> [ Logs l ]
|
| l -> [ Logs l ]
|
||||||
|
|
|
||||||
|
|
@ -128,4 +128,4 @@ val default_kind : Span_kind.t ref
|
||||||
|
|
||||||
val k_ambient : t Context.key
|
val k_ambient : t Context.key
|
||||||
(** Context key to carry around a {!Span.t} in ambient context.
|
(** Context key to carry around a {!Span.t} in ambient context.
|
||||||
@since NEXT_RELEASE *)
|
@since 0.90 *)
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
(** Hooks to add attributes to every span or log *)
|
||||||
|
|
||||||
type t = unit -> Key_value.t list
|
type t = unit -> Key_value.t list
|
||||||
(** A dynamic enricher is a callback that produces high-cardinality attributes
|
(** A dynamic enricher is a callback that produces high-cardinality attributes
|
||||||
at span/log-record creation time. This enables "wide events". *)
|
at span/log-record creation time. This enables "wide events". *)
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
generally very fast (amortized), in most cases; the slow path is only when
|
generally very fast (amortized), in most cases; the slow path is only when
|
||||||
the batch needs to be emitted.
|
the batch needs to be emitted.
|
||||||
|
|
||||||
@since NEXT_RELEASE *)
|
@since 0.90 *)
|
||||||
|
|
||||||
open Opentelemetry_emitter
|
open Opentelemetry_emitter
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ let service_instance_id = ref None
|
||||||
@since 0.12 *)
|
@since 0.12 *)
|
||||||
let service_version = ref None
|
let service_version = ref None
|
||||||
|
|
||||||
(** @since NEXT_RELEASE *)
|
(** @since 0.90 *)
|
||||||
let sdk_version : string = Version.version
|
let sdk_version : string = Version.version
|
||||||
|
|
||||||
let instrumentation_library =
|
let instrumentation_library =
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ let minimum_min_interval_ = Mtime.Span.(100 * ms)
|
||||||
let default_min_interval_ = Mtime.Span.(4 * s)
|
let default_min_interval_ = Mtime.Span.(4 * s)
|
||||||
|
|
||||||
let clamp_interval_ interval =
|
let clamp_interval_ interval =
|
||||||
if Mtime.Span.is_shorter interval ~than:minimum_min_interval_ then
|
if Mtime.Span.compare interval minimum_min_interval_ < 0 then
|
||||||
minimum_min_interval_
|
minimum_min_interval_
|
||||||
else
|
else
|
||||||
interval
|
interval
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ module Core = Opentelemetry_core
|
||||||
|
|
||||||
module Interval_limiter = Interval_limiter
|
module Interval_limiter = Interval_limiter
|
||||||
(** Utility to limit the frequency of some event
|
(** Utility to limit the frequency of some event
|
||||||
@since NEXT_RELEASE *)
|
@since 0.90 *)
|
||||||
|
|
||||||
(** {2 Wire format} *)
|
(** {2 Wire format} *)
|
||||||
|
|
||||||
|
|
@ -27,15 +27,15 @@ module Exporter = struct
|
||||||
include Exporter
|
include Exporter
|
||||||
|
|
||||||
(** Get a tracer from this exporter.
|
(** Get a tracer from this exporter.
|
||||||
@since NEXT_RELEASE *)
|
@since 0.90 *)
|
||||||
let get_tracer (self : t) : Tracer.t = Tracer.of_exporter self
|
let get_tracer (self : t) : Tracer.t = Tracer.of_exporter self
|
||||||
|
|
||||||
(** Get a meter from this exporter.
|
(** Get a meter from this exporter.
|
||||||
@since NEXT_RELEASE *)
|
@since 0.90 *)
|
||||||
let get_meter (self : t) : Meter.t = Meter.of_exporter self
|
let get_meter (self : t) : Meter.t = Meter.of_exporter self
|
||||||
|
|
||||||
(** Get a logger from this exporter.
|
(** Get a logger from this exporter.
|
||||||
@since NEXT_RELEASE *)
|
@since 0.90 *)
|
||||||
let get_logger (self : t) : Logger.t = Logger.of_exporter self
|
let get_logger (self : t) : Logger.t = Logger.of_exporter self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -43,17 +43,17 @@ module Sdk = struct
|
||||||
include Sdk
|
include Sdk
|
||||||
|
|
||||||
(** Get a tracer forwarding to the current main exporter.
|
(** Get a tracer forwarding to the current main exporter.
|
||||||
@since NEXT_RELEASE *)
|
@since 0.90 *)
|
||||||
let get_tracer ?name ?version ?attrs ?__MODULE__ () =
|
let get_tracer ?name ?version ?attrs ?__MODULE__ () =
|
||||||
Trace_provider.get_tracer ?name ?version ?attrs ?__MODULE__ ()
|
Trace_provider.get_tracer ?name ?version ?attrs ?__MODULE__ ()
|
||||||
|
|
||||||
(** Get a meter forwarding to the current main exporter.
|
(** Get a meter forwarding to the current main exporter.
|
||||||
@since NEXT_RELEASE *)
|
@since 0.90 *)
|
||||||
let get_meter ?name ?version ?attrs ?__MODULE__ () =
|
let get_meter ?name ?version ?attrs ?__MODULE__ () =
|
||||||
Meter_provider.get_meter ?name ?version ?attrs ?__MODULE__ ()
|
Meter_provider.get_meter ?name ?version ?attrs ?__MODULE__ ()
|
||||||
|
|
||||||
(** Get a logger forwarding to the current main exporter.
|
(** Get a logger forwarding to the current main exporter.
|
||||||
@since NEXT_RELEASE *)
|
@since 0.90 *)
|
||||||
let get_logger ?name ?version ?attrs ?__MODULE__ () =
|
let get_logger ?name ?version ?attrs ?__MODULE__ () =
|
||||||
Log_provider.get_logger ?name ?version ?attrs ?__MODULE__ ()
|
Log_provider.get_logger ?name ?version ?attrs ?__MODULE__ ()
|
||||||
|
|
||||||
|
|
@ -165,7 +165,7 @@ module Trace_context = Trace_context
|
||||||
module Gc_metrics = Gc_metrics
|
module Gc_metrics = Gc_metrics
|
||||||
|
|
||||||
module Aswitch = Aswitch
|
module Aswitch = Aswitch
|
||||||
(** @since NEXT_RELEASE *)
|
(** @since 0.90 *)
|
||||||
|
|
||||||
module Alist = Alist
|
module Alist = Alist
|
||||||
(** Atomic list, for internal usage
|
(** Atomic list, for internal usage
|
||||||
|
|
|
||||||
|
|
@ -54,8 +54,9 @@ let run_tick_callbacks : unit -> unit = Globals.run_tick_callbacks
|
||||||
from their ticker. *)
|
from their ticker. *)
|
||||||
let tick : unit -> unit = Globals.run_tick_callbacks
|
let tick : unit -> unit = Globals.run_tick_callbacks
|
||||||
|
|
||||||
let set ?(traces = Provider_config.default) ?(metrics = Provider_config.default)
|
let set ?(traces = Provider_config.make ~batch:400 ())
|
||||||
?(logs = Provider_config.default) (exp : Exporter.t) : unit =
|
?(metrics = Provider_config.make ~batch:200 ())
|
||||||
|
?(logs = Provider_config.make ~batch:400 ()) (exp : Exporter.t) : unit =
|
||||||
Self_debug.log Info (fun () -> "opentelemetry: SDK set up");
|
Self_debug.log Info (fun () -> "opentelemetry: SDK set up");
|
||||||
Atomic.set exporter (Some exp);
|
Atomic.set exporter (Some exp);
|
||||||
let tracer : Tracer.t =
|
let tracer : Tracer.t =
|
||||||
|
|
|
||||||
|
|
@ -16,17 +16,21 @@ let string_of_level = function
|
||||||
| Warning -> "warning"
|
| Warning -> "warning"
|
||||||
| Error -> "error"
|
| Error -> "error"
|
||||||
|
|
||||||
let to_stderr ?(min_level = Warning) () : unit =
|
open struct
|
||||||
let[@inline] int_of_level_ = function
|
let[@inline] int_of_level_ = function
|
||||||
| Debug -> 0
|
| Debug -> 0
|
||||||
| Info -> 1
|
| Info -> 1
|
||||||
| Warning -> 2
|
| Warning -> 2
|
||||||
| Error -> 3
|
| Error -> 3
|
||||||
in
|
end
|
||||||
let threshold = int_of_level_ min_level in
|
|
||||||
|
let level_above ~min_level level : bool =
|
||||||
|
int_of_level_ level >= int_of_level_ min_level
|
||||||
|
|
||||||
|
let to_stderr ?(min_level = Warning) () : unit =
|
||||||
logger :=
|
logger :=
|
||||||
fun level mk_msg ->
|
fun level mk_msg ->
|
||||||
if int_of_level_ level >= threshold then (
|
if level_above ~min_level level then (
|
||||||
let msg = mk_msg () in
|
let msg = mk_msg () in
|
||||||
Printf.eprintf "[otel:%s] %s\n%!" (string_of_level level) msg
|
Printf.eprintf "[otel:%s] %s\n%!" (string_of_level level) msg
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
Self_debug.log Info (fun () -> Printf.sprintf "batch flushed %d items" n)
|
Self_debug.log Info (fun () -> Printf.sprintf "batch flushed %d items" n)
|
||||||
]}.
|
]}.
|
||||||
|
|
||||||
@since NEXT_RELEASE *)
|
@since 0.90 *)
|
||||||
|
|
||||||
type level =
|
type level =
|
||||||
| Debug
|
| Debug
|
||||||
|
|
@ -25,6 +25,11 @@ val logger : logger ref
|
||||||
val string_of_level : level -> string
|
val string_of_level : level -> string
|
||||||
(** String representation of a level. *)
|
(** String representation of a level. *)
|
||||||
|
|
||||||
|
val level_above : min_level:level -> level -> bool
|
||||||
|
(** [level_above ~min_level lvl] is true if messages at level [lvl] should be
|
||||||
|
logged.
|
||||||
|
@since NEXT_RELEASE *)
|
||||||
|
|
||||||
val log : level -> (unit -> string) -> unit
|
val log : level -> (unit -> string) -> unit
|
||||||
(** [log level mk_msg] emits a diagnostic message if the current logger is
|
(** [log level mk_msg] emits a diagnostic message if the current logger is
|
||||||
active. [mk_msg] is called lazily — only if the message will be emitted. *)
|
active. [mk_msg] is called lazily — only if the message will be emitted. *)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
open Common_
|
open Common_
|
||||||
|
|
||||||
module Extensions = struct
|
module Extensions = struct
|
||||||
|
(* extend [Trace]'s types with OTEL specific variants, eg to have a
|
||||||
|
[Trace.span] be a wrapper around [OTEL.Span.t], or to declare custom actions
|
||||||
|
to link spans together, or to be able to use [OTEL]-specific metrics types *)
|
||||||
type Trace.span += Span_otel of OTEL.Span.t
|
type Trace.span += Span_otel of OTEL.Span.t
|
||||||
|
|
||||||
type Trace.extension_event +=
|
type Trace.extension_event +=
|
||||||
|
|
@ -21,6 +24,14 @@ end
|
||||||
|
|
||||||
open Extensions
|
open Extensions
|
||||||
|
|
||||||
|
(* Inject ambient span into [Trace], relying on the [Ambient_context]
|
||||||
|
library. We use the generic ambient context to carry a [Hmap.t] around with
|
||||||
|
possible the current [Trace.span], and it is also used by [OTEL] itself
|
||||||
|
(ambient [OTEL.Span_ctx.t]).
|
||||||
|
|
||||||
|
This mechanism is used by [Trace] so that nested [Trace.with_span] can infer
|
||||||
|
the correct parent-child relation from implicit context, and produce OTEL
|
||||||
|
spans accordingly; without it every span would be parentless. *)
|
||||||
module Ambient_span_provider_ = struct
|
module Ambient_span_provider_ = struct
|
||||||
let get_current_span () =
|
let get_current_span () =
|
||||||
match OTEL.Ambient_span.get () with
|
match OTEL.Ambient_span.get () with
|
||||||
|
|
|
||||||
|
|
@ -72,13 +72,13 @@ val link_spans : Otrace.span -> Otrace.span -> unit
|
||||||
val link_span_to_otel_ctx : Otrace.span -> OTEL.Span_ctx.t -> unit
|
val link_span_to_otel_ctx : Otrace.span -> OTEL.Span_ctx.t -> unit
|
||||||
(** [link_spans sp1 sp_ctx2] modifies [sp1] by adding a span link to [sp_ctx2].
|
(** [link_spans sp1 sp_ctx2] modifies [sp1] by adding a span link to [sp_ctx2].
|
||||||
It must be the case that [sp1] is a currently active span.
|
It must be the case that [sp1] is a currently active span.
|
||||||
@since NEXT_RELEASE *)
|
@since 0.90 *)
|
||||||
|
|
||||||
val set_span_kind : Otrace.span -> OTEL.Span.kind -> unit
|
val set_span_kind : Otrace.span -> OTEL.Span.kind -> unit
|
||||||
(** [set_span_kind sp k] sets the span's kind. *)
|
(** [set_span_kind sp k] sets the span's kind. *)
|
||||||
|
|
||||||
val set_span_status : Otrace.span -> OTEL.Span_status.t -> unit
|
val set_span_status : Otrace.span -> OTEL.Span_status.t -> unit
|
||||||
(** @since NEXT_RELEASE *)
|
(** @since 0.90 *)
|
||||||
|
|
||||||
val record_exception : Otrace.span -> exn -> Printexc.raw_backtrace -> unit
|
val record_exception : Otrace.span -> exn -> Printexc.raw_backtrace -> unit
|
||||||
(** Record exception in the current span. *)
|
(** Record exception in the current span. *)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
(tests
|
(tests
|
||||||
(names test_client_lib)
|
(names test_client_lib)
|
||||||
(package opentelemetry)
|
(package opentelemetry-client)
|
||||||
(libraries alcotest opentelemetry-client))
|
(libraries alcotest opentelemetry-client))
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
(tests
|
(tests
|
||||||
(names test_trace_context t_size t_histogram test_span_dummy)
|
(names test_trace_context t_size t_histogram test_span_dummy)
|
||||||
(package opentelemetry)
|
(package opentelemetry)
|
||||||
(libraries pbrt opentelemetry opentelemetry-client))
|
(libraries pbrt opentelemetry))
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,11 @@ let test_exporter : Otel.Exporter.t =
|
||||||
let with_test_exporter f =
|
let with_test_exporter f =
|
||||||
(* uncomment for eprintf debugging: *)
|
(* uncomment for eprintf debugging: *)
|
||||||
(* let test_exporter = Opentelemetry_client.Exporter_debug.debug test_exporter in*)
|
(* let test_exporter = Opentelemetry_client.Exporter_debug.debug test_exporter in*)
|
||||||
Otel.Sdk.set test_exporter;
|
Otel.Sdk.set
|
||||||
|
~traces:(Otel.Provider_config.make ())
|
||||||
|
~metrics:(Otel.Provider_config.make ())
|
||||||
|
~logs:(Otel.Provider_config.make ())
|
||||||
|
test_exporter;
|
||||||
Fun.protect f ~finally:(fun () ->
|
Fun.protect f ~finally:(fun () ->
|
||||||
let sq = Opentelemetry_client_sync.Sync_queue.create () in
|
let sq = Opentelemetry_client_sync.Sync_queue.create () in
|
||||||
Otel.Sdk.remove
|
Otel.Sdk.remove
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue