Problem Statement
I'm using go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin together with sentry + otel setup. otelgin seems to set span name correctly to the route /api/v1/projects/:id/issues but sentry otel sets it back to /api/v1/projects/1234/issues which causes transactions not to be grouped properly in the UI.
Solution Brainstorm
When debugging, I see that the code that does this is in these lines:
|
var httpPath string |
|
if httpTarget != "" { |
|
if parsedUrl, err := url.Parse(httpTarget); err == nil { |
|
// Do not include the query and fragment parts |
|
httpPath = parsedUrl.Path |
|
} else { |
|
httpPath = httpTarget |
|
} |
|
} else if httpRoute != "" { |
|
httpPath = httpRoute |
|
} else if httpUrl != "" { |
|
// This is normally the HTTP-client case |
|
if parsedUrl, err := url.Parse(httpUrl); err == nil { |
|
// Do not include the query and fragment parts |
|
httpPath = fmt.Sprintf("%s://%s%s", parsedUrl.Scheme, parsedUrl.Host, parsedUrl.Path) |
|
} |
|
} |
httpTarget takes precedence over httpRoute. I'm not sure what those terms exactly mean in otel context but my goal is to see grouped transactions in the UI
Problem Statement
I'm using go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin together with sentry + otel setup. otelgin seems to set span name correctly to the route
/api/v1/projects/:id/issuesbut sentry otel sets it back to/api/v1/projects/1234/issueswhich causes transactions not to be grouped properly in the UI.Solution Brainstorm
When debugging, I see that the code that does this is in these lines:
sentry-go/otel/internal/utils/spanattributes.go
Lines 104 to 120 in 7996759
httpTargettakes precedence overhttpRoute. I'm not sure what those terms exactly mean in otel context but my goal is to see grouped transactions in the UI