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

[WIP]Introduce eBPF prog coverage #692

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

Conversation

tacslon
Copy link
Contributor

@tacslon tacslon commented Aug 6, 2024

What type of PR is this?

/kind enhancement
What this PR does / why we need it:
Introduce eBPF prog coverage
Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Introduce a new flag `enable-bpf-coverage` to generate eBPF code coverage after Kmesh is exited

@kmesh-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign nlgwcy for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@tacslon
Copy link
Contributor Author

tacslon commented Aug 6, 2024

How to generate coverage

(This is a temporary way to generate coverage, and will be optimized in future work)

  1. Copy all codes in bpf/ to Kmesh-pod:/kmesh
  2. Start Kmesh in pod with --enable-bpf-coverage=true at directory /kmesh/bpf/kmesh/workload
  3. Run test cases
  4. Stop kmesh-deamon process
  5. The coverage HTML is at Kmesh-pod:/kmesh/sockops-cov.html

Coverage HTML sample:
sockops-cov.zip
image

@LiZhenCheng9527
Copy link
Collaborator

How to generate coverage

  1. Start Kmesh with --enable-bpf-coverage=true
  2. Copy all codes in bpf/ to Kmesh-pod:/kmesh
  3. Run test cases
  4. Get yourself into Kmesh-pod, then stop Kmesh
  5. The coverage HTML is at Kmesh-pod:/kmesh/sockops-cov.html

can you introduct it at Thursday's community meeting?

@tacslon
Copy link
Contributor Author

tacslon commented Aug 6, 2024

How to generate coverage

  1. Start Kmesh with --enable-bpf-coverage=true
  2. Copy all codes in bpf/ to Kmesh-pod:/kmesh
  3. Run test cases
  4. Get yourself into Kmesh-pod, then stop Kmesh
  5. The coverage HTML is at Kmesh-pod:/kmesh/sockops-cov.html

can you introduct it at Thursday's community meeting?

Sure

@hzxuzhonghu
Copy link
Member

/retest

// Create parameter logWriter passed to coverbee InstrumentAndLoadCollection()
logFile, err := os.Create("/kmesh/instrument-load.log")
if err != nil {
return nil, fmt.Errorf("open log file: %w", err)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
return nil, fmt.Errorf("open log file: %w", err)
return nil, fmt.Errorf("create log file failed: %w", err)

}
so.Coll = coll

if GetStartType() == Restart {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Both branches have this if, is it possible to extract this if outside

@tacslon
Copy link
Contributor Author

tacslon commented Aug 8, 2024

To be discussed:

  1. Do eBPF test: with Kmesh daemon running OR run the eBPF programs alone?
    -- do not depend on Kmesh start
  2. Integrate eBPF coverage with E2E Test?
    -- do not integrate with E2E

TODO:
Integrade with summer-ospp UT framework project

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.

4 participants