diff --git a/v3/integrations/nrfasthttp/instrumentation.go b/v3/integrations/nrfasthttp/instrumentation.go index 62e59ebf1..c35b0d2bb 100644 --- a/v3/integrations/nrfasthttp/instrumentation.go +++ b/v3/integrations/nrfasthttp/instrumentation.go @@ -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 } diff --git a/v3/newrelic/internal_app.go b/v3/newrelic/internal_app.go index d376625d3..62b81d845 100644 --- a/v3/newrelic/internal_app.go +++ b/v3/newrelic/internal_app.go @@ -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(), }) } @@ -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 {