Commit graph

500 commits

Author SHA1 Message Date
Shon Feder
d3235a1864
Remove unneeded encoder reset
We reset the encoder if we are reusing one, and we generate a fresh new
one otherwise.
2025-07-08 21:28:55 -04:00
Simon Cruanes
841d223ed2
Merge pull request #97 from shonfeder/factor-out-lwt-batching
Factor batching logic out of the cohttp-lwt client
2025-07-01 14:33:37 -04:00
Shon Feder
8b48843459
Correct size and optimize representation
Since we need to traverse the elements added to count up the new size,
we can use that pass to add the elements onto our FIFO queue, and then
drain the queue in one last pass to reverse. IIUC, this should give us
liner complexity of the batch retrieval.
2025-06-30 22:52:49 -04:00
Shon Feder
31a712dd30
Allowing configuring start time 2025-06-30 22:28:30 -04:00
Shon Feder
18f58c3ac5
Allow configuring high_watermark 2025-06-30 22:01:13 -04:00
Shon Feder
ca31707395
Factor batching logic out of the cohttp-lwt client
This will allow resuing the batching logic in the Eio client.
As a followup, we should refactor the ocurl client to use the same
batcher.
2025-06-27 21:48:55 -04:00
Simon Cruanes
4ee29d8504 feat: add Globals.service_version 2025-06-23 09:32:59 -04:00
Simon Cruanes
f8d4ac7c3c
fix: make sure we clear out the encoder when reusing it 2025-06-23 09:32:33 -04:00
Simon Cruanes
62085e87cb
Merge pull request #95 from shonfeder/signal-encoding-refactor
Factor out the logic around signal encoding
2025-06-23 09:26:06 -04:00
Shon Feder
8f7d74f591
Allow optional reuse of encoder state
This allows clien implementors to micromanage the state of the protobuf
`encoder` if they want, or to just let the library handle allocation and
garbage collection of encoder states when that level of resource
managment is not required.
2025-06-20 16:19:55 -04:00
Shon Feder
740a142581
Use application operator 2025-06-18 18:36:16 -04:00
Shon Feder
cad4835449
Fix type aliases 2025-06-18 18:35:37 -04:00
Shon Feder
a5617571f4
Add comment about scope 2025-06-18 18:33:46 -04:00
Shon Feder
b303fb5b1c
Use dummies 2025-06-18 18:31:39 -04:00
Shon Feder
52377b0a03
Factor out signal encoding logic 2025-06-16 23:34:45 -04:00
Shon Feder
0045a97e34
Move Self_trace module into Opentelemetry_client 2025-06-15 22:22:44 -04:00
Shon Feder
5c0691439e
Remove unneeded indirection
The `tick_common` function is only used once.
Removing the indirection also lets us see that we were calling
`sample_gc_metrics_if_needed` twice in a row on each tick.
2025-06-15 19:31:02 -04:00
Simon Cruanes
dd66852113
Merge pull request #92 from shonfeder/config-refactor
Refactor client configuration
2025-06-11 14:37:17 -04:00
Shon Feder
08c6f32efe
Fix documentation example 2025-06-11 14:23:06 -04:00
Simon Cruanes
48926c25e5
Update src/client/config.mli
Co-authored-by: Corentin Leruth <corentin.leruth@gmail.com>
2025-06-11 09:20:22 -04:00
Shon Feder
0b2faca469
Add tests for Opentelemetry.Client.Config 2025-06-11 00:10:28 -04:00
Shon Feder
8511f547d7
Fix name of library
Matches the convention in /src/trace/dune and prevents dependency on
the library from polluting the global namespace of a component with the
generic `Client` module.
2025-06-10 18:11:30 -04:00
Shon Feder
90fa0ba3b7
Add pp implemtation for Client_ocurl.Config 2025-06-10 18:00:04 -04:00
Shon Feder
ec0efec681
Rename Env sig to ENV 2025-06-10 17:47:56 -04:00
Shon Feder
75a8b95176
Move Client.Config into its own file 2025-06-10 17:45:34 -04:00
Shon Feder
d62f680fc3
Refactor client configuration
Enabling sharing all common configuration logic
2025-06-10 00:40:13 -04:00
Simon Cruanes
8779823fda
Merge pull request #91 from shonfeder/fix-build-warnings
Fix a few build warnings
2025-06-09 09:04:52 -04:00
Shon Feder
fb4795a44c
Fix an unused value warning
Fixes

```
File "src/ambient-context/eio/opentelemetry_ambient_context_eio.ml", line 1, characters 0-33:
1 | module TLS = Thread_local_storage
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Warning 60 [unused-module]: unused module TLS.
```
2025-06-07 11:28:52 -04:00
Shon Feder
e66476015b
Move deprecation alerts to valid location
As discussed in https://github.com/ocaml/ocaml/issues/14078,
alerts (with deprecation alerts as a special case) are not currently
supported as item-attributes on let-bindings. This usage produces
`misplaced-attribute` warnings, such as

```
Warning 53 [misplaced-attribute]: the "deprecated" attribute cannot appear in this context
File "src/core/opentelemetry.ml", line 1229, characters 37-47:
1229 |   let add_event = Scope.add_event [@@deprecated "use Scope.add_event"]
                                            ^^^^^^^^^^
Warning 53 [misplaced-attribute]: the "deprecated" attribute cannot appear in this context

File "src/core/opentelemetry.ml", line 1231, characters 37-47:
1231 |   let add_attrs = Scope.add_attrs [@@deprecated "use Scope.add_attrs"]
                                            ^^^^^^^^^^
Warning 53 [misplaced-attribute]: the "deprecated" attribute cannot appear in this context
```

Fortunately, we can still add deprecation alerts to these value by
moving the alert to the pattern, as done here.
2025-06-07 10:56:56 -04:00
Simon Cruanes
885d0b6a75
CI 2025-05-27 09:45:29 -04:00
Simon Cruanes
4bb9de1e1d
Merge pull request #89 from shonfeder/update-cohttp
Update to support cohttp 6
2025-05-27 09:44:34 -04:00
Shon Feder
894158339e
Update to support cohttp 6
Preparation for Cohttp 6 started in
2022 (https://github.com/mirage/ocaml-cohttp/blob/main/CHANGES.md#v600alpha0-2022-10-24)
and 6 has been stable and released since Nov of 2024.
See https://github.com/mirage/ocaml-cohttp/blob/main/CHANGES.md#v600-2024-11-21

Removal of the `open Cohttp_lwt` solves deprecation warnings issued by
Cohttp 6, since everything we were using from the open has been moved
into `Cohttp`.
2025-05-25 21:51:49 -04:00
Simon Cruanes
92de45a2ec
Merge pull request #86 from imandra-ai/simon/cps-based-collector-cleanup-2025-04-17
CPS-based collector for cleanup
2025-05-05 14:41:47 -04:00
Simon Cruanes
51af3a4105
format 2025-05-05 14:41:20 -04:00
Simon Cruanes
26691eca20
remove obsolete comment 2025-05-05 14:36:31 -04:00
Simon Cruanes
5788492946
breaking: change Collector.cleanup so it takes a callback
this callback can be used to resolve a Lwt future, for example, to make
sure we indeed wait for the cleanup to be done before exiting.
2025-04-17 16:09:14 -04:00
Simon Cruanes
6a378e49ce
format 2025-04-17 14:59:28 -04:00
Simon Cruanes
7860e949d0
CI 2025-04-17 10:15:08 -04:00
Simon Cruanes
9b5f3cd0c3
feat: adapt to trace 0.10 2025-04-17 10:04:16 -04:00
Simon Cruanes
45fae39c29
chore: bump ocamlforamt to 0.27 2025-04-17 10:03:26 -04:00
Simon Cruanes
28b78cd741
readme 2025-04-10 15:36:06 -04:00
Simon Cruanes
34a4a87fc3
perf: details 2025-04-09 10:00:50 -04:00
Simon Cruanes
c313731a70
prepare for 0.11.2 2025-03-27 09:29:36 -04:00
Antonin Décimo
b2e62d527e fix: opentelemetry-client-ocurl: don't block signals on Windows
As of OCaml 5.3, the OCaml runtime doesn't support signals on
Windows. Trying to block them with Thread.sigmask will raise:

    Thread 5 killed on uncaught exception Invalid_argument("Thread.sigmask not implemented")
    Raised by primitive operation at Opentelemetry_client_ocurl.start_bg_thread.run in file "src/client-ocurl/opentelemetry_client_ocurl.ml", line 106, characters 12-49
2025-03-27 09:28:48 -04:00
Simon Cruanes
1f4bdfa1f5
gitignore 2025-03-19 21:05:13 -04:00
Simon Cruanes
21de8b1f4b
forgot to update tags 2025-03-19 09:06:57 -04:00
Simon Cruanes
3d3cf8c02c
fix otel-client-ocurl: use ptime timestamps for self metrics 2025-03-14 10:00:54 -04:00
Simon Cruanes
d8be02c829
prepare for 0.11.1 2025-03-14 09:21:43 -04:00
Corentin Leruth
7ef6677dff add missing sample argument to Traceparent.to_value 2025-03-03 09:32:01 -05:00
Simon Cruanes
c3c5761b06
prepare for 0.11 2025-01-31 17:37:32 -05:00