Skip to content

Conversation

@hmahmood
Copy link
Contributor

@hmahmood hmahmood commented Jun 26, 2024

What does this PR do?

Adds a POC eBPF-less network tracer implementation. Only basic stats like bytes/packets sent/received and rudimentary TCP state tracking are currently supported. There is a new build mode to run tests under ebpf-less, but this only enabled if TEST_EBPFLESS_OVERRIDE=true is set in the environment.

Motivation

Additional Notes

Possible Drawbacks / Trade-offs

Describe how to test/QA your changes

@hmahmood hmahmood added changelog/no-changelog qa/done QA done before merge and regressions are covered by tests labels Jun 26, 2024
@hmahmood hmahmood added this to the 7.56.0 milestone Jun 26, 2024
@hmahmood hmahmood requested review from a team as code owners June 26, 2024 21:05
@dd-devflow
Copy link

dd-devflow bot commented Aug 7, 2024

🚂 MergeQueue: waiting for PR to be ready

This merge request is not mergeable yet, because of pending checks/missing approvals. It will be added to the queue as soon as checks pass and/or get approvals.
Note: if you pushed new commits since the last approval, you may need additional approval.
You can remove it from the waiting list with /remove command.

Use /merge -c to cancel this operation!

@dd-devflow
Copy link

dd-devflow bot commented Aug 8, 2024

⚠️ MergeQueue: This merge request was unqueued

This merge request was unqueued

If you need support, contact us on Slack #devflow!

CORE BuildMode
Fentry BuildMode
Ebpfless BuildMode
)
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like we should dedicate some time to the build modes. I don't think it's a blocker for this PR considering it's a PoC and the ebpfless mode isn't enabled by default (wdyt @brycekahle?), but we could probably find a way to reconciliate the actual eBPF build modes (prebuild/runtime/CORE) with fentry and ebpfless which are not something we'll want in the rest of test code.

Copy link
Member

Choose a reason for hiding this comment

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

ebpfless feels OK because it is mutually exclusive from prebuilt/rc/co-re. fentry is the confusing one, because that could be any of the build modes.

// NewTracer returns a new Tracer
func NewTracer(cfg *config.Config, telemetryComp telemetry.Component) (Tracer, error) {
if cfg.EnableEbpfless {
return newEbpfLessTracer(cfg)
Copy link
Member

Choose a reason for hiding this comment

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

Could the ebpf-less tracer be in a separate package and implement the Tracer interface? That was the original intent of that interface: to allow different implementations. Then you wouldn't have the git blame issue Lee was mentioning.

Creating pkg/network/tracer/ebpfless for the ebpf-less tracer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did try that, and I could not really sort out the import cycles without making this PR bigger than it already is. Perhaps in a followup I can attempt that again.

The git blame issue is not as bad as we initially thought. I can see the blame showing up in github across the renames.

@hmahmood hmahmood force-pushed the hasan.mahmood/ebpfless-tracer branch from 31b9b38 to 716ada1 Compare August 8, 2024 19:18
@hmahmood hmahmood requested a review from brycekahle August 8, 2024 19:19
@hmahmood hmahmood force-pushed the hasan.mahmood/ebpfless-tracer branch from 716ada1 to babc45d Compare August 8, 2024 20:07
@hmahmood hmahmood force-pushed the hasan.mahmood/ebpfless-tracer branch from babc45d to ac937f7 Compare August 8, 2024 21:08
Copy link
Member

@brycekahle brycekahle left a comment

Choose a reason for hiding this comment

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

minor typo

@hmahmood hmahmood modified the milestones: 7.57.0, 7.58.0 Aug 9, 2024
// PayloadLen returns the length of the application
// payload given the set of layers in `Layers`
func (l Layers) PayloadLen() (uint16, error) {
if l.UDP != nil {
Copy link
Contributor

@akarpz akarpz Aug 12, 2024

Choose a reason for hiding this comment

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

this gets called in the tcp processing path as well.. I've noticed locally it triggers because the UDP layer is not nil but it is empty, which bails out of the TCP connection parsing. perhaps we should do

if len(l.UDP.Payload) > 0 || len(l.UDP.Contents) > 0

(or write a helper isEmpty() that checks all field values)

(or or just omit this check entirely if we know it's a TCP connection, and refactor this into two methods with a helper)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed epbfless.Layers, so this should happen anymore.

Copy link
Contributor

Choose a reason for hiding this comment

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

nice, thanks

@hmahmood
Copy link
Contributor Author

/merge

@dd-devflow
Copy link

dd-devflow bot commented Aug 19, 2024

🚂 MergeQueue: waiting for PR to be ready

This merge request is not mergeable yet, because of pending checks/missing approvals. It will be added to the queue as soon as checks pass and/or get approvals.
Note: if you pushed new commits since the last approval, you may need additional approval.
You can remove it from the waiting list with /remove command.

Use /merge -c to cancel this operation!

@dd-devflow
Copy link

dd-devflow bot commented Aug 19, 2024

🚂 MergeQueue: pull request added to the queue

The median merge time in main is 21m.

Use /merge -c to cancel this operation!

@dd-mergequeue dd-mergequeue bot merged commit 1b8236b into main Aug 19, 2024
@dd-mergequeue dd-mergequeue bot deleted the hasan.mahmood/ebpfless-tracer branch August 19, 2024 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/no-changelog component/system-probe qa/done QA done before merge and regressions are covered by tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants