mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-05-06 01:15:11 -04:00
Compare commits
17 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5065cdd985 | ||
|
|
0cf72525b2 | ||
|
|
3bf18fed69 | ||
|
|
a4d95409ee | ||
|
|
59e2e854e5 | ||
|
|
5f3b162290 | ||
|
|
2401745f1a | ||
|
|
fd47118c51 | ||
|
|
9cb9c1081c | ||
|
|
7a93a2582b | ||
|
|
e9bb76edd1 | ||
|
|
b766f86019 | ||
|
|
78e44e916c | ||
|
|
755509893e | ||
|
|
5031be8d91 | ||
|
|
8ebc582a00 | ||
|
|
7691512ace |
34 changed files with 250 additions and 116 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
|
||||||
|
|
|
||||||
10
CHANGES.md
10
CHANGES.md
|
|
@ -1,4 +1,14 @@
|
||||||
|
|
||||||
|
## 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
|
## 0.90
|
||||||
|
|
||||||
- major refactor: split library into `opentelemetry.core`, `opentelemetry`,
|
- major refactor: split library into `opentelemetry.core`, `opentelemetry`,
|
||||||
|
|
|
||||||
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)..."
|
||||||
|
|
|
||||||
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
|
||||||
18
dune-project
18
dune-project
|
|
@ -7,7 +7,7 @@
|
||||||
(source
|
(source
|
||||||
(github ocaml-tracing/ocaml-opentelemetry))
|
(github ocaml-tracing/ocaml-opentelemetry))
|
||||||
|
|
||||||
(version 0.90)
|
(version 0.91)
|
||||||
|
|
||||||
(implicit_transitive_deps false)
|
(implicit_transitive_deps false)
|
||||||
|
|
||||||
|
|
@ -31,10 +31,6 @@
|
||||||
hmap
|
hmap
|
||||||
(odoc :with-doc)
|
(odoc :with-doc)
|
||||||
(alcotest :with-test)
|
(alcotest :with-test)
|
||||||
(opentelemetry-client
|
|
||||||
(and
|
|
||||||
:with-test
|
|
||||||
(= :version)))
|
|
||||||
(pbrt
|
(pbrt
|
||||||
(and
|
(and
|
||||||
(>= 4.0)
|
(>= 4.0)
|
||||||
|
|
@ -98,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
|
||||||
|
|
@ -110,7 +106,7 @@
|
||||||
(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)
|
(cohttp-lwt-unix :with-test)
|
||||||
(containers :with-test)
|
(containers :with-test)
|
||||||
|
|
@ -121,7 +117,7 @@
|
||||||
(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
|
||||||
|
|
@ -209,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
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# 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.90"
|
version: "0.91"
|
||||||
synopsis: "Collector client for opentelemetry, using cohttp + eio"
|
synopsis: "Collector client for opentelemetry, using cohttp + eio"
|
||||||
maintainer: ["ocaml-tracing"]
|
maintainer: ["ocaml-tracing"]
|
||||||
authors: ["ocaml-tracing" "ELLIOTTCABLE <opam@ell.io>" "the imandra team"]
|
authors: ["ocaml-tracing" "ELLIOTTCABLE <opam@ell.io>" "the imandra team"]
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# 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.90"
|
version: "0.91"
|
||||||
synopsis: "Collector client for opentelemetry, using cohttp + lwt"
|
synopsis: "Collector client for opentelemetry, using cohttp + lwt"
|
||||||
maintainer: ["ocaml-tracing"]
|
maintainer: ["ocaml-tracing"]
|
||||||
authors: ["ocaml-tracing" "ELLIOTTCABLE <opam@ell.io>" "the imandra team"]
|
authors: ["ocaml-tracing" "ELLIOTTCABLE <opam@ell.io>" "the imandra team"]
|
||||||
|
|
@ -22,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}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# 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.90"
|
version: "0.91"
|
||||||
synopsis: "Collector client for opentelemetry, using ezcurl-lwt"
|
synopsis: "Collector client for opentelemetry, using ezcurl-lwt"
|
||||||
maintainer: ["ocaml-tracing"]
|
maintainer: ["ocaml-tracing"]
|
||||||
authors: ["ocaml-tracing" "ELLIOTTCABLE <opam@ell.io>" "the imandra team"]
|
authors: ["ocaml-tracing" "ELLIOTTCABLE <opam@ell.io>" "the imandra team"]
|
||||||
|
|
@ -9,7 +9,7 @@ homepage: "https://github.com/ocaml-tracing/ocaml-opentelemetry"
|
||||||
bug-reports: "https://github.com/ocaml-tracing/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}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# 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.90"
|
version: "0.91"
|
||||||
synopsis: "Collector client for opentelemetry, using http + ezcurl"
|
synopsis: "Collector client for opentelemetry, using http + ezcurl"
|
||||||
maintainer: ["ocaml-tracing"]
|
maintainer: ["ocaml-tracing"]
|
||||||
authors: ["ocaml-tracing" "ELLIOTTCABLE <opam@ell.io>" "the imandra team"]
|
authors: ["ocaml-tracing" "ELLIOTTCABLE <opam@ell.io>" "the imandra team"]
|
||||||
|
|
@ -9,13 +9,13 @@ homepage: "https://github.com/ocaml-tracing/ocaml-opentelemetry"
|
||||||
bug-reports: "https://github.com/ocaml-tracing/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}
|
"cohttp-lwt-unix" {with-test}
|
||||||
"containers" {with-test}
|
"containers" {with-test}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# 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.90"
|
version: "0.91"
|
||||||
synopsis: "Client SDK for https://opentelemetry.io"
|
synopsis: "Client SDK for https://opentelemetry.io"
|
||||||
maintainer: ["ocaml-tracing"]
|
maintainer: ["ocaml-tracing"]
|
||||||
authors: ["ocaml-tracing" "ELLIOTTCABLE <opam@ell.io>" "the imandra team"]
|
authors: ["ocaml-tracing" "ELLIOTTCABLE <opam@ell.io>" "the imandra team"]
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# 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.90"
|
version: "0.91"
|
||||||
synopsis: "Opentelemetry tracing for Cohttp HTTP servers"
|
synopsis: "Opentelemetry tracing for Cohttp HTTP servers"
|
||||||
maintainer: ["ocaml-tracing"]
|
maintainer: ["ocaml-tracing"]
|
||||||
authors: ["ocaml-tracing" "ELLIOTTCABLE <opam@ell.io>" "the imandra team"]
|
authors: ["ocaml-tracing" "ELLIOTTCABLE <opam@ell.io>" "the imandra team"]
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# 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.90"
|
version: "0.91"
|
||||||
synopsis: "Opentelemetry-based reporter for Logs"
|
synopsis: "Opentelemetry-based reporter for Logs"
|
||||||
maintainer: ["ocaml-tracing"]
|
maintainer: ["ocaml-tracing"]
|
||||||
authors: ["ocaml-tracing" "ELLIOTTCABLE <opam@ell.io>" "the imandra team"]
|
authors: ["ocaml-tracing" "ELLIOTTCABLE <opam@ell.io>" "the imandra team"]
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# 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.90"
|
version: "0.91"
|
||||||
synopsis: "Lwt-compatible instrumentation for https://opentelemetry.io"
|
synopsis: "Lwt-compatible instrumentation for https://opentelemetry.io"
|
||||||
maintainer: ["ocaml-tracing"]
|
maintainer: ["ocaml-tracing"]
|
||||||
authors: ["ocaml-tracing" "ELLIOTTCABLE <opam@ell.io>" "the imandra team"]
|
authors: ["ocaml-tracing" "ELLIOTTCABLE <opam@ell.io>" "the imandra team"]
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# 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.90"
|
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: ["ocaml-tracing"]
|
maintainer: ["ocaml-tracing"]
|
||||||
|
|
@ -16,7 +16,6 @@ depends: [
|
||||||
"hmap"
|
"hmap"
|
||||||
"odoc" {with-doc}
|
"odoc" {with-doc}
|
||||||
"alcotest" {with-test}
|
"alcotest" {with-test}
|
||||||
"opentelemetry-client" {with-test & = version}
|
|
||||||
"pbrt" {>= "4.0" & < "5.0"}
|
"pbrt" {>= "4.0" & < "5.0"}
|
||||||
"pbrt_yojson" {>= "4.0" & < "5.0"}
|
"pbrt_yojson" {>= "4.0" & < "5.0"}
|
||||||
"ambient-context" {>= "0.2"}
|
"ambient-context" {>= "0.2"}
|
||||||
|
|
|
||||||
|
|
@ -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 ()
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
|
||||||
|
|
@ -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 =
|
||||||
|
|
|
||||||
|
|
@ -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 ]
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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