aya-log: use RingBuf, remove tokio dep#1288
Conversation
✅ Deploy Preview for aya-rs-docs ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
4576d10 to
88d9b5a
Compare
5bb0f0d to
4fd26ce
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR removes the EbpfLogger type and the built-in Tokio dependency, requiring callers to supply their own executor and choose an async runtime via features.
- Replace deprecated logger struct/aliases with
initfunctions returning futures - Update integration test to drive the returned future and remove internal executor
- Add
async_std/async_tokiofeature flags and gate CI/clippy builds accordingly
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| xtask/public-api/aya-log.txt | Removed EbpfLogger entries; added init* function signatures |
| test/integration-test/src/tests/log.rs | Switched from EbpfLogger to init_with_logger future polling |
| test/integration-test/Cargo.toml | Enabled async_tokio feature for aya-log |
| clippy.sh | Added --at-least-one-of aya-log/async_std,aya-log/async_tokio |
| aya-log/src/lib.rs | Replaced EbpfLogger impl with init functions returning futures |
| aya-log/README.md | Updated example to show returned future and spawn on Tokio |
| aya-log/Cargo.toml | Disabled default features; defined async_std/async_tokio flags |
| .github/workflows/ci.yml | Added feature gating for async runtimes in CI |
Comments suppressed due to low confidence (2)
aya-log/README.md:39
- [nitpick] We should document that users must enable one of the async runtime features (
async_tokioorasync_std) in theirCargo.tomlto use these methods. For example:
aya-log = { version = "0.2.1", features = ["async_tokio"] }let fut = aya_log::init(&mut bpf).unwrap();
test/integration-test/src/tests/log.rs:38
- [nitpick] The existing integration test exercises only
init_with_logger. Consider adding tests for the defaultinitandinit_from_idAPIs to ensure those code paths are covered.
async fn log() {
f4299ec to
ddc23f2
Compare
2b2f906 to
d38c294
Compare
c4bdf80 to
061b4b0
Compare
|
Hey @alessandrod, this pull request changes the Aya Public API and requires your review. |
vadorovsky
left a comment
There was a problem hiding this comment.
Great stuff, thanks for working on that!
Apart from the comment, I'm seeing these dead code warnings when running tests on your branch:
cargo:warning=warning: struct `RecordFieldWrapper` is never constructedg, cargo_metadata, aya, toml_edit
cargo:warning= --> aya-log/src/lib.rs:81:8
cargo:warning= |
cargo:warning=81 | struct RecordFieldWrapper(RecordField);
cargo:warning= | ^^^^^^^^^^^^^^^^^^
cargo:warning= |
cargo:warning= = note: `#[warn(dead_code)]` on by default
cargo:warning=
cargo:warning=
cargo:warning=warning: struct `ArgumentWrapper` is never constructed
cargo:warning= --> aya-log/src/lib.rs:84:8
cargo:warning= |
cargo:warning=84 | struct ArgumentWrapper(Argument);
cargo:warning= | ^^^^^^^^^^^^^^^
cargo:warning=
cargo:warning=
Reviewed 9 of 9 files at r3, 1 of 1 files at r4, 1 of 1 files at r5, 3 of 3 files at r6, 8 of 8 files at r7, 2 of 2 files at r8, 10 of 10 files at r9, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @alessandrod, @dave-tucker, @miniduikboot, and @tamird)
aya-log/CHANGELOG.md line 12 at r7 (raw file):
### Breaking Changes - The implementation is now backed by a ring buffer rather than a perf event. This should improve
"rather than a perf event array"
aya-log-ebpf-macros/src/expand.rs line 86 at r6 (raw file):
Some(l) => l, None => { let l = level_expr.ok_or(Error::new(
Hmm... this is a good cleanup, but seems unrelated to macro_support. Perhaps a separate commit?
Move top level items into and remove unused items from `macro_support`.
This doesn't get us to zero copy because the reserve/submit APIs do not support DSTs for reasons I don't remember. Now that it is unused in userspace, move `LOG_BUF_CAPACITY` to `aya-log-ebpf` by making its type `LogValueLength` which obviates the need for `log_value_length_sufficient`.
This bound is needed for e.g. `smol::Async`.
tamird
left a comment
There was a problem hiding this comment.
Ah, this was rust-lang/rust#120770 which was fixed in rust-lang/rust#142485. It doesn't show up in our CI because we lint with nightly, rather than stable.
I removed the allowance in 30d5c9f. Should I bring it back?
Reviewable status: 2 of 17 files reviewed, 3 unresolved discussions (waiting on @alessandrod, @dave-tucker, @miniduikboot, and @vadorovsky)
aya-log/CHANGELOG.md line 12 at r7 (raw file):
Previously, vadorovsky (Michal Rostecki) wrote…
"rather than a perf event array"
Done.
aya-log-ebpf-macros/src/expand.rs line 86 at r6 (raw file):
Previously, vadorovsky (Michal Rostecki) wrote…
Hmm... this is a good cleanup, but seems unrelated to
macro_support. Perhaps a separate commit?
Done.
No need, thanks for explanation. |
Require the caller to provide their own executor.
Require the caller to provide their own executor.
This change is