Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
grcevski committed Jan 22, 2024
1 parent 52eea96 commit 0af5fb6
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 10 deletions.
6 changes: 6 additions & 0 deletions bpf/http_sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,12 @@ int BPF_KRETPROBE(kretprobe_tcp_recvmsg, int copied_len) {
return 0;
}

/*
The tracking of the clones is complicated by the fact that in container environments
the tid returned by the sys_clone call is the namespaced tid, not the host tid which
bpf sees normally. To mitigate this we work exclusively with namespaces. Only the clone_map
and server_traces are keyed off the namespace:pid.
*/
SEC("kretprobe/sys_clone")
int BPF_KRETPROBE(kretprobe_sys_clone, int tid) {
u64 id = bpf_get_current_pid_tgid();
Expand Down
Binary file modified pkg/internal/ebpf/httpfltr/bpf_bpfel_arm64.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/httpfltr/bpf_bpfel_x86.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/httpfltr/bpf_debug_bpfel_arm64.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/httpfltr/bpf_debug_bpfel_x86.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/httpfltr/bpf_tp_bpfel_arm64.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/httpfltr/bpf_tp_bpfel_x86.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/httpfltr/bpf_tp_debug_bpfel_arm64.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/httpfltr/bpf_tp_debug_bpfel_x86.o
Binary file not shown.
2 changes: 1 addition & 1 deletion test/integration/multiprocess_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func TestMultiProcess(t *testing.T) {
})

if kprobeTraces {
t.Run("Nested traces with kprobes: node python rails", func(t *testing.T) {
t.Run("Nested traces with kprobes: rust -> java -> node -> python -> rails", func(t *testing.T) {
testNestedHTTPTracesKProbes(t)
})

Expand Down
18 changes: 9 additions & 9 deletions test/integration/traces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -666,28 +666,28 @@ func testNestedHTTPTracesKProbes(t *testing.T) {
waitForTestComponents(t, "http://localhost:8091") // rust

// Add and check for specific trace ID
doHTTPGet(t, "http://localhost:8091/dist2", 200)
doHTTPGet(t, "http://localhost:8091/dist", 200)

// rust -> java -> nodejs -> python -> rails
// /dist2 -> /jtrace2 -> /traceme -> /tracemetoo -> /users

var trace jaeger.Trace
test.Eventually(t, testTimeout, func(t require.TestingT) {
resp, err := http.Get(jaegerQueryURL + "?service=rust-service&operation=GET%20%2Fdist2")
resp, err := http.Get(jaegerQueryURL + "?service=rust-service&operation=GET%20%2Fdist")
require.NoError(t, err)
if resp == nil {
return
}
require.Equal(t, http.StatusOK, resp.StatusCode)
var tq jaeger.TracesQuery
require.NoError(t, json.NewDecoder(resp.Body).Decode(&tq))
traces := tq.FindBySpan(jaeger.Tag{Key: "url.path", Type: "string", Value: "/dist2"})
traces := tq.FindBySpan(jaeger.Tag{Key: "url.path", Type: "string", Value: "/dist"})
require.Len(t, traces, 1)
trace = traces[0]
}, test.Interval(100*time.Millisecond))

// Check the information of the rust parent span
res := trace.FindByOperationName("GET /dist2")
res := trace.FindByOperationName("GET /dist")
require.Len(t, res, 1)
parent := res[0]
require.NotEmpty(t, parent.TraceID)
Expand All @@ -699,15 +699,15 @@ func testNestedHTTPTracesKProbes(t *testing.T) {
sd := parent.Diff(
jaeger.Tag{Key: "http.request.method", Type: "string", Value: "GET"},
jaeger.Tag{Key: "http.response.status_code", Type: "int64", Value: float64(200)},
jaeger.Tag{Key: "url.path", Type: "string", Value: "/dist2"},
jaeger.Tag{Key: "url.path", Type: "string", Value: "/dist"},
jaeger.Tag{Key: "server.port", Type: "int64", Value: float64(8090)},
jaeger.Tag{Key: "http.route", Type: "string", Value: "/dist2"},
jaeger.Tag{Key: "http.route", Type: "string", Value: "/dist"},
jaeger.Tag{Key: "span.kind", Type: "string", Value: "server"},
)
assert.Empty(t, sd, sd.String())

// Check the information of the java parent span
res = trace.FindByOperationName("GET /jtrace2")
res = trace.FindByOperationName("GET /jtrace")
require.Len(t, res, 1)
parent = res[0]
require.NotEmpty(t, parent.TraceID)
Expand All @@ -719,9 +719,9 @@ func testNestedHTTPTracesKProbes(t *testing.T) {
sd = parent.Diff(
jaeger.Tag{Key: "http.request.method", Type: "string", Value: "GET"},
jaeger.Tag{Key: "http.response.status_code", Type: "int64", Value: float64(200)},
jaeger.Tag{Key: "url.path", Type: "string", Value: "/jtrace2"},
jaeger.Tag{Key: "url.path", Type: "string", Value: "/jtrace"},
jaeger.Tag{Key: "server.port", Type: "int64", Value: float64(8085)},
jaeger.Tag{Key: "http.route", Type: "string", Value: "/jtrace2"},
jaeger.Tag{Key: "http.route", Type: "string", Value: "/jtrace"},
jaeger.Tag{Key: "span.kind", Type: "string", Value: "server"},
)
assert.Empty(t, sd, sd.String())
Expand Down

0 comments on commit 0af5fb6

Please sign in to comment.