Skip to content

Commit

Permalink
Merge branch 'master' into fix/gogf#2746
Browse files Browse the repository at this point in the history
  • Loading branch information
oldme-git authored Mar 1, 2024
2 parents 446229e + ce3ef13 commit 1646eff
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions net/ghttp/ghttp_middleware_tracing.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func internalMiddlewareServerTracing(r *Request) {
attribute.String(tracingEventHttpRequestUrl, r.URL.String()),
attribute.String(tracingEventHttpRequestHeaders, gconv.String(httputil.HeaderToMap(r.Header))),
attribute.String(tracingEventHttpRequestBaggage, gtrace.GetBaggageMap(ctx).String()),
attribute.String(tracingEventHttpRequestBody, gstr.StrLimit(
attribute.String(tracingEventHttpRequestBody, gstr.StrLimitRune(
string(reqBodyContentBytes),
gtrace.MaxContentLogSize(),
"...",
Expand All @@ -112,7 +112,7 @@ func internalMiddlewareServerTracing(r *Request) {
span.SetStatus(codes.Error, fmt.Sprintf(`%+v`, err))
}
// Response content logging.
var resBodyContent = gstr.StrLimit(r.Response.BufferString(), gtrace.MaxContentLogSize(), "...")
var resBodyContent = gstr.StrLimitRune(r.Response.BufferString(), gtrace.MaxContentLogSize(), "...")
if gzipAccepted(r.Response.Header()) {
reader, err := gzip.NewReader(strings.NewReader(r.Response.BufferString()))
if err != nil {
Expand All @@ -123,7 +123,7 @@ func internalMiddlewareServerTracing(r *Request) {
if err != nil {
span.SetStatus(codes.Error, fmt.Sprintf(`get uncompress value err:%+v`, err))
}
resBodyContent = gstr.StrLimit(string(uncompressed), gtrace.MaxContentLogSize(), "...")
resBodyContent = gstr.StrLimitRune(string(uncompressed), gtrace.MaxContentLogSize(), "...")
}

span.AddEvent(tracingEventHttpResponse, trace.WithAttributes(
Expand Down

0 comments on commit 1646eff

Please sign in to comment.