ml
This commit is contained in:
1 parent
21f04d696b
commit
8f5c267444
26 files changed
+3039
-10
No files matched your search
@@ -87,7 +87,7 @@ func spanSample(span ptrace.Span, res pcommon.Resource, timestamp int64, title s
|
||||
SpanID: idString(span.SpanID()),
|
||||
Message: title,
|
||||
HTTPMethod: firstAttr(span.Attributes(), "http.request.method", "http.method"),
|
||||
HTTPRoute: firstAttr(span.Attributes(), "http.route", "http.target", "url.path"),
|
||||
HTTPRoute: httpRoute(span.Attributes()),
|
||||
UserAgent: firstAttr(span.Attributes(), "user_agent.original", "http.user_agent"),
|
||||
SourceIP: sourceIP(span.Attributes(), res.Attributes()),
|
||||
Release: firstAttr(span.Attributes(), "service.release"),
|
||||
@@ -109,7 +109,7 @@ func logSample(record plog.LogRecord, res pcommon.Resource, timestamp int64, tit
|
||||
Message: title,
|
||||
Stacktrace: attrString(record.Attributes(), "exception.stacktrace"),
|
||||
HTTPMethod: firstAttr(record.Attributes(), "http.request.method", "http.method"),
|
||||
HTTPRoute: firstAttr(record.Attributes(), "http.route", "http.target", "url.path"),
|
||||
HTTPRoute: httpRoute(record.Attributes()),
|
||||
UserAgent: firstAttr(record.Attributes(), "user_agent.original", "http.user_agent", "browser.userAgent"),
|
||||
SourceIP: sourceIP(record.Attributes(), res.Attributes()),
|
||||
Release: firstAttr(record.Attributes(), "service.release"),
|
||||
@@ -179,6 +179,18 @@ func firstAttr(attrs pcommon.Map, keys ...string) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
// httpRoute prefers the concrete URL path when instrumentation reports "/"
|
||||
// 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
|
||||
}
|
||||
return route
|
||||
}
|
||||
|
||||
// getHTTPStatusCode extracts an HTTP status code from attributes, supporting
|
||||
// both new (http.response.status_code) and old (http.status_code) semconv keys,
|
||||
// stored as integer or string.
|
||||
|
||||
Reference in new issue
Block a user