opentelemetry-go-instrumentation
opentelemetry-go-instrumentation copied to clipboard
Failed to get `pattern path`
Describe the bug
Missing pattern path causes incomplete span name.
Environment
- OS: Linux/arm64
- Go Version: go1.23.1
- Version: latest
To Reproduce
Let's see the example rolldice you've provided.
When I running the example in docker container using docker compose up, everything is ok, and I can see the full span name on the jaeger web page, which like the picture 2 I've provided above.
But when I instrument an application on the same host, the span doesn't have any pattern name which only consists of http method.
I checked carefully and only found the running environment is different.
Expected behavior
Full span name with http method and pattern path
Additional context
In fact, you can check the demo picture http_Db_traces.jpg in example/httpPlusdb/, the span name is also incompleted.
Maybe here is the code that causes the problem in internal/pkg/instrumentation/bpf/net/http/server/bpf/probe.bpf.c (I cannot ensure that, but I found pat_ptr is sometimes 0 so it won't execute read_go_string())
if (pattern_path_supported) {
void *pat_ptr = NULL;
bpf_probe_read(&pat_ptr, sizeof(pat_ptr), (void *)(req_ptr + req_pat_pos));
if (pat_ptr != NULL) {
read_go_string(pat_ptr, pat_str_pos, http_server_span->path_pattern, sizeof(http_server_span->path), "patterned path from Request");
}
}