Skip to content

Commit

Permalink
Fix for cpu overhead
Browse files Browse the repository at this point in the history
  • Loading branch information
aayush-ap committed Oct 31, 2023
1 parent e5a77be commit 536d99d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion v3/newrelic/secure_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ type BodyBuffer struct {
}

func (b *BodyBuffer) Write(p []byte) (int, error) {
if l := len(b.buf); len(p) <= cap(b.buf)-l {
if l := len(b.buf); len(p) <= secureAgent.RequestBodyReadLimit()-l {
b.buf = append(b.buf, p...)
return len(p), nil
} else {
Expand Down
2 changes: 1 addition & 1 deletion v3/newrelic/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ func serverName(r *http.Request) string {

func reqBody(req *http.Request) io.Writer {
if IsSecurityAgentPresent() {
buf := &BodyBuffer{buf: make([]byte, 0, secureAgent.RequestBodyReadLimit())}
buf := &BodyBuffer{buf: make([]byte, 0, 100)}
tee := io.TeeReader(req.Body, buf)
req.Body = io.NopCloser(tee)
return buf
Expand Down

0 comments on commit 536d99d

Please sign in to comment.