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

Complete the work on TCP packet context propagation #1290

Merged
merged 15 commits into from
Oct 31, 2024

Conversation

grcevski
Copy link
Contributor

@grcevski grcevski commented Oct 29, 2024

With this PR I'm completing the work on TCP packet context propagation:

  1. I added support for Go
  2. Resolved the unshared map issue with the new TC program module.
  3. Added a test option to disable black-box context propagation.
  4. Added an integration test which runs through the scenario, disabling black-box propagation and ensuring we see correctly propagated context.

I'll follow-up with a PR to rename the option to something that makes sense.

Copy link

codecov bot commented Oct 29, 2024

Codecov Report

Attention: Patch coverage is 77.14286% with 8 lines in your changes missing coverage. Please review.

Project coverage is 72.61%. Comparing base (f36c5e1) to head (6d924ae).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
pkg/internal/ebpf/generictracer/generictracer.go 66.66% 1 Missing and 2 partials ⚠️
pkg/internal/ebpf/gotracer/gotracer.go 50.00% 2 Missing and 1 partial ⚠️
pkg/beyla/os.go 0.00% 1 Missing ⚠️
pkg/internal/ebpf/tctracer/tctracer.go 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1290       +/-   ##
===========================================
+ Coverage   58.77%   72.61%   +13.83%     
===========================================
  Files         138      140        +2     
  Lines       14129    14231      +102     
===========================================
+ Hits         8305    10334     +2029     
+ Misses       5216     3215     -2001     
- Partials      608      682       +74     
Flag Coverage Δ
integration-test 58.73% <68.57%> (-0.05%) ⬇️
k8s-integration-test 59.67% <62.85%> (?)
oats-test 35.05% <54.28%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@rafaelroquetto rafaelroquetto left a comment

Choose a reason for hiding this comment

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

LGTM - you may need to rebase onto #1293 for the tests to pass

} else { \
__builtin_memcpy(__trace__->log, fmt, sizeof(__trace__->log)); \
} \
bpf_ringbuf_submit(__trace__, 0); \
Copy link
Contributor

Choose a reason for hiding this comment

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

perhaps add a note saying the reason for this is because tc programs do not support the bpf_get_current_comm helper, for future reference

@@ -32,6 +32,20 @@ struct {

enum bpf_func_id___x { BPF_FUNC_snprintf___x = 42 /* avoid zero */ };

#ifdef BPF_DEBUG_TC
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering whether we should add the following to the top of this file, just so that we can pass -DBPF_DEBUG_TC directly:

#ifdef BPF_DEBUG_TC
#define BPF_DEBUG
#endif 

@@ -24,7 +24,7 @@ import (
)

//go:generate $BPF2GO -cc $BPF_CLANG -cflags $BPF_CFLAGS -target amd64,arm64 bpf ../../../../bpf/tc_tracer.c -- -I../../../../bpf/headers
//go:generate $BPF2GO -cc $BPF_CLANG -cflags $BPF_CFLAGS -target amd64,arm64 bpf_debug ../../../../bpf/tc_tracer.c -- -I../../../../bpf/headers -DBPF_DEBUG
//go:generate $BPF2GO -cc $BPF_CLANG -cflags $BPF_CFLAGS -target amd64,arm64 bpf_debug ../../../../bpf/tc_tracer.c -- -I../../../../bpf/headers -DBPF_DEBUG -DBPF_DEBUG_TC
Copy link
Contributor

Choose a reason for hiding this comment

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

only in the case you accept my other suggestion regarding BPF_DEBUG_TC

Suggested change
//go:generate $BPF2GO -cc $BPF_CLANG -cflags $BPF_CFLAGS -target amd64,arm64 bpf_debug ../../../../bpf/tc_tracer.c -- -I../../../../bpf/headers -DBPF_DEBUG -DBPF_DEBUG_TC
//go:generate $BPF2GO -cc $BPF_CLANG -cflags $BPF_CFLAGS -target amd64,arm64 bpf_debug ../../../../bpf/tc_tracer.c -- -I../../../../bpf/headers -DBPF_DEBUG_TC

Copy link
Contributor

@mariomac mariomac left a comment

Choose a reason for hiding this comment

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

LGTM!

@grcevski grcevski merged commit eb0a8c4 into grafana:main Oct 31, 2024
15 checks passed
@grcevski grcevski deleted the tc_tests branch October 31, 2024 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants