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

+8 -8
View File
@@ -10,6 +10,7 @@ import (
"strconv"
"strings"
"git.tornberg.me/go-otel/internal/httpattr"
"git.tornberg.me/go-otel/internal/issues"
)
@@ -397,14 +398,13 @@ func defaultString(value, fallback string) string {
func normalizeMessage(message string) string { return issues.NormalizeTitle(message) }
func normalizeHTTPRoute(attrs []attribute) string {
route := stringAttr(attrs, "http.route")
path := stringAttr(attrs, "url.path", "http.target")
// Some HTTP instrumentations report the router mount point (often "/")
// as http.route while url.path contains the actual endpoint. Prefer the
// specific path in that case so unrelated API calls do not collapse into
// one pattern.
if path != "" && (route == "" || route == "/" && path != "/") {
route = path
ep := httpattr.Extract(func(keys ...string) string { return stringAttr(attrs, keys...) })
// Prefer the template when the instrumentation gave a meaningful one,
// otherwise the concrete path. A mount-point route ("/") is dropped by
// Extract so unrelated API calls do not collapse into one pattern.
route := ep.Route
if route == "" {
route = ep.Path
}
return issues.NormalizeRoute(route)
}