-
Notifications
You must be signed in to change notification settings - Fork 119
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
Socket filter to track HTTP requests for non Go #122
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Astonishing! 🤯
bpf/http_sock.c
Outdated
@@ -53,7 +45,7 @@ int BPF_KRETPROBE(kretprobe_sock_alloc, struct socket *sock) { | |||
return 0; | |||
} | |||
|
|||
bpf_dbg_printk("=== sock alloc %llx ===", id); | |||
//bpf_dbg_printk("=== sock alloc %llx ===", id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you forget to uncomment all these bpf_dbg_printk
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah! I was debugging an issue with system wide mode and there was too much output. I'll bring them back :)
Codecov Report
@@ Coverage Diff @@
## main #122 +/- ##
==========================================
- Coverage 71.78% 70.05% -1.73%
==========================================
Files 27 28 +1
Lines 1857 1927 +70
==========================================
+ Hits 1333 1350 +17
- Misses 420 471 +51
- Partials 104 106 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Thanks again Mario! |
Socket filter to track HTTP requests for non Go
This PR adds support for tracking HTTP server and client requests, though a socket filter, which we can use for languages other than Go. We parse only minimal information on the eBPF side, which means we have to use a different ringbuffer structure than for Go applications. For this purpose I added an optional transformer function that takes the socket filter record and converts it to the standard HTTP trace record.
There are few things missing from this PR:
I forgot I had issues with closing the file descriptor required for the filter. I'll follow-up with the change in this PR shortly.bpf_builtins.h and compiler.h are two new headers I needed from Cilium, which bring the support for memcpy.