Skip to content

adapt BPF_LOG in route_config.h #1220

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

Merged
merged 1 commit into from
Feb 20, 2025
Merged

adapt BPF_LOG in route_config.h #1220

merged 1 commit into from
Feb 20, 2025

Conversation

lec-bit
Copy link
Contributor

@lec-bit lec-bit commented Feb 5, 2025

What type of PR is this?
/kind enhancement

What this PR does / why we need it:
Due to the excessive number of instructions consumed by BPF_LOG, using BPF_LOG within the loop can easily lead to exceeding 1,000,000 instructions. A small optimization is needed to avoid surpassing this limit.
Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:


Copy link

codecov bot commented Feb 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 45.32%. Comparing base (065c67e) to head (d4c2f33).
Report is 9 commits behind head on main.

see 2 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 01ef8c1...d4c2f33. Read the comment docs.

@lec-bit
Copy link
Contributor Author

lec-bit commented Feb 5, 2025

/retest

@hzxuzhonghu
Copy link
Member

maybe #1206 can help reduce instruction cost by log too

DEBUG,
ROUTER_CONFIG,
"match virtual_host, name=\"%s\"\n",
(char *)KMESH_GET_PTR_VAL(virt_host->name, char *));
Copy link
Member

Choose a reason for hiding this comment

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

how can we know which is matched now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in line 364, virt_host = virtual_host_match(route_config, &addr, ctx);
we can log here


if (cluster_name != NULL) {
BPF_LOG(
DEBUG, ROUTER_CONFIG, "select cluster, name:weight %s:%d\n", cluster_name, route_cluster_weight->weight);
Copy link
Member

Choose a reason for hiding this comment

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

keep only cluster name, weight maybe not cared

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

@lec-bit
Copy link
Contributor Author

lec-bit commented Feb 19, 2025

/retest

Copy link
Member

@hzxuzhonghu hzxuzhonghu left a comment

Choose a reason for hiding this comment

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

/lgtm

@kmesh-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hzxuzhonghu

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kmesh-bot kmesh-bot merged commit 6cf231c into kmesh-net:main Feb 20, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants