Add an experimental `--experimental-otel` flag (CODSPEED_EXPERIMENTAL_OTEL).
When set, each run part starts an OTLP/HTTP receiver on a free localhost
port and passes its URL to the benchmark in CODSPEED_OTEL_ENDPOINT.
The receiver accepts protobuf and JSON exports of traces, logs and
metrics, plain or gzipped. While the benchmark runs, it only writes each
request body to disk as received, so it adds no compression work next to
the measured process. Once the process exits, the requests are
decompressed and packed into a single `otel.tar.zst` in the profile
folder, uploaded with the other results. Compressing all requests as one
stream with long-distance matching takes advantage of the content that
repeats across export batches.
Refs COD-3863
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add an experimental
--experimental-otelflag (CODSPEED_EXPERIMENTAL_OTEL) that collects the OpenTelemetry data the benchmarks export, and uploads it with the results.When the flag is set, each run part starts an OTLP/HTTP receiver on a free localhost port and passes its URL to the benchmark in
CODSPEED_OTEL_ENDPOINT. The receiver accepts protobuf and JSON exports of traces, logs and metrics, plain or gzipped, on/v1/{traces,logs,metrics}.While the benchmark runs, the receiver only writes each request body to disk as received, so it adds no compression work next to the measured process. A request is stored before it is acknowledged, so everything the process sent before exiting is kept. Once the process exits, the requests are decompressed and packed into a single
otel.tar.zstin the profile folder. Compressing them as one stream with long-distance matching takes advantage of the content that repeats across export batches. Nothing is written when the benchmark exports nothing.To put the spans and logs on the same clock as the benchmark markers, instrument-hooks is bumped for
instrument_hooks_monotonic_offset: integrations timestamp with the monotonic clock shifted to read as wall clock, and record the offset in thecodspeed.clock.monotonic_offset_nsresource attribute. The bindings expose it asInstrumentHooks::monotonic_offsetandMONOTONIC_OFFSET_ATTRIBUTE.tests/otel.rsruns the divanotel_exampleend to end throughcodspeed run --experimental-otelin walltime mode, and checks that every span and log record, shifted back by its resource's offset, falls within the benchmark markers. It needs a codspeed-rust checkout next to this repository, so it is ignored by default:cargo test --test otel -- --ignored. SetCODSPEED_OTEL_TEST_PROFILE_FOLDERto keep the profile folder for inspection.Stacked on #587.
Closes COD-3863