Skip to content

Commit

Permalink
Revert "propagate current"
Browse files Browse the repository at this point in the history
This reverts commit 04126c7.
  • Loading branch information
marctc committed Sep 20, 2024
1 parent ad759a0 commit cf2f80b
Show file tree
Hide file tree
Showing 18 changed files with 11 additions and 22 deletions.
6 changes: 2 additions & 4 deletions bpf/go_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ char __license[] SEC("license") = "Dual MIT/GPL";
// attributes (method, path, and status code).

typedef struct goroutine_key {
u32 pid; // PID of the process
u64 pid; // PID of the process
u64 addr; // Address of the goroutine
} goroutine_key_t;

Expand Down Expand Up @@ -87,19 +87,17 @@ static __always_inline u64 find_parent_goroutine(goroutine_key_t *current) {
}

u64 r_addr = current->addr;
goroutine_key_t *parent = current;

int attempts = 0;
do {
tp_info_t *p_inv = bpf_map_lookup_elem(&go_trace_map, &r_addr);
if (!p_inv) { // not this goroutine running the server request processing
// Let's find the parent scope
goroutine_metadata *g_metadata =
(goroutine_metadata *)bpf_map_lookup_elem(&ongoing_goroutines, parent);
(goroutine_metadata *)bpf_map_lookup_elem(&ongoing_goroutines, current);
if (g_metadata) {
// Lookup now to see if the parent was a request
r_addr = (u64)g_metadata->parent.addr;
parent = &g_metadata->parent;
} else {
break;
}
Expand Down
3 changes: 1 addition & 2 deletions bpf/go_runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,10 @@ int uprobe_proc_newproc1_ret(struct pt_regs *ctx) {
u32 pid = pid_from_pid_tgid(pid_tid);

goroutine_key_t g_key = {.addr = (u64)goroutine_addr, .pid = pid};
goroutine_key_t p_key = {.addr = (u64)parent_goroutine, .pid = pid};

goroutine_metadata metadata = {
.timestamp = bpf_ktime_get_ns(),
.parent = p_key,
.parent = {.addr = (u64)parent_goroutine, .pid = pid},
};

if (bpf_map_update_elem(&ongoing_goroutines, &g_key, &metadata, BPF_ANY)) {
Expand Down
3 changes: 1 addition & 2 deletions pkg/internal/ebpf/gotracer/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/gotracer/bpf_arm64_bpfel.o
Binary file not shown.
3 changes: 1 addition & 2 deletions pkg/internal/ebpf/gotracer/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/gotracer/bpf_debug_arm64_bpfel.o
Binary file not shown.
3 changes: 1 addition & 2 deletions pkg/internal/ebpf/gotracer/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/gotracer/bpf_debug_x86_bpfel.o
Binary file not shown.
3 changes: 1 addition & 2 deletions pkg/internal/ebpf/gotracer/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/gotracer/bpf_tp_arm64_bpfel.o
Binary file not shown.
3 changes: 1 addition & 2 deletions pkg/internal/ebpf/gotracer/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/gotracer/bpf_tp_debug_arm64_bpfel.o
Binary file not shown.
3 changes: 1 addition & 2 deletions pkg/internal/ebpf/gotracer/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/gotracer/bpf_tp_debug_x86_bpfel.o
Binary file not shown.
3 changes: 1 addition & 2 deletions pkg/internal/ebpf/gotracer/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/gotracer/bpf_tp_x86_bpfel.o
Binary file not shown.
3 changes: 1 addition & 2 deletions pkg/internal/ebpf/gotracer/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/gotracer/bpf_x86_bpfel.o
Binary file not shown.

0 comments on commit cf2f80b

Please sign in to comment.