Xuanwo opened a new pull request, #8975:
URL: https://github.com/apache/opendal/pull/8975
# Which issue does this PR close?
None.
# Rationale for this change
Several tracing and profiling layers had broken or missing instrumentation
for stateful `oio::Copy` and `oio::Compose` bodies, and `DtraceLayer`'s writer
probes diverged from its documented probe ABI:
- `TracingLayer` and `OtelTraceLayer` entered/attached the `"copy"` span
only around synchronous `Service::copy` handle creation and returned an
unwrapped `oio::Copier`, causing the `"copy"` span to close immediately before
any `Copier::next`, `close`, or `abort` I/O executed.
- `TracingLayer`, `OtelTraceLayer`, `FastraceLayer`, `AsyncBacktraceLayer`,
and `HotpathLayer` passed `Service::compose` through without wrapping
`oio::Composer`, and `AsyncBacktraceLayer` also left `oio::Copier` unframed.
- `DtraceLayer` omitted the documented `length` argument on
`writer_write_ok` and still emitted obsolete
`writer_poll_abort_{start,ok,error}` probes instead of the documented
`writer_abort_{start,ok,error}` probes in `Writer::abort`.
# What changes are included in this PR?
- **`opendal-layer-tracing`**:
- Wrap `Service::copy` and `Service::compose` with `TracingWrapper`
(holding the span across `oio::Copy::{next,close,abort}` and
`oio::Compose::{compose,close}` while keeping the span entered during handle
creation).
- Add unit tests verifying `"copy"` and `"compose"` spans stay open and
remain active parents across all `Copier` and `Composer` methods.
- **`opendal-layer-oteltrace`**:
- Wrap `Service::copy` and `Service::compose` with `OtelTraceWrapper` so
the OpenTelemetry `"copy"` and `"compose"` spans stay active across `oio::Copy`
and `oio::Compose` execution; update rustdoc to reflect `copy` and `compose`
coverage.
- Add unit tests verifying events and child spans record under `"copy"`
and `"compose"` during `next`/`close`/`abort`/`compose`.
- **`opendal-layer-fastrace`**:
- Wrap `Service::compose` with `FastraceWrapper` implementing
`oio::Compose`; update rustdoc and add a unit test verifying child span
parentage.
- **`opendal-layer-async-backtrace`**:
- Wrap `Service::copy` and `Service::compose` with `AsyncBacktraceWrapper`
implementing framed `oio::Copy` and `oio::Compose`; add a unit test verifying
suspended backtrace frames.
- **`opendal-layer-hotpath`**:
- Wrap `Service::compose` with `HotpathWrapper` measuring
`opendal.composer.compose` and `opendal.composer.close`; add a unit test
verifying `Copier` and `Composer` forwarding.
- **`opendal-layer-dtrace`**:
- Capture buffer length in `Writer::write` and
`range.size().unwrap_or_default()` in `Writer::copy_from`, passing the
documented `length` argument to `writer_write_ok`.
- Rename `writer_poll_abort_{start,ok,error}` to
`writer_abort_{start,ok,error}` to match `DtraceLayer`'s documented probe ABI.
- Extend probe test capture to record probe arguments and add unit tests
verifying `writer_write_ok` length values and `writer_abort_*` probes.
# Are there any user-facing changes?
- `TracingLayer` and `OtelTraceLayer` now keep `"copy"` spans alive across
`Copier` I/O and emit `"compose"` spans across `Composer` I/O.
- `FastraceLayer`, `AsyncBacktraceLayer`, and `HotpathLayer` now instrument
`Composer` operations (and `AsyncBacktraceLayer` also frames `Copier`
operations).
- `DtraceLayer` now emits the documented `writer_write_ok(path, length)`
argument and `writer_abort_{start,ok,error}` probe names.
# Breaking changes
# AI Usage Statement
- Harness: pi
- Model: Gemini 4 Neon
- Effort: high
- Role: Verified the findings against `main`, implemented the
`Copier`/`Composer` wrapper and `DtraceLayer` probe fixes across all six layer
crates, added deterministic unit tests, and verified formatting, clippy, unit
tests, rustdoc, ELF USDT probe descriptors, and typos.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]