This commit is contained in:
mats committed 2026-09-19 14:13:43 +02:00
1 parent 49f9bb3458
commit 7436966689
22 files changed
+989 -125

No files matched your search

+6 -6
View File
@@ -5,6 +5,7 @@ import (
"strconv"
"strings"
"git.tornberg.me/go-otel/internal/httpattr"
"git.tornberg.me/go-otel/internal/issues"
"go.opentelemetry.io/collector/pdata/pcommon"
"go.opentelemetry.io/collector/pdata/plog"
@@ -183,12 +184,11 @@ func firstAttr(attrs pcommon.Map, keys ...string) string {
// as a generic router mount. This keeps API endpoints distinct in issue
// fingerprints and avoids collapsing unrelated requests into one root route.
func httpRoute(attrs pcommon.Map) string {
route := firstAttr(attrs, "http.route")
path := firstAttr(attrs, "url.path", "http.target")
if path != "" && (route == "" || route == "/" && path != "/") {
return path
ep := httpattr.Extract(func(keys ...string) string { return firstAttr(attrs, keys...) })
if ep.Route != "" {
return ep.Route
}
return route
return ep.Path
}
// getHTTPStatusCode extracts an HTTP status code from attributes, supporting
@@ -332,7 +332,7 @@ func spanErrorTitle(span ptrace.Span) string {
}
method := firstAttr(span.Attributes(), "http.request.method", "http.method")
route := firstAttr(span.Attributes(), "http.route", "http.target", "url.path")
route := httpRoute(span.Attributes())
var endpoint string
if method != "" && route != "" {