Skip to content

aya-log: use RingBuf, remove tokio dep#1288

Merged
tamird merged 8 commits intoaya-rs:mainfrom
tamird:log-no-executor
Jul 8, 2025
Merged

aya-log: use RingBuf, remove tokio dep#1288
tamird merged 8 commits intoaya-rs:mainfrom
tamird:log-no-executor

Conversation

@tamird
Copy link
Copy Markdown
Member

@tamird tamird commented Jul 5, 2025

Require the caller to provide their own executor.


This change is Reviewable

@netlify
Copy link
Copy Markdown

netlify Bot commented Jul 5, 2025

Deploy Preview for aya-rs-docs ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 61376c4
🔍 Latest deploy log https://app.netlify.com/projects/aya-rs-docs/deploys/686cee061bbbb10008b7930c
😎 Deploy Preview https://deploy-preview-1288--aya-rs-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@mergify mergify Bot added aya-log Relating to aya-log test A PR that improves test cases or CI labels Jul 5, 2025
@tamird tamird force-pushed the log-no-executor branch 2 times, most recently from 4576d10 to 88d9b5a Compare July 5, 2025 18:45
@tamird tamird force-pushed the log-no-executor branch 4 times, most recently from 5bb0f0d to 4fd26ce Compare July 5, 2025 19:39
@tamird tamird marked this pull request as ready for review July 5, 2025 20:41
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 init functions returning futures
  • Update integration test to drive the returned future and remove internal executor
  • Add async_std/async_tokio feature 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_tokio or async_std) in their Cargo.toml to 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 default init and init_from_id APIs to ensure those code paths are covered.
async fn log() {

Comment thread test/integration-test/src/tests/log.rs Outdated
@tamird tamird force-pushed the log-no-executor branch 2 times, most recently from f4299ec to ddc23f2 Compare July 6, 2025 10:23
Comment thread aya-log/Cargo.toml Outdated
@tamird tamird force-pushed the log-no-executor branch from be72719 to 762a07b Compare July 6, 2025 20:51
@tamird tamird changed the title aya-log: Remove EbpfLogger, tokio dep aya-log: Remove EbpfLogger, back with RingBuf Jul 6, 2025
@tamird tamird force-pushed the log-no-executor branch 2 times, most recently from 2b2f906 to d38c294 Compare July 6, 2025 22:20
@tamird tamird changed the title aya-log: Remove EbpfLogger, back with RingBuf aya-log: use RingBuf, remove tokio dep Jul 6, 2025
@tamird tamird force-pushed the log-no-executor branch 7 times, most recently from c4bdf80 to 061b4b0 Compare July 6, 2025 22:58
@tamird tamird force-pushed the log-no-executor branch from 061b4b0 to 00028ac Compare July 7, 2025 00:48
@mergify
Copy link
Copy Markdown

mergify Bot commented Jul 7, 2025

Hey @alessandrod, this pull request changes the Aya Public API and requires your review.

@mergify mergify Bot added api/needs-review Makes an API change that needs review aya This is about aya (userspace) labels Jul 7, 2025
@tamird tamird force-pushed the log-no-executor branch from 00028ac to 36fd791 Compare July 7, 2025 10:43
Copy link
Copy Markdown
Member

@vadorovsky vadorovsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

tamird added 7 commits July 7, 2025 09:31
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 tamird force-pushed the log-no-executor branch from 36fd791 to 43e471d Compare July 7, 2025 13:33
@tamird tamird requested a review from vadorovsky July 7, 2025 13:42
Copy link
Copy Markdown
Member Author

@tamird tamird left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@tamird tamird enabled auto-merge (rebase) July 7, 2025 13:49
@vadorovsky
Copy link
Copy Markdown
Member

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?

No need, thanks for explanation.

@tamird tamird disabled auto-merge July 7, 2025 17:43
Comment thread aya-log/README.md
Require the caller to provide their own executor.
@tamird tamird force-pushed the log-no-executor branch from 43e471d to 61376c4 Compare July 8, 2025 10:08
@tamird tamird merged commit 61376c4 into aya-rs:main Jul 8, 2025
28 of 30 checks passed
@tamird tamird deleted the log-no-executor branch July 8, 2025 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api/needs-review Makes an API change that needs review aya This is about aya (userspace) aya-log Relating to aya-log test A PR that improves test cases or CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants