Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aya-log: Add *max_level_* filter features #399

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vadorovsky
Copy link
Member

Add the following features for configuring the maximum log level available:

  • max_level_off
  • max_level_error
  • max_level_warn
  • max_level_info
  • max_level_debug
  • max_level_trace
  • release_max_level_off
  • release_max_level_error
  • release_max_level_warn
  • release_max_level_info
  • release_max_level_debug
  • release_max_level_trace

Log invocations at disabled level will be skipped, which is especially beneficial for eBPF programs which are not going to send unneceessary logs through perf buffers.

Features with release_ prefix are used only in release builds.

Those features have to applied on the userspace and eBPF crate separately. The correct thing to do is to set them on the same level. In case when userspace has higher maximum log level, it's not going to recieve the logs beyond the filter in eBPF crate. In the opposite situation, when eBPF crate has higher maximum level, it's going to waste cycles on sending logs through perf buffer, while they are not going to be displayed in the userspace.

Signed-off-by: Michal Rostecki vadorovsky@gmail.com

@netlify
Copy link

netlify bot commented Sep 30, 2022

Deploy Preview for aya-rs-docs ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 90faac2
🔍 Latest deploy log https://app.netlify.com/sites/aya-rs-docs/deploys/6336cc9f1aceb9000850ba4e
😎 Deploy Preview https://deploy-preview-399--aya-rs-docs.netlify.app/user/src/aya/obj/btf/types.rs
📱 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 site settings.

Add the following features for configuring the maximum log level
available:

* `max_level_off`
* `max_level_error`
* `max_level_warn`
* `max_level_info`
* `max_level_debug`
* `max_level_trace`
* `release_max_level_off`
* `release_max_level_error`
* `release_max_level_warn`
* `release_max_level_info`
* `release_max_level_debug`
* `release_max_level_trace`

Log invocations at disabled level will be skipped, which is especially
beneficial for eBPF programs which are not going to send unneceessary
logs through perf buffers.

Features with `release_` prefix are used only in release builds.

Those features have to applied on the userspace and eBPF crate
separately. The correct thing to do is to set them on the same level. In
case when userspace has higher maximum log level, it's not going to
recieve the logs beyond the filter in eBPF crate. In the opposite
situation, when eBPF crate has higher maximum level, it's going to waste
cycles on sending logs through perf buffer, while they are not going to
be displayed in the userspace.

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
} else if let Some(level) = args.level {
// Level was chosen by passing an argument to the log! macro.
// We need to apply the max log level filter here.
let level_str = format!("{:?}", level);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of doing this, the Level enum should be parseable from a TokenStream (using syn::parse::Parse), so we don't have to do this string hack

@mergify mergify bot added the aya-log Relating to aya-log label Sep 14, 2023
@mergify
Copy link

mergify bot commented Sep 14, 2023

@vadorovsky, this pull request is now in conflict and requires a rebase.

@mergify mergify bot added the needs-rebase label Sep 14, 2023
Copy link

mergify bot commented Feb 6, 2024

@vadorovsky, this pull request is now in conflict and requires a rebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aya-log Relating to aya-log needs-rebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants