{"id":14109195,"url":"https://github.com/imandra-ai/ocaml-opentelemetry","last_synced_at":"2025-10-27T22:37:28.885Z","repository":{"id":39156505,"uuid":"470733451","full_name":"imandra-ai/ocaml-opentelemetry","owner":"imandra-ai","description":"Instrumentation for https://opentelemetry.io","archived":false,"fork":false,"pushed_at":"2025-09-15T13:13:16.000Z","size":10319,"stargazers_count":42,"open_issues_count":11,"forks_count":12,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-09-15T15:14:02.755Z","etag":null,"topics":["metrics","ocaml","opentelemetry","traces"],"latest_commit_sha":null,"homepage":"http://docs.imandra.ai/ocaml-opentelemetry/","language":"OCaml","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/imandra-ai.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-03-16T19:58:45.000Z","updated_at":"2025-09-15T13:13:21.000Z","dependencies_parsed_at":"2022-08-09T11:32:19.240Z","dependency_job_id":"f858554e-7742-45f9-a898-81d3e3c83182","html_url":"https://github.com/imandra-ai/ocaml-opentelemetry","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/imandra-ai/ocaml-opentelemetry","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imandra-ai%2Focaml-opentelemetry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imandra-ai%2Focaml-opentelemetry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imandra-ai%2Focaml-opentelemetry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imandra-ai%2Focaml-opentelemetry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imandra-ai","download_url":"https://codeload.github.com/imandra-ai/ocaml-opentelemetry/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imandra-ai%2Focaml-opentelemetry/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281355372,"owners_count":26486896,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-27T02:00:05.855Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["metrics","ocaml","opentelemetry","traces"],"created_at":"2024-08-14T10:02:08.647Z","updated_at":"2025-10-27T22:37:28.859Z","avatar_url":"https://github.com/imandra-ai.png","language":"OCaml","funding_links":[],"categories":["OCaml"],"sub_categories":[],"readme":"\n# Opentelemetry [![build](https://github.com/imandra-ai/ocaml-opentelemetry/actions/workflows/main.yml/badge.svg)](https://github.com/imandra-ai/ocaml-opentelemetry/actions/workflows/main.yml)\n\nThis project provides an API for instrumenting server software\nusing [opentelemetry](https://opentelemetry.io/docs), as well as\nconnectors to talk to opentelemetry software such as [jaeger](https://www.jaegertracing.io/).\n\n- library `opentelemetry` should be used to instrument your code\n  and possibly libraries. It doesn't communicate with anything except\n  a backend (default: dummy backend);\n- library `opentelemetry-client-ocurl` is a backend that communicates\n  via http+protobuf with some collector (otelcol, datadog-agent, etc.) using cURL bindings;\n- library `opentelemetry-client-cohttp-lwt` is a backend that communicates\n  via http+protobuf with some collector using cohttp.\n\n## License\n\nMIT\n\n## Features\n\n- [x] basic traces\n- [x] basic metrics\n- [x] basic logs\n- [ ] nice API\n- [x] interface with `lwt`\n- [x] sync collector relying on ocurl\n  * [x] batching, perf, etc.\n- [ ] async collector relying on ocurl-multi\n- [ ] interface with `logs` (carry context around)\n- [x] implicit scope (via vendored `ambient-context`, see `opentelemetry.ambient-context`)\n\n## Use\n\nFor now, instrument traces/spans, logs, and metrics manually:\n\n```ocaml\nmodule Otel = Opentelemetry\nlet (let@) = (@@)\n\nlet foo () =\n  let@ scope = Otel.Trace.with_  \"foo\"\n      ~attrs:[\"hello\", `String \"world\"] in\n  do_work();\n  Otel.Metrics.(\n    emit [\n      gauge ~name:\"foo.x\" [int 42];\n    ]);\n  do_more_work();\n  ()\n```\n\n### Setup\n\nIf you're writing a top-level application, you need to perform some initial configuration.\n\n1. Set the [`service_name`][];\n2. optionally configure [ambient-context][] with the appropriate storage for your environment — TLS, Lwt, Eio…;\n3. and install a [`Collector`][] (usually by calling your collector's `with_setup` function.)\n\nFor example, if your application is using Lwt, and you're using `ocurl` as your collector, you might do something like this:\n\n```ocaml\nlet main () =\n  Otel.Globals.service_name := \"my_service\";\n  Otel.GC_metrics.basic_setup();\n\n  Opentelemetry_ambient_context.set_storage_provider (Opentelemetry_ambient_context_lwt.storage ());\n  Opentelemetry_client_ocurl.with_setup () @@ fun () -\u003e\n  (* … *)\n  foo ();\n  (* … *)\n```\n\n  [`service_name`]: \u003chttps://v3.ocaml.org/p/opentelemetry/0.5/doc/Opentelemetry/Globals/index.html#val-service_name\u003e\n  [`Collector`]: \u003chttps://v3.ocaml.org/p/opentelemetry/0.5/doc/Opentelemetry/Collector/index.html\u003e\n  [ambient-context]: now vendored as `opentelemetry.ambient-context`, formerly \u003chttps://v3.ocaml.org/p/ambient-context\u003e\n\n## Configuration\n\nThe library is configurable via `Opentelemetry.Config`, via the standard\nopentelemetry env variables, or with some custom environment variables.\n\n- `OTEL_EXPORTER_OTLP_ENDPOINT` sets the http endpoint to send signals to\n- `OTEL_OCAML_DEBUG=1` to print some debug messages from the opentelemetry library ide\n- `OTEL_RESOURCE_ATTRIBUTES` sets a comma separated list of custom resource attributes\n\n## Collector opentelemetry-client-ocurl\n\nThis is a synchronous collector that uses the http+protobuf format\nto send signals (metrics, traces, logs) to some other collector (eg. `otelcol`\nor the datadog agent).\n\nDo note that this backend uses a thread pool and is incompatible\nwith uses of `fork` on some Unixy systems.\nSee [#68](https://github.com/imandra-ai/ocaml-opentelemetry/issues/68) for a possible workaround.\n\n## Collector opentelemetry-client-cohttp-lwt\n\nThis is a Lwt-friendly collector that uses cohttp to send\nsignals to some other collector (e.g. `otelcol`). It must be run\ninside a `Lwt_main.run` scope.\n\n## Opentelemetry-trace\n\nThe optional library `opentelemetry.trace`, present if [trace](https://github.com/c-cube/trace) is\ninstalled, provides a collector for `trace`. This collector forwards and translates\nevents from `trace` into `opentelemetry`. It's only useful if there also is also a OTEL collector.\n\n## License\n\nMIT\n\n## Semantic Conventions\n\nNot supported yet.\n\n- [ ] [metrics](https://opentelemetry.io/docs/reference/specification/metrics/semantic_conventions/)\n- [ ] [traces](https://opentelemetry.io/docs/reference/specification/trace/semantic_conventions/)\n- [ ] [resources](https://opentelemetry.io/docs/reference/specification/resource/semantic_conventions/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimandra-ai%2Focaml-opentelemetry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimandra-ai%2Focaml-opentelemetry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimandra-ai%2Focaml-opentelemetry/lists"}