# apm-agent-ocaml
**Repository Path**: mirrors_elastic/apm-agent-ocaml
## Basic Information
- **Project Name**: apm-agent-ocaml
- **Description**: Elastic OCaml APM provides an OCaml library for uploading traces, transactions and errors to Elastic APM.
- **Primary Language**: Unknown
- **License**: Apache-2.0
- **Default Branch**: main
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-12-17
- **Last Updated**: 2025-08-16
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# OCaml agent for Elastic APM
## Dev setup
Clone
```bash
git clone git@github.com:elastic/apm-agent-ocaml.git
cd apm-agent-ocaml
```
Setup OCaml environment
```bash
opam switch create . 4.13.1
opam install ocamlformat ocamlformat-rpc ocaml-lsp-server
```
You can run a build in watch mode so new changes are automatically detected and
rebuilt. In a terminal, in or outside of your editor:
```bash
dune build -w
```
Tests can also be run in watch mode with expectation tests automatically
capturing changes in output! This gives an almost magical experience where test
results update as new tests are written _and_ as the library itself evolves.
```bash
dune test -w --auto-promote
```
If you don't have it installed already, watch mode needs `fswatch` which can be
installed via `brew` on macOS:
```bash
brew install fswatch
```
If you're using vscode, install the OCaml Platform plugin by OCaml Labs. The
OCaml plugin should automatically detect the local opam switch you just created.
If you setup format on save in the editor it will automatically format new
changes via the LSP server to conform to the project's standard formatting.
You should now be ready to work on the OCaml Elastic APM agent!
### Running the examples locally
* Install docker + docker compose
* `docker compose build ocaml-base`
* `docker compose build`
* `docker compose up -d`
Once docker compose up finishes the following endpoints will be available:
* http://localhost:5601 -> Kibana
* http://localhost:4000 -> [OCaml hello-world example](./example/1-hello-opium)
* http://localhost:4001 -> [OCaml example that talks to a python service](./example/3-polyglot-services/ocaml)
* http://localhost:5000 -> [Python flask application](./example/3-polyglot-services/python)
* http://localhost:4003 -> [OCaml example that talks to postgres](./example/2-database-ocaml)