Skip to content

Commit

Permalink
Increase buffer size to 192 to capture longer URLs (#1150)
Browse files Browse the repository at this point in the history
  • Loading branch information
marevers authored Sep 11, 2024
1 parent 715786d commit 77cba46
Show file tree
Hide file tree
Showing 51 changed files with 29 additions and 25 deletions.
2 changes: 1 addition & 1 deletion bpf/http_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "pid_types.h"
#include "bpf_dbg.h"

#define FULL_BUF_SIZE 160 // should be enough for most URLs, we may need to extend it if not. Must be multiple of 16 for the copy to work.
#define FULL_BUF_SIZE 192 // should be enough for most URLs, we may need to extend it if not. Must be multiple of 16 for the copy to work.
#define TRACE_BUF_SIZE 1024 // must be power of 2, we do an & to limit the buffer size
#define KPROBES_HTTP2_BUF_SIZE 256
#define KPROBES_HTTP2_RET_BUF_SIZE 64
Expand Down
14 changes: 9 additions & 5 deletions bpf/k_tracer.c
Original file line number Diff line number Diff line change
Expand Up @@ -552,19 +552,23 @@ int socket__http_filter(struct __sk_buff *skb) {
//dbg_print_http_connection_info(&conn); // commented out since GitHub CI doesn't like this call
sort_connection_info(&conn);

http_info_t info = {0};
info.conn_info = conn;
http_info_t *info = empty_http_info();
if (!info) {
return 0;
}

__builtin_memcpy(&info->conn_info, &conn, sizeof(conn));

if (packet_type == PACKET_TYPE_REQUEST) {
u32 full_len = skb->len - tcp.hdr_len;
if (full_len > FULL_BUF_SIZE) {
full_len = FULL_BUF_SIZE;
}
read_skb_bytes(skb, tcp.hdr_len, info.buf, full_len);
read_skb_bytes(skb, tcp.hdr_len, info->buf, full_len);
u64 cookie = bpf_get_socket_cookie(skb);
//bpf_dbg_printk("=== http_filter cookie = %llx, tcp_seq=%d len=%d %s ===", cookie, tcp.seq, len, buf);
//dbg_print_http_connection_info(&conn);
set_fallback_http_info(&info, &conn, skb->len - tcp.hdr_len);
set_fallback_http_info(info, &conn, skb->len - tcp.hdr_len);

// The code below is looking to see if we have recorded black-box trace info on
// another interface. We do this for client calls, where essentially the original
Expand All @@ -574,7 +578,7 @@ int socket__http_filter(struct __sk_buff *skb) {
// This casting is done here to save allocating memory on a per CPU buffer, since
// we don't need info anymore, we reuse it's space and it's much bigger than
// partial_connection_info_t.
partial_connection_info_t *partial = (partial_connection_info_t *)(&info);
partial_connection_info_t *partial = (partial_connection_info_t *)(info);
partial->d_port = conn.d_port;
partial->s_port = conn.s_port;
partial->tcp_seq = tcp.seq;
Expand Down
2 changes: 1 addition & 1 deletion pkg/internal/ebpf/common/bpf_arm64_bpfel.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified pkg/internal/ebpf/common/bpf_arm64_bpfel.o
Binary file not shown.
2 changes: 1 addition & 1 deletion pkg/internal/ebpf/common/bpf_x86_bpfel.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified pkg/internal/ebpf/common/bpf_x86_bpfel.o
Binary file not shown.
2 changes: 1 addition & 1 deletion pkg/internal/ebpf/common/httpfltr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/grafana/beyla/pkg/internal/svc"
)

const bufSize = 160
const bufSize = 192

func TestURL(t *testing.T) {
event := BPFHTTPInfo{
Expand Down
Binary file modified pkg/internal/ebpf/gotracer/bpf_arm64_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/gotracer/bpf_debug_arm64_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/gotracer/bpf_debug_x86_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/gotracer/bpf_tp_arm64_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/gotracer/bpf_tp_debug_arm64_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/gotracer/bpf_tp_debug_x86_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/gotracer/bpf_tp_x86_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/gotracer/bpf_x86_bpfel.o
Binary file not shown.
2 changes: 1 addition & 1 deletion pkg/internal/ebpf/httpssl/bpf_arm64_bpfel.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified pkg/internal/ebpf/httpssl/bpf_arm64_bpfel.o
Binary file not shown.
2 changes: 1 addition & 1 deletion pkg/internal/ebpf/httpssl/bpf_debug_arm64_bpfel.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified pkg/internal/ebpf/httpssl/bpf_debug_arm64_bpfel.o
Binary file not shown.
2 changes: 1 addition & 1 deletion pkg/internal/ebpf/httpssl/bpf_debug_x86_bpfel.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified pkg/internal/ebpf/httpssl/bpf_debug_x86_bpfel.o
Binary file not shown.
2 changes: 1 addition & 1 deletion pkg/internal/ebpf/httpssl/bpf_tp_arm64_bpfel.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified pkg/internal/ebpf/httpssl/bpf_tp_arm64_bpfel.o
Binary file not shown.
2 changes: 1 addition & 1 deletion pkg/internal/ebpf/httpssl/bpf_tp_debug_arm64_bpfel.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified pkg/internal/ebpf/httpssl/bpf_tp_debug_arm64_bpfel.o
Binary file not shown.
2 changes: 1 addition & 1 deletion pkg/internal/ebpf/httpssl/bpf_tp_debug_x86_bpfel.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified pkg/internal/ebpf/httpssl/bpf_tp_debug_x86_bpfel.o
Binary file not shown.
2 changes: 1 addition & 1 deletion pkg/internal/ebpf/httpssl/bpf_tp_x86_bpfel.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified pkg/internal/ebpf/httpssl/bpf_tp_x86_bpfel.o
Binary file not shown.
2 changes: 1 addition & 1 deletion pkg/internal/ebpf/httpssl/bpf_x86_bpfel.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified pkg/internal/ebpf/httpssl/bpf_x86_bpfel.o
Binary file not shown.
2 changes: 1 addition & 1 deletion pkg/internal/ebpf/ktracer/bpf_arm64_bpfel.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified pkg/internal/ebpf/ktracer/bpf_arm64_bpfel.o
Binary file not shown.
2 changes: 1 addition & 1 deletion pkg/internal/ebpf/ktracer/bpf_debug_arm64_bpfel.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified pkg/internal/ebpf/ktracer/bpf_debug_arm64_bpfel.o
Binary file not shown.
2 changes: 1 addition & 1 deletion pkg/internal/ebpf/ktracer/bpf_debug_x86_bpfel.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified pkg/internal/ebpf/ktracer/bpf_debug_x86_bpfel.o
Binary file not shown.
2 changes: 1 addition & 1 deletion pkg/internal/ebpf/ktracer/bpf_tp_arm64_bpfel.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified pkg/internal/ebpf/ktracer/bpf_tp_arm64_bpfel.o
Binary file not shown.
2 changes: 1 addition & 1 deletion pkg/internal/ebpf/ktracer/bpf_tp_debug_arm64_bpfel.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified pkg/internal/ebpf/ktracer/bpf_tp_debug_arm64_bpfel.o
Binary file not shown.
2 changes: 1 addition & 1 deletion pkg/internal/ebpf/ktracer/bpf_tp_debug_x86_bpfel.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified pkg/internal/ebpf/ktracer/bpf_tp_debug_x86_bpfel.o
Binary file not shown.
2 changes: 1 addition & 1 deletion pkg/internal/ebpf/ktracer/bpf_tp_x86_bpfel.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified pkg/internal/ebpf/ktracer/bpf_tp_x86_bpfel.o
Binary file not shown.
2 changes: 1 addition & 1 deletion pkg/internal/ebpf/ktracer/bpf_x86_bpfel.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified pkg/internal/ebpf/ktracer/bpf_x86_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/watcher/bpf_arm64_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/watcher/bpf_debug_arm64_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/watcher/bpf_debug_x86_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/watcher/bpf_x86_bpfel.o
Binary file not shown.

0 comments on commit 77cba46

Please sign in to comment.