Skip to content

Commit

Permalink
Merge branch 'develop' into fasthttpupdate
Browse files Browse the repository at this point in the history
  • Loading branch information
mirackara committed Nov 30, 2023
2 parents f8fa4e6 + 754ce4e commit ea8078a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
5 changes: 3 additions & 2 deletions v3/integrations/nrfasthttp/instrumentation.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ package nrfasthttp

import (
"net/http"

"github.com/newrelic/go-agent/v3/internal"

"github.com/newrelic/go-agent/v3/newrelic"
"github.com/valyala/fasthttp"
"github.com/valyala/fasthttp/fasthttpadaptor"
)


func init() { internal.TrackUsage("integration", "framework", "fasthttp") }



type fasthttpWrapperResponse struct {
ctx *fasthttp.RequestCtx
}
Expand Down
13 changes: 12 additions & 1 deletion v3/newrelic/internal_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func (app *app) doHarvest(h *harvest, harvestStart time.Time, run *appRun) {
if resp.Err != nil {
app.Warn("harvest failure", map[string]interface{}{
"cmd": cmd,
"error": resp.Err.Error(),
"error": obfuscateLicenseKeyCollectorRequest(resp.Err.Error()),
"retain_data": resp.ShouldSaveHarvestData(),
})
}
Expand All @@ -132,6 +132,17 @@ func (app *app) doHarvest(h *harvest, harvestStart time.Time, run *appRun) {
}
}

func obfuscateLicenseKeyCollectorRequest(responseErrorString string) string {
licenseKeyIndex := strings.Index(responseErrorString, "license_key=")
marshalFormatIndex := strings.Index(responseErrorString, "&marshal_format=")

if licenseKeyIndex == -1 || marshalFormatIndex == -1 {
return responseErrorString
}

return responseErrorString[0:licenseKeyIndex] + "license_key=**REDACTED**" + responseErrorString[marshalFormatIndex:]
}

func (app *app) connectRoutine() {
attempts := 0
for {
Expand Down

0 comments on commit ea8078a

Please sign in to comment.