Skip to content
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

gin not support http pattern path in span name #1103

Open
quanbisen opened this issue Sep 14, 2024 · 3 comments
Open

gin not support http pattern path in span name #1103

quanbisen opened this issue Sep 14, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@quanbisen
Copy link

Is your feature request related to a problem? Please describe.
I have see current code. I know span name will display method pattern in http standard library with go greater or equal 1.22.0, reference code:

spanName := method
if isPatternPathSupported && isValidPatternPath {
spanName = spanName + " " + patternPath
attributes = append(attributes, semconv.HTTPRouteKey.String(patternPath))
}

But I have found that gin 1.9.1 trace span name only show method because of gin.Context internal http.Request struct field pat is nil, is there can get gin.Context.fullPath field in it?

Describe the solution you'd like
support gin.Context.fullPath field in span name. I am not good at ebpf and I have try to read gin.Context.fullPath from ebpf, but failed.
image

@quanbisen quanbisen added the enhancement New feature or request label Sep 14, 2024
@minimAluminiumalism
Copy link
Contributor

The same problem I've met. I think the code that causes this problem is in internal/pkg/instrumentation/bpf/net/http/server/bpf/probe.bpf.c:

int ret = bpf_probe_read(&pat_ptr, sizeof(pat_ptr), (void *)(req_ptr + req_pat_pos));

pat_ptr is 0.

Additionally, it seems that the same issue will ocuur in net/http package rather than just Gin. You can try the httpPlusdb on a Linux/amd64 virtual machine(not in a container).

@quanbisen
Copy link
Author

httpPlusdb

It is only gin. I have test net/http package that have pattern in span name.

@minimAluminiumalism
Copy link
Contributor

httpPlusdb

It is only gin. I have test net/http package that have pattern in span name.

Which OS and arch do you use to run this demo? You can check this issue to see the complete reproduction process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants