From 6be32389281705f21da61d76fbf6b78a45a7b118 Mon Sep 17 00:00:00 2001 From: Eugene Balybin <120384471+EugeneBalybin@users.noreply.github.com> Date: Fri, 23 Jun 2023 16:25:52 -0300 Subject: [PATCH 1/5] Update log_event.go Fixes issue: https://github.com/newrelic/go-agent/issues/743 --- v3/newrelic/log_event.go | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/v3/newrelic/log_event.go b/v3/newrelic/log_event.go index ee81effff..5fd705ef0 100644 --- a/v3/newrelic/log_event.go +++ b/v3/newrelic/log_event.go @@ -193,25 +193,16 @@ func (md *linkingMetadata) appendLinkingMetadata(buf *bytes.Buffer) { addDynamicSpacing(buf) buf.WriteString("NR-LINKING|") - if md.traceID != "" && md.spanID != "" { - buf.WriteString(md.entityGUID) - buf.WriteByte('|') - buf.WriteString(md.hostname) - buf.WriteByte('|') - buf.WriteString(md.traceID) - buf.WriteByte('|') - buf.WriteString(md.spanID) - buf.WriteByte('|') - buf.WriteString(md.entityName) - buf.WriteByte('|') - } else { - buf.WriteString(md.entityGUID) - buf.WriteByte('|') - buf.WriteString(md.hostname) - buf.WriteByte('|') - buf.WriteString(md.entityName) - buf.WriteByte('|') - } + buf.WriteString(md.entityGUID) + buf.WriteByte('|') + buf.WriteString(md.hostname) + buf.WriteByte('|') + buf.WriteString(md.traceID) + buf.WriteByte('|') + buf.WriteString(md.spanID) + buf.WriteByte('|') + buf.WriteString(md.entityName) + buf.WriteByte('|') } func addDynamicSpacing(buf *bytes.Buffer) { From 84112691383bf030d611ae1ecd58957f51d0272f Mon Sep 17 00:00:00 2001 From: Steve Willoughby Date: Thu, 10 Aug 2023 12:33:32 -0700 Subject: [PATCH 2/5] release candidate --- CHANGELOG.md | 28 +++++ v3/go.mod | 3 +- .../logcontext-v2/logWriter/go.mod | 6 +- v3/integrations/logcontext-v2/nrlogrus/go.mod | 6 +- v3/integrations/logcontext-v2/nrwriter/go.mod | 6 +- v3/integrations/logcontext-v2/nrzap/go.mod | 6 +- .../logcontext-v2/nrzerolog/go.mod | 6 +- .../logcontext-v2/zerologWriter/go.mod | 6 +- .../logcontext/nrlogrusplugin/go.mod | 7 +- v3/integrations/nrawssdk-v1/go.mod | 7 +- v3/integrations/nrawssdk-v1/nrawssdk_test.go | 2 +- v3/integrations/nrawssdk-v2/go.mod | 6 +- v3/integrations/nrawssdk-v2/nrawssdk_test.go | 2 +- v3/integrations/nrb3/go.mod | 4 +- v3/integrations/nrecho-v3/go.mod | 7 +- v3/integrations/nrecho-v3/nrecho_test.go | 15 +-- v3/integrations/nrecho-v4/go.mod | 6 +- v3/integrations/nrecho-v4/nrecho_test.go | 17 +-- v3/integrations/nrelasticsearch-v7/go.mod | 7 +- v3/integrations/nrgin/go.mod | 2 +- v3/integrations/nrgorilla/go.mod | 7 +- v3/integrations/nrgraphgophers/go.mod | 7 +- v3/integrations/nrgraphqlgo/example/go.mod | 6 +- v3/integrations/nrgraphqlgo/go.mod | 7 +- v3/integrations/nrgrpc/go.mod | 2 +- v3/integrations/nrhttprouter/go.mod | 7 +- .../nrhttprouter/nrhttprouter_test.go | 12 +- v3/integrations/nrlambda/go.mod | 6 +- v3/integrations/nrlambda/handler_test.go | 2 +- v3/integrations/nrlogrus/go.mod | 6 +- v3/integrations/nrlogxi/go.mod | 6 +- v3/integrations/nrmicro/go.mod | 2 +- v3/integrations/nrmongo/go.mod | 2 +- v3/integrations/nrmongo/nrmongo.go | 14 ++- v3/integrations/nrmssql/go.mod | 6 +- v3/integrations/nrmysql/go.mod | 5 +- v3/integrations/nrnats/go.mod | 6 +- v3/integrations/nrnats/nrnats_test.go | 11 +- v3/integrations/nrnats/test/go.mod | 10 +- v3/integrations/nrpgx/example/sqlx/go.mod | 6 +- v3/integrations/nrpgx/go.mod | 8 +- v3/integrations/nrpgx5/go.mod | 6 +- v3/integrations/nrpkgerrors/go.mod | 7 +- v3/integrations/nrpq/example/sqlx/go.mod | 6 +- v3/integrations/nrpq/go.mod | 7 +- v3/integrations/nrredis-v7/go.mod | 8 +- v3/integrations/nrredis-v8/go.mod | 8 +- v3/integrations/nrredis-v8/nrredis_test.go | 4 + v3/integrations/nrredis-v9/go.mod | 7 +- v3/integrations/nrsarama/go.mod | 4 +- v3/integrations/nrsecurityagent/go.mod | 2 +- v3/integrations/nrsnowflake/go.mod | 6 +- v3/integrations/nrsqlite3/go.mod | 7 +- v3/integrations/nrstan/examples/go.mod | 6 +- v3/integrations/nrstan/go.mod | 6 +- v3/integrations/nrstan/test/go.mod | 6 +- v3/integrations/nrzap/go.mod | 7 +- v3/newrelic/instrumentation.go | 4 +- v3/newrelic/internal_response_writer.go | 4 +- v3/newrelic/internal_txn.go | 2 +- v3/newrelic/segments.go | 13 +- v3/newrelic/sql_driver.go | 115 ++++++++++++++---- v3/newrelic/transaction.go | 6 +- v3/newrelic/version.go | 2 +- 64 files changed, 360 insertions(+), 170 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a01b689f3..5719b313b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,31 @@ +## 3.24.1 +### Fixed + * Performance improvement around calls to security agent. In some cases, unnecessary setup operations were being performed even if there was no security agent present to use that. These are now conditional on the security agent being present in the application (note that this will enable the setup code if the security agent is *present* in the application, regardless of whether it's currently enabled to run). This affects: + * Base agent code (updated to v3.24.1) + * `nrmongo` integration (updated to v1.1.1) + + * Fixed unit tests for integrations which were failing because code level metrics are enabled by default now: + * `nrawssdk-v1` (updated to v1.1.2) + * `nrawssdk-v2` (updated to v1.2.2) + * `nrecho-v3` (updated to v1.0.2) + * `nrecho-v4` (updated to v1.0.4) + * `nrhttprouter` (updated to + * `nrlambda` (updated to v1.2.2) + * `nrnats` (updated to v1.1.5) + * `nrredis-v8` (updated to v1.0.1) + + +### Changed + * Updated all integration `go.mod` files to reflect supported Go language versions. + +### Support statement + +We use the latest version of the Go language. At minimum, you should be using no version of Go older than what is supported by the Go team themselves (i.e., Go versions 1.19 and later are supported). + +We recommend updating to the latest agent version as soon as it's available. If you can't upgrade to the latest version, update your agents to a version no more than 90 days old. Read more about keeping agents up to date. (https://docs.newrelic.com/docs/new-relic-solutions/new-relic-one/install-configure/update-new-relic-agent/) + +See the [Go agent EOL Policy](/docs/apm/agents/go-agent/get-started/go-agent-eol-policy/) for details about supported versions of the Go agent and third-party components. + ## 3.24.0 ### Added diff --git a/v3/go.mod b/v3/go.mod index 4e184838d..d00562a5a 100644 --- a/v3/go.mod +++ b/v3/go.mod @@ -1,11 +1,10 @@ module github.com/newrelic/go-agent/v3 -go 1.18 +go 1.19 require ( github.com/golang/protobuf v1.5.3 google.golang.org/grpc v1.54.0 ) - retract v3.22.0 // release process error corrected in v3.22.1 diff --git a/v3/integrations/logcontext-v2/logWriter/go.mod b/v3/integrations/logcontext-v2/logWriter/go.mod index 709202b5a..c54a7f096 100644 --- a/v3/integrations/logcontext-v2/logWriter/go.mod +++ b/v3/integrations/logcontext-v2/logWriter/go.mod @@ -1,9 +1,11 @@ module github.com/newrelic/go-agent/v3/integrations/logcontext-v2/logWriter -go 1.17 +go 1.19 require ( - github.com/newrelic/go-agent/v3 v3.19.1 + github.com/newrelic/go-agent/v3 v3.24.1 github.com/newrelic/go-agent/v3/integrations/logcontext-v2/nrwriter v1.0.0 ) + +replace github.com/newrelic/go-agent/v3 => ../../.. diff --git a/v3/integrations/logcontext-v2/nrlogrus/go.mod b/v3/integrations/logcontext-v2/nrlogrus/go.mod index b2096a6d4..1a98c954c 100644 --- a/v3/integrations/logcontext-v2/nrlogrus/go.mod +++ b/v3/integrations/logcontext-v2/nrlogrus/go.mod @@ -1,9 +1,11 @@ module github.com/newrelic/go-agent/v3/integrations/logcontext-v2/nrlogrus -go 1.17 +go 1.19 require ( - github.com/newrelic/go-agent/v3 v3.18.0 + github.com/newrelic/go-agent/v3 v3.24.1 github.com/sirupsen/logrus v1.8.1 ) + +replace github.com/newrelic/go-agent/v3 => ../../.. diff --git a/v3/integrations/logcontext-v2/nrwriter/go.mod b/v3/integrations/logcontext-v2/nrwriter/go.mod index 2b86ff2ed..345714015 100644 --- a/v3/integrations/logcontext-v2/nrwriter/go.mod +++ b/v3/integrations/logcontext-v2/nrwriter/go.mod @@ -1,6 +1,8 @@ module github.com/newrelic/go-agent/v3/integrations/logcontext-v2/nrwriter -go 1.17 +go 1.19 -require github.com/newrelic/go-agent/v3 v3.19.1 +require github.com/newrelic/go-agent/v3 v3.24.1 + +replace github.com/newrelic/go-agent/v3 => ../../.. diff --git a/v3/integrations/logcontext-v2/nrzap/go.mod b/v3/integrations/logcontext-v2/nrzap/go.mod index 11e14551c..ed6f9d046 100644 --- a/v3/integrations/logcontext-v2/nrzap/go.mod +++ b/v3/integrations/logcontext-v2/nrzap/go.mod @@ -1,9 +1,11 @@ module github.com/newrelic/go-agent/v3/integrations/logcontext-v2/nrzap -go 1.18 +go 1.19 require ( - github.com/newrelic/go-agent/v3 v3.21.1 + github.com/newrelic/go-agent/v3 v3.24.1 go.uber.org/zap v1.24.0 ) + +replace github.com/newrelic/go-agent/v3 => ../../.. diff --git a/v3/integrations/logcontext-v2/nrzerolog/go.mod b/v3/integrations/logcontext-v2/nrzerolog/go.mod index 27630a598..41ca371cf 100644 --- a/v3/integrations/logcontext-v2/nrzerolog/go.mod +++ b/v3/integrations/logcontext-v2/nrzerolog/go.mod @@ -1,9 +1,11 @@ module github.com/newrelic/go-agent/v3/integrations/logcontext-v2/nrzerolog -go 1.17 +go 1.19 require ( - github.com/newrelic/go-agent/v3 v3.18.0 + github.com/newrelic/go-agent/v3 v3.24.1 github.com/rs/zerolog v1.26.1 ) + +replace github.com/newrelic/go-agent/v3 => ../../.. diff --git a/v3/integrations/logcontext-v2/zerologWriter/go.mod b/v3/integrations/logcontext-v2/zerologWriter/go.mod index 6117eca38..c32084511 100644 --- a/v3/integrations/logcontext-v2/zerologWriter/go.mod +++ b/v3/integrations/logcontext-v2/zerologWriter/go.mod @@ -1,10 +1,12 @@ module github.com/newrelic/go-agent/v3/integrations/logcontext-v2/zerologWriter -go 1.17 +go 1.19 require ( - github.com/newrelic/go-agent/v3 v3.19.1 + github.com/newrelic/go-agent/v3 v3.24.1 github.com/newrelic/go-agent/v3/integrations/logcontext-v2/nrwriter v1.0.0 github.com/rs/zerolog v1.27.0 ) + +replace github.com/newrelic/go-agent/v3 => ../../.. diff --git a/v3/integrations/logcontext/nrlogrusplugin/go.mod b/v3/integrations/logcontext/nrlogrusplugin/go.mod index 88b24f5a1..e05ef56ed 100644 --- a/v3/integrations/logcontext/nrlogrusplugin/go.mod +++ b/v3/integrations/logcontext/nrlogrusplugin/go.mod @@ -2,10 +2,13 @@ module github.com/newrelic/go-agent/v3/integrations/logcontext/nrlogrusplugin // As of Dec 2019, the logrus go.mod file uses 1.13: // https://github.com/sirupsen/logrus/blob/master/go.mod -go 1.13 +go 1.19 require ( - github.com/newrelic/go-agent/v3 v3.17.0 + github.com/newrelic/go-agent/v3 v3.24.1 // v1.4.0 is required for for the log.WithContext. github.com/sirupsen/logrus v1.4.0 ) + + +replace github.com/newrelic/go-agent/v3 => ../../.. diff --git a/v3/integrations/nrawssdk-v1/go.mod b/v3/integrations/nrawssdk-v1/go.mod index f8a7c2f13..76366a29e 100644 --- a/v3/integrations/nrawssdk-v1/go.mod +++ b/v3/integrations/nrawssdk-v1/go.mod @@ -3,10 +3,13 @@ module github.com/newrelic/go-agent/v3/integrations/nrawssdk-v1 // As of Dec 2019, aws-sdk-go's go.mod does not specify a Go version. 1.6 is // the earliest version of Go tested by aws-sdk-go's CI: // https://github.com/aws/aws-sdk-go/blob/master/.travis.yml -go 1.7 +go 1.19 require ( // v1.15.0 is the first aws-sdk-go version with module support. github.com/aws/aws-sdk-go v1.34.0 - github.com/newrelic/go-agent/v3 v3.24.0 + github.com/newrelic/go-agent/v3 v3.24.1 ) + + +replace github.com/newrelic/go-agent/v3 => ../.. diff --git a/v3/integrations/nrawssdk-v1/nrawssdk_test.go b/v3/integrations/nrawssdk-v1/nrawssdk_test.go index 79d20d9b0..ae1002bc5 100644 --- a/v3/integrations/nrawssdk-v1/nrawssdk_test.go +++ b/v3/integrations/nrawssdk-v1/nrawssdk_test.go @@ -25,7 +25,7 @@ import ( ) func testApp() integrationsupport.ExpectApp { - return integrationsupport.NewTestApp(integrationsupport.SampleEverythingReplyFn, integrationsupport.DTEnabledCfgFn) + return integrationsupport.NewTestApp(integrationsupport.SampleEverythingReplyFn, integrationsupport.DTEnabledCfgFn, newrelic.ConfigCodeLevelMetricsEnabled(false)) } type fakeTransport struct{} diff --git a/v3/integrations/nrawssdk-v2/go.mod b/v3/integrations/nrawssdk-v2/go.mod index a402d9fbf..d611471b8 100644 --- a/v3/integrations/nrawssdk-v2/go.mod +++ b/v3/integrations/nrawssdk-v2/go.mod @@ -2,7 +2,7 @@ module github.com/newrelic/go-agent/v3/integrations/nrawssdk-v2 // As of May 2021, the aws-sdk-go-v2 go.mod file uses 1.15: // https://github.com/aws/aws-sdk-go-v2/blob/master/go.mod -go 1.17 +go 1.19 require ( github.com/aws/aws-sdk-go-v2 v1.16.15 @@ -11,6 +11,8 @@ require ( github.com/aws/aws-sdk-go-v2/service/lambda v1.24.5 github.com/aws/aws-sdk-go-v2/service/s3 v1.27.10 github.com/aws/smithy-go v1.13.3 - github.com/newrelic/go-agent/v3 v3.24.0 + github.com/newrelic/go-agent/v3 v3.24.1 ) + +replace github.com/newrelic/go-agent/v3 => ../.. diff --git a/v3/integrations/nrawssdk-v2/nrawssdk_test.go b/v3/integrations/nrawssdk-v2/nrawssdk_test.go index c57bba514..79b1f389a 100644 --- a/v3/integrations/nrawssdk-v2/nrawssdk_test.go +++ b/v3/integrations/nrawssdk-v2/nrawssdk_test.go @@ -23,7 +23,7 @@ import ( ) func testApp() integrationsupport.ExpectApp { - return integrationsupport.NewTestApp(integrationsupport.SampleEverythingReplyFn, integrationsupport.DTEnabledCfgFn) + return integrationsupport.NewTestApp(integrationsupport.SampleEverythingReplyFn, integrationsupport.DTEnabledCfgFn, newrelic.ConfigCodeLevelMetricsEnabled(false)) } type fakeTransport struct{} diff --git a/v3/integrations/nrb3/go.mod b/v3/integrations/nrb3/go.mod index 73c540d4e..87dc80d84 100644 --- a/v3/integrations/nrb3/go.mod +++ b/v3/integrations/nrb3/go.mod @@ -2,5 +2,7 @@ module github.com/newrelic/go-agent/v3/integrations/nrb3 go 1.19 -require github.com/newrelic/go-agent/v3 v3.24.0 +require github.com/newrelic/go-agent/v3 v3.24.1 + +replace github.com/newrelic/go-agent/v3 => ../.. diff --git a/v3/integrations/nrecho-v3/go.mod b/v3/integrations/nrecho-v3/go.mod index 5b0d18f5d..c4709c7a4 100644 --- a/v3/integrations/nrecho-v3/go.mod +++ b/v3/integrations/nrecho-v3/go.mod @@ -2,11 +2,14 @@ module github.com/newrelic/go-agent/v3/integrations/nrecho-v3 // 1.7 is the earliest version of Go tested by v3.1.0: // https://github.com/labstack/echo/blob/v3.1.0/.travis.yml -go 1.7 +go 1.19 require ( // v3.1.0 is the earliest v3 version of Echo that works with modules due // to the github.com/rsc/letsencrypt import of v3.0.0. github.com/labstack/echo v3.1.0+incompatible - github.com/newrelic/go-agent/v3 v3.24.0 + github.com/newrelic/go-agent/v3 v3.24.1 ) + + +replace github.com/newrelic/go-agent/v3 => ../.. diff --git a/v3/integrations/nrecho-v3/nrecho_test.go b/v3/integrations/nrecho-v3/nrecho_test.go index 177bda37d..21523398a 100644 --- a/v3/integrations/nrecho-v3/nrecho_test.go +++ b/v3/integrations/nrecho-v3/nrecho_test.go @@ -12,10 +12,11 @@ import ( "github.com/labstack/echo" "github.com/newrelic/go-agent/v3/internal" "github.com/newrelic/go-agent/v3/internal/integrationsupport" + newrelic "github.com/newrelic/go-agent/v3/newrelic" ) func TestBasicRoute(t *testing.T) { - app := integrationsupport.NewBasicTestApp() + app := integrationsupport.NewTestApp(nil, newrelic.ConfigCodeLevelMetricsEnabled(false)) e := echo.New() e.Use(Middleware(app.Application)) @@ -79,7 +80,7 @@ func TestNilApp(t *testing.T) { } func TestTransactionContext(t *testing.T) { - app := integrationsupport.NewBasicTestApp() + app := integrationsupport.NewTestApp(nil, newrelic.ConfigCodeLevelMetricsEnabled(false)) e := echo.New() e.Use(Middleware(app.Application)) @@ -109,7 +110,7 @@ func TestTransactionContext(t *testing.T) { } func TestNotFoundHandler(t *testing.T) { - app := integrationsupport.NewBasicTestApp() + app := integrationsupport.NewTestApp(nil, newrelic.ConfigCodeLevelMetricsEnabled(false)) e := echo.New() e.Use(Middleware(app.Application)) @@ -129,7 +130,7 @@ func TestNotFoundHandler(t *testing.T) { } func TestMethodNotAllowedHandler(t *testing.T) { - app := integrationsupport.NewBasicTestApp() + app := integrationsupport.NewTestApp(nil, newrelic.ConfigCodeLevelMetricsEnabled(false)) e := echo.New() e.Use(Middleware(app.Application)) @@ -154,7 +155,7 @@ func TestMethodNotAllowedHandler(t *testing.T) { } func TestReturnsHTTPError(t *testing.T) { - app := integrationsupport.NewBasicTestApp() + app := integrationsupport.NewTestApp(nil, newrelic.ConfigCodeLevelMetricsEnabled(false)) e := echo.New() e.Use(Middleware(app.Application)) @@ -196,7 +197,7 @@ func TestReturnsHTTPError(t *testing.T) { } func TestReturnsError(t *testing.T) { - app := integrationsupport.NewBasicTestApp() + app := integrationsupport.NewTestApp(nil, newrelic.ConfigCodeLevelMetricsEnabled(false)) e := echo.New() e.Use(Middleware(app.Application)) @@ -238,7 +239,7 @@ func TestReturnsError(t *testing.T) { } func TestResponseCode(t *testing.T) { - app := integrationsupport.NewBasicTestApp() + app := integrationsupport.NewTestApp(nil, newrelic.ConfigCodeLevelMetricsEnabled(false)) e := echo.New() e.Use(Middleware(app.Application)) diff --git a/v3/integrations/nrecho-v4/go.mod b/v3/integrations/nrecho-v4/go.mod index c109c0738..93fee962f 100644 --- a/v3/integrations/nrecho-v4/go.mod +++ b/v3/integrations/nrecho-v4/go.mod @@ -2,10 +2,12 @@ module github.com/newrelic/go-agent/v3/integrations/nrecho-v4 // As of Jun 2022, the echo go.mod file uses 1.17: // https://github.com/labstack/echo/blob/master/go.mod -go 1.17 +go 1.19 require ( github.com/labstack/echo/v4 v4.9.0 - github.com/newrelic/go-agent/v3 v3.24.0 + github.com/newrelic/go-agent/v3 v3.24.1 ) + +replace github.com/newrelic/go-agent/v3 => ../.. diff --git a/v3/integrations/nrecho-v4/nrecho_test.go b/v3/integrations/nrecho-v4/nrecho_test.go index 1a0debab2..70659d17a 100644 --- a/v3/integrations/nrecho-v4/nrecho_test.go +++ b/v3/integrations/nrecho-v4/nrecho_test.go @@ -12,10 +12,11 @@ import ( "github.com/labstack/echo/v4" "github.com/newrelic/go-agent/v3/internal" "github.com/newrelic/go-agent/v3/internal/integrationsupport" + newrelic "github.com/newrelic/go-agent/v3/newrelic" ) func TestBasicRoute(t *testing.T) { - app := integrationsupport.NewBasicTestApp() + app := integrationsupport.NewTestApp(nil, newrelic.ConfigCodeLevelMetricsEnabled(false)) e := echo.New() e.Use(Middleware(app.Application)) @@ -61,7 +62,7 @@ func TestBasicRoute(t *testing.T) { } func TestSkipper(t *testing.T) { - app := integrationsupport.NewBasicTestApp() + app := integrationsupport.NewTestApp(nil, newrelic.ConfigCodeLevelMetricsEnabled(false)) e := echo.New() skipper := func(c echo.Context) bool { @@ -144,7 +145,7 @@ func TestNilApp(t *testing.T) { } func TestTransactionContext(t *testing.T) { - app := integrationsupport.NewBasicTestApp() + app := integrationsupport.NewTestApp(nil, newrelic.ConfigCodeLevelMetricsEnabled(false)) e := echo.New() e.Use(Middleware(app.Application)) @@ -174,7 +175,7 @@ func TestTransactionContext(t *testing.T) { } func TestNotFoundHandler(t *testing.T) { - app := integrationsupport.NewBasicTestApp() + app := integrationsupport.NewTestApp(nil, newrelic.ConfigCodeLevelMetricsEnabled(false)) e := echo.New() e.Use(Middleware(app.Application)) @@ -194,7 +195,7 @@ func TestNotFoundHandler(t *testing.T) { } func TestMethodNotAllowedHandler(t *testing.T) { - app := integrationsupport.NewBasicTestApp() + app := integrationsupport.NewTestApp(nil, newrelic.ConfigCodeLevelMetricsEnabled(false)) e := echo.New() e.Use(Middleware(app.Application)) @@ -219,7 +220,7 @@ func TestMethodNotAllowedHandler(t *testing.T) { } func TestReturnsHTTPError(t *testing.T) { - app := integrationsupport.NewBasicTestApp() + app := integrationsupport.NewTestApp(nil, newrelic.ConfigCodeLevelMetricsEnabled(false)) e := echo.New() e.Use(Middleware(app.Application)) @@ -261,7 +262,7 @@ func TestReturnsHTTPError(t *testing.T) { } func TestReturnsError(t *testing.T) { - app := integrationsupport.NewBasicTestApp() + app := integrationsupport.NewTestApp(nil, newrelic.ConfigCodeLevelMetricsEnabled(false)) e := echo.New() e.Use(Middleware(app.Application)) @@ -303,7 +304,7 @@ func TestReturnsError(t *testing.T) { } func TestResponseCode(t *testing.T) { - app := integrationsupport.NewBasicTestApp() + app := integrationsupport.NewTestApp(nil, newrelic.ConfigCodeLevelMetricsEnabled(false)) e := echo.New() e.Use(Middleware(app.Application)) diff --git a/v3/integrations/nrelasticsearch-v7/go.mod b/v3/integrations/nrelasticsearch-v7/go.mod index 08ed46193..54a4c4fbe 100644 --- a/v3/integrations/nrelasticsearch-v7/go.mod +++ b/v3/integrations/nrelasticsearch-v7/go.mod @@ -2,9 +2,12 @@ module github.com/newrelic/go-agent/v3/integrations/nrelasticsearch-v7 // As of Jan 2020, the v7 elasticsearch go.mod uses 1.11: // https://github.com/elastic/go-elasticsearch/blob/7.x/go.mod -go 1.11 +go 1.19 require ( github.com/elastic/go-elasticsearch/v7 v7.17.0 - github.com/newrelic/go-agent/v3 v3.24.0 + github.com/newrelic/go-agent/v3 v3.24.1 ) + + +replace github.com/newrelic/go-agent/v3 => ../.. diff --git a/v3/integrations/nrgin/go.mod b/v3/integrations/nrgin/go.mod index ceb2fdb46..369dd7a08 100644 --- a/v3/integrations/nrgin/go.mod +++ b/v3/integrations/nrgin/go.mod @@ -6,7 +6,7 @@ go 1.19 require ( github.com/gin-gonic/gin v1.9.1 - github.com/newrelic/go-agent/v3 v3.24.0 + github.com/newrelic/go-agent/v3 v3.24.1 ) diff --git a/v3/integrations/nrgorilla/go.mod b/v3/integrations/nrgorilla/go.mod index 9ecc2efd2..41b9e7e56 100644 --- a/v3/integrations/nrgorilla/go.mod +++ b/v3/integrations/nrgorilla/go.mod @@ -2,10 +2,13 @@ module github.com/newrelic/go-agent/v3/integrations/nrgorilla // As of Dec 2019, the gorilla/mux go.mod file uses 1.12: // https://github.com/gorilla/mux/blob/master/go.mod -go 1.12 +go 1.19 require ( // v1.7.0 is the earliest version of Gorilla using modules. github.com/gorilla/mux v1.7.0 - github.com/newrelic/go-agent/v3 v3.24.0 + github.com/newrelic/go-agent/v3 v3.24.1 ) + + +replace github.com/newrelic/go-agent/v3 => ../.. diff --git a/v3/integrations/nrgraphgophers/go.mod b/v3/integrations/nrgraphgophers/go.mod index b9e6ede4e..e599d6646 100644 --- a/v3/integrations/nrgraphgophers/go.mod +++ b/v3/integrations/nrgraphgophers/go.mod @@ -2,10 +2,13 @@ module github.com/newrelic/go-agent/v3/integrations/nrgraphgophers // As of Jan 2020, the graphql-go go.mod file uses 1.13: // https://github.com/graph-gophers/graphql-go/blob/master/go.mod -go 1.13 +go 1.19 require ( // graphql-go has no tagged releases as of Jan 2020. github.com/graph-gophers/graphql-go v1.3.0 - github.com/newrelic/go-agent/v3 v3.24.0 + github.com/newrelic/go-agent/v3 v3.24.1 ) + + +replace github.com/newrelic/go-agent/v3 => ../.. diff --git a/v3/integrations/nrgraphqlgo/example/go.mod b/v3/integrations/nrgraphqlgo/example/go.mod index 997c1206d..b3993842a 100644 --- a/v3/integrations/nrgraphqlgo/example/go.mod +++ b/v3/integrations/nrgraphqlgo/example/go.mod @@ -1,10 +1,10 @@ module github.com/newrelic/go-agent/v3/integrations/nrgraphqlgo/example -go 1.13 +go 1.19 require ( github.com/graphql-go/graphql v0.7.9 github.com/graphql-go/graphql-go-handler v0.2.3 - github.com/newrelic/go-agent/v3 v3.3.0 + github.com/newrelic/go-agent/v3 v3.24.1 github.com/newrelic/go-agent/v3/integrations/nrgraphqlgo v1.0.0 ) -replace github.com/newrelic/go-agent/v3 => ../../../ replace github.com/newrelic/go-agent/v3/integrations/nrgraphqlgo => ../ +replace github.com/newrelic/go-agent/v3 => ../../.. diff --git a/v3/integrations/nrgraphqlgo/go.mod b/v3/integrations/nrgraphqlgo/go.mod index a6fa0aff4..b400e34b6 100644 --- a/v3/integrations/nrgraphqlgo/go.mod +++ b/v3/integrations/nrgraphqlgo/go.mod @@ -1,8 +1,11 @@ module github.com/newrelic/go-agent/v3/integrations/nrgraphqlgo -go 1.13 +go 1.19 require ( github.com/graphql-go/graphql v0.7.9 - github.com/newrelic/go-agent/v3 v3.24.0 + github.com/newrelic/go-agent/v3 v3.24.1 ) + + +replace github.com/newrelic/go-agent/v3 => ../.. diff --git a/v3/integrations/nrgrpc/go.mod b/v3/integrations/nrgrpc/go.mod index a6f19bf5b..c9c1a2e1a 100644 --- a/v3/integrations/nrgrpc/go.mod +++ b/v3/integrations/nrgrpc/go.mod @@ -6,7 +6,7 @@ require ( // protobuf v1.3.0 is the earliest version using modules, we use v1.3.1 // because all dependencies were removed in this version. github.com/golang/protobuf v1.5.3 - github.com/newrelic/go-agent/v3 v3.24.0 + github.com/newrelic/go-agent/v3 v3.24.1 github.com/newrelic/go-agent/v3/integrations/nrsecurityagent v1.1.0 // v1.15.0 is the earliest version of grpc using modules. google.golang.org/grpc v1.54.0 diff --git a/v3/integrations/nrhttprouter/go.mod b/v3/integrations/nrhttprouter/go.mod index 0824ceea2..16b02cc00 100644 --- a/v3/integrations/nrhttprouter/go.mod +++ b/v3/integrations/nrhttprouter/go.mod @@ -2,10 +2,13 @@ module github.com/newrelic/go-agent/v3/integrations/nrhttprouter // As of Dec 2019, the httprouter go.mod file uses 1.7: // https://github.com/julienschmidt/httprouter/blob/master/go.mod -go 1.7 +go 1.19 require ( // v1.3.0 is the earliest version of httprouter using modules. github.com/julienschmidt/httprouter v1.3.0 - github.com/newrelic/go-agent/v3 v3.24.0 + github.com/newrelic/go-agent/v3 v3.24.1 ) + + +replace github.com/newrelic/go-agent/v3 => ../.. diff --git a/v3/integrations/nrhttprouter/nrhttprouter_test.go b/v3/integrations/nrhttprouter/nrhttprouter_test.go index a267fed72..e9138f3d5 100644 --- a/v3/integrations/nrhttprouter/nrhttprouter_test.go +++ b/v3/integrations/nrhttprouter/nrhttprouter_test.go @@ -31,7 +31,7 @@ func TestMethodFunctions(t *testing.T) { } for _, md := range methodFuncs { - app := integrationsupport.NewBasicTestApp() + app := integrationsupport.NewTestApp(nil, newrelic.ConfigCodeLevelMetricsEnabled(false)) router := New(app.Application) md.Fn(router)("/hello/:name", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { // Test that the Transaction is used as the response writer. @@ -75,7 +75,7 @@ func TestGetNoApplication(t *testing.T) { } func TestHandle(t *testing.T) { - app := integrationsupport.NewBasicTestApp() + app := integrationsupport.NewTestApp(nil, newrelic.ConfigCodeLevelMetricsEnabled(false)) router := New(app.Application) router.Handle("GET", "/hello/:name", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { @@ -126,7 +126,7 @@ func TestHandle(t *testing.T) { } func TestHandler(t *testing.T) { - app := integrationsupport.NewBasicTestApp() + app := integrationsupport.NewTestApp(nil, newrelic.ConfigCodeLevelMetricsEnabled(false)) router := New(app.Application) router.Handler("GET", "/hello/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { @@ -195,7 +195,7 @@ func TestHandlerMissingApplication(t *testing.T) { } func TestHandlerFunc(t *testing.T) { - app := integrationsupport.NewBasicTestApp() + app := integrationsupport.NewTestApp(nil, newrelic.ConfigCodeLevelMetricsEnabled(false)) router := New(app.Application) router.HandlerFunc("GET", "/hello/", func(w http.ResponseWriter, r *http.Request) { @@ -222,7 +222,7 @@ func TestHandlerFunc(t *testing.T) { } func TestNotFound(t *testing.T) { - app := integrationsupport.NewBasicTestApp() + app := integrationsupport.NewTestApp(nil, newrelic.ConfigCodeLevelMetricsEnabled(false)) router := New(app.Application) router.NotFound = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { @@ -292,7 +292,7 @@ func TestNotFoundMissingApplication(t *testing.T) { } func TestNotFoundNotSet(t *testing.T) { - app := integrationsupport.NewBasicTestApp() + app := integrationsupport.NewTestApp(nil, newrelic.ConfigCodeLevelMetricsEnabled(false)) router := New(app.Application) response := httptest.NewRecorder() diff --git a/v3/integrations/nrlambda/go.mod b/v3/integrations/nrlambda/go.mod index e16beae91..e95062b69 100644 --- a/v3/integrations/nrlambda/go.mod +++ b/v3/integrations/nrlambda/go.mod @@ -1,9 +1,11 @@ module github.com/newrelic/go-agent/v3/integrations/nrlambda -go 1.18 +go 1.19 require ( github.com/aws/aws-lambda-go v1.41.0 - github.com/newrelic/go-agent/v3 v3.24.0 + github.com/newrelic/go-agent/v3 v3.24.1 ) + +replace github.com/newrelic/go-agent/v3 => ../.. diff --git a/v3/integrations/nrlambda/handler_test.go b/v3/integrations/nrlambda/handler_test.go index 1b7afff12..ae8e2922c 100644 --- a/v3/integrations/nrlambda/handler_test.go +++ b/v3/integrations/nrlambda/handler_test.go @@ -26,7 +26,7 @@ func testApp(getenv func(string) string, t *testing.T) *newrelic.Application { } cfg := newConfigInternal(getenv) - app, err := newrelic.NewApplication(cfg) + app, err := newrelic.NewApplication(cfg, newrelic.ConfigCodeLevelMetricsEnabled(false)) if nil != err { t.Fatal(err) } diff --git a/v3/integrations/nrlogrus/go.mod b/v3/integrations/nrlogrus/go.mod index b7af83629..065faeda8 100644 --- a/v3/integrations/nrlogrus/go.mod +++ b/v3/integrations/nrlogrus/go.mod @@ -2,12 +2,14 @@ module github.com/newrelic/go-agent/v3/integrations/nrlogrus // As of Dec 2019, the logrus go.mod file uses 1.13: // https://github.com/sirupsen/logrus/blob/master/go.mod -go 1.18 +go 1.19 require ( - github.com/newrelic/go-agent/v3 v3.24.0 + github.com/newrelic/go-agent/v3 v3.24.1 // v1.1.0 is required for the Logger.GetLevel method, and is the earliest // version of logrus using modules. github.com/sirupsen/logrus v1.1.0 ) + +replace github.com/newrelic/go-agent/v3 => ../.. diff --git a/v3/integrations/nrlogxi/go.mod b/v3/integrations/nrlogxi/go.mod index ded8f5d5f..2d94808a4 100644 --- a/v3/integrations/nrlogxi/go.mod +++ b/v3/integrations/nrlogxi/go.mod @@ -2,11 +2,13 @@ module github.com/newrelic/go-agent/v3/integrations/nrlogxi // As of Dec 2019, logxi requires 1.3+: // https://github.com/mgutz/logxi#requirements -go 1.18 +go 1.19 require ( // 'v1', at commit aebf8a7d67ab, is the only logxi release. github.com/mgutz/logxi v0.0.0-20161027140823-aebf8a7d67ab - github.com/newrelic/go-agent/v3 v3.24.0 + github.com/newrelic/go-agent/v3 v3.24.1 ) + +replace github.com/newrelic/go-agent/v3 => ../.. diff --git a/v3/integrations/nrmicro/go.mod b/v3/integrations/nrmicro/go.mod index ca64a4b25..517cc9a51 100644 --- a/v3/integrations/nrmicro/go.mod +++ b/v3/integrations/nrmicro/go.mod @@ -7,7 +7,7 @@ go 1.19 require ( github.com/golang/protobuf v1.5.3 github.com/micro/go-micro v1.8.0 - github.com/newrelic/go-agent/v3 v3.24.0 + github.com/newrelic/go-agent/v3 v3.24.1 ) diff --git a/v3/integrations/nrmongo/go.mod b/v3/integrations/nrmongo/go.mod index a4418c430..b29aeadf5 100644 --- a/v3/integrations/nrmongo/go.mod +++ b/v3/integrations/nrmongo/go.mod @@ -5,7 +5,7 @@ module github.com/newrelic/go-agent/v3/integrations/nrmongo go 1.19 require ( - github.com/newrelic/go-agent/v3 v3.24.0 + github.com/newrelic/go-agent/v3 v3.24.1 // mongo-driver does not support modules as of Nov 2019. go.mongodb.org/mongo-driver v1.10.2 ) diff --git a/v3/integrations/nrmongo/nrmongo.go b/v3/integrations/nrmongo/nrmongo.go index 206a46983..ef7bd6b71 100644 --- a/v3/integrations/nrmongo/nrmongo.go +++ b/v3/integrations/nrmongo/nrmongo.go @@ -89,6 +89,8 @@ func NewCommandMonitor(original *event.CommandMonitor) *event.CommandMonitor { } func (m *mongoMonitor) started(ctx context.Context, e *event.CommandStartedEvent) { + var secureAgentEvent any + if m.origCommMon != nil && m.origCommMon.Started != nil { m.origCommMon.Started(ctx, e) } @@ -96,7 +98,10 @@ func (m *mongoMonitor) started(ctx context.Context, e *event.CommandStartedEvent if txn == nil { return } - secureAgentEvent := newrelic.GetSecurityAgentInterface().SendEvent("MONGO", getJsonQuery(e.Command), e.CommandName) + if newrelic.IsSecurityAgentPresent() { + secureAgentEvent = newrelic.GetSecurityAgentInterface().SendEvent("MONGO", getJsonQuery(e.Command), e.CommandName) + } + host, port := calcHostAndPort(e.ConnectionID) sgmt := newrelic.DatastoreSegment{ StartTime: txn.StartSegmentNow(), @@ -107,7 +112,9 @@ func (m *mongoMonitor) started(ctx context.Context, e *event.CommandStartedEvent PortPathOrID: port, DatabaseName: e.DatabaseName, } - sgmt.SetSecureAgentEvent(secureAgentEvent) + if newrelic.IsSecurityAgentPresent() { + sgmt.SetSecureAgentEvent(secureAgentEvent) + } m.addSgmt(e, &sgmt) } @@ -124,9 +131,10 @@ func (m *mongoMonitor) addSgmt(e *event.CommandStartedEvent, sgmt *newrelic.Data } func (m *mongoMonitor) succeeded(ctx context.Context, e *event.CommandSucceededEvent) { - if sgmt := m.getSgmt(e.RequestID); sgmt != nil { + if sgmt := m.getSgmt(e.RequestID); sgmt != nil && newrelic.IsSecurityAgentPresent() { newrelic.GetSecurityAgentInterface().SendExitEvent(sgmt.GetSecureAgentEvent(), nil) } + m.endSgmtIfExists(e.RequestID) if m.origCommMon != nil && m.origCommMon.Succeeded != nil { m.origCommMon.Succeeded(ctx, e) diff --git a/v3/integrations/nrmssql/go.mod b/v3/integrations/nrmssql/go.mod index 0430a7b7f..b1ab6a925 100644 --- a/v3/integrations/nrmssql/go.mod +++ b/v3/integrations/nrmssql/go.mod @@ -1,9 +1,11 @@ module github.com/newrelic/go-agent/v3/integrations/nrmssql -go 1.17 +go 1.19 require ( github.com/microsoft/go-mssqldb v0.19.0 - github.com/newrelic/go-agent/v3 v3.24.0 + github.com/newrelic/go-agent/v3 v3.24.1 ) + +replace github.com/newrelic/go-agent/v3 => ../.. diff --git a/v3/integrations/nrmysql/go.mod b/v3/integrations/nrmysql/go.mod index 703f5fa74..b40b1b208 100644 --- a/v3/integrations/nrmysql/go.mod +++ b/v3/integrations/nrmysql/go.mod @@ -1,12 +1,13 @@ module github.com/newrelic/go-agent/v3/integrations/nrmysql // 1.10 is the Go version in mysql's go.mod -go 1.17 +go 1.19 require ( // v1.5.0 is the first mysql version to support gomod github.com/go-sql-driver/mysql v1.6.0 // v3.3.0 includes the new location of ParseQuery - github.com/newrelic/go-agent/v3 v3.24.0 + github.com/newrelic/go-agent/v3 v3.24.1 ) +replace github.com/newrelic/go-agent/v3 => ../.. diff --git a/v3/integrations/nrnats/go.mod b/v3/integrations/nrnats/go.mod index 79d3f9d4e..c44399cd0 100644 --- a/v3/integrations/nrnats/go.mod +++ b/v3/integrations/nrnats/go.mod @@ -6,7 +6,9 @@ go 1.19 require ( github.com/nats-io/nats-server v1.4.1 - github.com/nats-io/nats.go v1.25.0 - github.com/newrelic/go-agent/v3 v3.24.0 + github.com/nats-io/nats.go v1.28.0 + github.com/newrelic/go-agent/v3 v3.24.1 ) + +replace github.com/newrelic/go-agent/v3 => ../.. diff --git a/v3/integrations/nrnats/nrnats_test.go b/v3/integrations/nrnats/nrnats_test.go index c72db78a2..c044d2f52 100644 --- a/v3/integrations/nrnats/nrnats_test.go +++ b/v3/integrations/nrnats/nrnats_test.go @@ -4,15 +4,16 @@ package nrnats import ( + "os" + "sync" + "testing" + "time" + "github.com/nats-io/nats-server/test" nats "github.com/nats-io/nats.go" "github.com/newrelic/go-agent/v3/internal" "github.com/newrelic/go-agent/v3/internal/integrationsupport" newrelic "github.com/newrelic/go-agent/v3/newrelic" - "os" - "sync" - "testing" - "time" ) func TestMain(m *testing.M) { @@ -22,7 +23,7 @@ func TestMain(m *testing.M) { } func testApp() integrationsupport.ExpectApp { - return integrationsupport.NewTestApp(integrationsupport.SampleEverythingReplyFn, integrationsupport.ConfigFullTraces, cfgFn) + return integrationsupport.NewTestApp(integrationsupport.SampleEverythingReplyFn, integrationsupport.ConfigFullTraces, cfgFn, newrelic.ConfigCodeLevelMetricsEnabled(false)) } var cfgFn = func(cfg *newrelic.Config) { diff --git a/v3/integrations/nrnats/test/go.mod b/v3/integrations/nrnats/test/go.mod index 5399de524..25f8ba71d 100644 --- a/v3/integrations/nrnats/test/go.mod +++ b/v3/integrations/nrnats/test/go.mod @@ -1,11 +1,15 @@ module github.com/newrelic/go-agent/v3/integrations/test + // This module exists to avoid having extra nrnats module dependencies. -go 1.17 +go 1.19 + replace github.com/newrelic/go-agent/v3/integrations/nrnats v1.0.0 => ../ -replace github.com/newrelic/go-agent/v3 v3.18.2 => ../../../ + require ( github.com/nats-io/nats-server v1.4.1 github.com/nats-io/nats.go v1.17.0 - github.com/newrelic/go-agent/v3 v3.18.2 + github.com/newrelic/go-agent/v3 v3.24.1 github.com/newrelic/go-agent/v3/integrations/nrnats v1.0.0 ) + +replace github.com/newrelic/go-agent/v3 => ../../.. diff --git a/v3/integrations/nrpgx/example/sqlx/go.mod b/v3/integrations/nrpgx/example/sqlx/go.mod index d7872841a..afbaf8901 100644 --- a/v3/integrations/nrpgx/example/sqlx/go.mod +++ b/v3/integrations/nrpgx/example/sqlx/go.mod @@ -1,11 +1,11 @@ // This sqlx example is a separate module to avoid adding sqlx dependency to the // nrpgx go.mod file. module github.com/newrelic/go-agent/v3/integrations/nrpgx/example/sqlx -go 1.13 +go 1.19 require ( github.com/jmoiron/sqlx v1.2.0 - github.com/newrelic/go-agent/v3 v3.3.0 + github.com/newrelic/go-agent/v3 v3.24.1 github.com/newrelic/go-agent/v3/integrations/nrpgx v0.0.0 ) -replace github.com/newrelic/go-agent/v3 => ../../../../ replace github.com/newrelic/go-agent/v3/integrations/nrpgx => ../../ +replace github.com/newrelic/go-agent/v3 => ../../../.. diff --git a/v3/integrations/nrpgx/go.mod b/v3/integrations/nrpgx/go.mod index 8cd35d84f..ffd24993f 100644 --- a/v3/integrations/nrpgx/go.mod +++ b/v3/integrations/nrpgx/go.mod @@ -1,12 +1,12 @@ module github.com/newrelic/go-agent/v3/integrations/nrpgx -// As of Dec 2019, go 1.11 is the earliest version of Go tested by lib/pq: -// https://github.com/lib/pq/blob/master/.travis.yml -go 1.18 +go 1.19 require ( github.com/jackc/pgx v3.6.2+incompatible github.com/jackc/pgx/v4 v4.13.0 - github.com/newrelic/go-agent/v3 v3.3.0 + github.com/newrelic/go-agent/v3 v3.24.1 ) + +replace github.com/newrelic/go-agent/v3 => ../.. diff --git a/v3/integrations/nrpgx5/go.mod b/v3/integrations/nrpgx5/go.mod index cd31aa936..0e99693dd 100644 --- a/v3/integrations/nrpgx5/go.mod +++ b/v3/integrations/nrpgx5/go.mod @@ -1,11 +1,13 @@ module github.com/newrelic/go-agent/v3/integrations/nrpgx5 -go 1.18 +go 1.19 require ( github.com/egon12/pgsnap v0.0.0-20221022154027-2847f0124ed8 github.com/jackc/pgx/v5 v5.0.3 - github.com/newrelic/go-agent/v3 v3.24.0 + github.com/newrelic/go-agent/v3 v3.24.1 github.com/stretchr/testify v1.8.0 ) + +replace github.com/newrelic/go-agent/v3 => ../.. diff --git a/v3/integrations/nrpkgerrors/go.mod b/v3/integrations/nrpkgerrors/go.mod index f4fde7818..fe7e7d804 100644 --- a/v3/integrations/nrpkgerrors/go.mod +++ b/v3/integrations/nrpkgerrors/go.mod @@ -2,11 +2,14 @@ module github.com/newrelic/go-agent/v3/integrations/nrpkgerrors // As of Dec 2019, 1.11 is the earliest version of Go tested by pkg/errors: // https://github.com/pkg/errors/blob/master/.travis.yml -go 1.11 +go 1.19 require ( - github.com/newrelic/go-agent/v3 v3.24.0 + github.com/newrelic/go-agent/v3 v3.24.1 // v0.8.0 was the last release in 2016, and when // major development on pkg/errors stopped. github.com/pkg/errors v0.8.0 ) + + +replace github.com/newrelic/go-agent/v3 => ../.. diff --git a/v3/integrations/nrpq/example/sqlx/go.mod b/v3/integrations/nrpq/example/sqlx/go.mod index 00c17a4c8..1a285c05d 100644 --- a/v3/integrations/nrpq/example/sqlx/go.mod +++ b/v3/integrations/nrpq/example/sqlx/go.mod @@ -1,12 +1,12 @@ // This sqlx example is a separate module to avoid adding sqlx dependency to the // nrpq go.mod file. module github.com/newrelic/go-agent/v3/integrations/nrpq/example/sqlx -go 1.13 +go 1.19 require ( github.com/jmoiron/sqlx v1.2.0 github.com/lib/pq v1.1.0 - github.com/newrelic/go-agent/v3 v3.3.0 + github.com/newrelic/go-agent/v3 v3.24.1 github.com/newrelic/go-agent/v3/integrations/nrpq v0.0.0 ) -replace github.com/newrelic/go-agent/v3 => ../../../../ replace github.com/newrelic/go-agent/v3/integrations/nrpq => ../../ +replace github.com/newrelic/go-agent/v3 => ../../../.. diff --git a/v3/integrations/nrpq/go.mod b/v3/integrations/nrpq/go.mod index 6df247b83..359be4df9 100644 --- a/v3/integrations/nrpq/go.mod +++ b/v3/integrations/nrpq/go.mod @@ -1,14 +1,13 @@ module github.com/newrelic/go-agent/v3/integrations/nrpq -// As of Dec 2019, go 1.11 is the earliest version of Go tested by lib/pq: -// https://github.com/lib/pq/blob/master/.travis.yml -go 1.11 +go 1.19 require ( // NewConnector dsn parsing tests expect v1.1.0 error return behavior. github.com/lib/pq v1.1.0 // v3.3.0 includes the new location of ParseQuery - github.com/newrelic/go-agent/v3 v3.3.0 + github.com/newrelic/go-agent/v3 v3.24.1 ) + replace github.com/newrelic/go-agent/v3 => ../.. diff --git a/v3/integrations/nrredis-v7/go.mod b/v3/integrations/nrredis-v7/go.mod index 92cc140ff..63840c5de 100644 --- a/v3/integrations/nrredis-v7/go.mod +++ b/v3/integrations/nrredis-v7/go.mod @@ -1,10 +1,12 @@ module github.com/newrelic/go-agent/v3/integrations/nrredis-v7 -// As of Jan 2020, go 1.11 is in the go-redis go.mod file: // https://github.com/go-redis/redis/blob/master/go.mod -go 1.11 +go 1.19 require ( github.com/go-redis/redis/v7 v7.0.0-beta.5 - github.com/newrelic/go-agent/v3 v3.24.0 + github.com/newrelic/go-agent/v3 v3.24.1 ) + + +replace github.com/newrelic/go-agent/v3 => ../.. diff --git a/v3/integrations/nrredis-v8/go.mod b/v3/integrations/nrredis-v8/go.mod index c3f45b3b4..249d7c69c 100644 --- a/v3/integrations/nrredis-v8/go.mod +++ b/v3/integrations/nrredis-v8/go.mod @@ -1,10 +1,12 @@ module github.com/newrelic/go-agent/v3/integrations/nrredis-v8 -// As of Jan 2020, go 1.11 is in the go-redis go.mod file: // https://github.com/go-redis/redis/blob/master/go.mod -go 1.11 +go 1.19 require ( github.com/go-redis/redis/v8 v8.4.0 - github.com/newrelic/go-agent/v3 v3.24.0 + github.com/newrelic/go-agent/v3 v3.24.1 ) + + +replace github.com/newrelic/go-agent/v3 => ../.. diff --git a/v3/integrations/nrredis-v8/nrredis_test.go b/v3/integrations/nrredis-v8/nrredis_test.go index 9cadb1aa3..58973dc67 100644 --- a/v3/integrations/nrredis-v8/nrredis_test.go +++ b/v3/integrations/nrredis-v8/nrredis_test.go @@ -44,6 +44,8 @@ func TestPing(t *testing.T) { {Name: "Datastore/Redis/allOther", Forced: nil}, {Name: "Datastore/operation/Redis/ping", Forced: nil}, {Name: "Datastore/operation/Redis/ping", Scope: "OtherTransaction/Go/txnName", Forced: nil}, + {Name: "DurationByCaller/Unknown/Unknown/Unknown/Unknown/all", Forced: nil}, + {Name: "DurationByCaller/Unknown/Unknown/Unknown/Unknown/allOther", Forced: nil}, }) } @@ -74,6 +76,8 @@ func TestPingWithOptionsAndAddress(t *testing.T) { {Name: "Datastore/instance/Redis/myhost/myport", Forced: nil}, {Name: "Datastore/operation/Redis/ping", Forced: nil}, {Name: "Datastore/operation/Redis/ping", Scope: "OtherTransaction/Go/txnName", Forced: nil}, + {Name: "DurationByCaller/Unknown/Unknown/Unknown/Unknown/all", Forced: nil}, + {Name: "DurationByCaller/Unknown/Unknown/Unknown/Unknown/allOther", Forced: nil}, }) } diff --git a/v3/integrations/nrredis-v9/go.mod b/v3/integrations/nrredis-v9/go.mod index 3f3e87800..cd54f7ab4 100644 --- a/v3/integrations/nrredis-v9/go.mod +++ b/v3/integrations/nrredis-v9/go.mod @@ -1,11 +1,12 @@ module github.com/newrelic/go-agent/v3/integrations/nrredis-v9 -// As of Mar 2023, go 1.17 is in the go-redis go.mod file: // https://github.com/redis/go-redis/blob/a38f75b640398bd709ee46c778a23e80e09d48b5/go.mod#L3 -go 1.17 +go 1.19 require ( - github.com/newrelic/go-agent/v3 v3.24.0 + github.com/newrelic/go-agent/v3 v3.24.1 github.com/redis/go-redis/v9 v9.0.2 ) + +replace github.com/newrelic/go-agent/v3 => ../.. diff --git a/v3/integrations/nrsarama/go.mod b/v3/integrations/nrsarama/go.mod index be15a07de..dde9f9011 100644 --- a/v3/integrations/nrsarama/go.mod +++ b/v3/integrations/nrsarama/go.mod @@ -4,7 +4,9 @@ go 1.19 require ( github.com/Shopify/sarama v1.38.1 - github.com/newrelic/go-agent/v3 v3.24.0 + github.com/newrelic/go-agent/v3 v3.24.1 github.com/stretchr/testify v1.8.1 ) + +replace github.com/newrelic/go-agent/v3 => ../.. diff --git a/v3/integrations/nrsecurityagent/go.mod b/v3/integrations/nrsecurityagent/go.mod index 5f6d461ea..2e805f3b8 100644 --- a/v3/integrations/nrsecurityagent/go.mod +++ b/v3/integrations/nrsecurityagent/go.mod @@ -4,7 +4,7 @@ go 1.19 require ( github.com/newrelic/csec-go-agent v0.3.0 - github.com/newrelic/go-agent/v3 v3.24.0 + github.com/newrelic/go-agent/v3 v3.24.1 github.com/newrelic/go-agent/v3/integrations/nrsqlite3 v1.2.0 gopkg.in/yaml.v2 v2.4.0 ) diff --git a/v3/integrations/nrsnowflake/go.mod b/v3/integrations/nrsnowflake/go.mod index 29524853c..18eef2db6 100644 --- a/v3/integrations/nrsnowflake/go.mod +++ b/v3/integrations/nrsnowflake/go.mod @@ -1,9 +1,11 @@ module github.com/newrelic/go-agent/v3/integrations/nrsnowflake -go 1.18 +go 1.19 require ( - github.com/newrelic/go-agent/v3 v3.24.0 + github.com/newrelic/go-agent/v3 v3.24.1 github.com/snowflakedb/gosnowflake v1.6.19 ) + +replace github.com/newrelic/go-agent/v3 => ../.. diff --git a/v3/integrations/nrsqlite3/go.mod b/v3/integrations/nrsqlite3/go.mod index d8ca907c1..4b8596e25 100644 --- a/v3/integrations/nrsqlite3/go.mod +++ b/v3/integrations/nrsqlite3/go.mod @@ -2,10 +2,13 @@ module github.com/newrelic/go-agent/v3/integrations/nrsqlite3 // As of Dec 2019, 1.9 is the oldest version of Go tested by go-sqlite3: // https://github.com/mattn/go-sqlite3/blob/master/.travis.yml -go 1.9 +go 1.19 require ( github.com/mattn/go-sqlite3 v1.0.0 // v3.3.0 includes the new location of ParseQuery - github.com/newrelic/go-agent/v3 v3.24.0 + github.com/newrelic/go-agent/v3 v3.24.1 ) + + +replace github.com/newrelic/go-agent/v3 => ../.. diff --git a/v3/integrations/nrstan/examples/go.mod b/v3/integrations/nrstan/examples/go.mod index baf9a40bd..cf57fbccd 100644 --- a/v3/integrations/nrstan/examples/go.mod +++ b/v3/integrations/nrstan/examples/go.mod @@ -1,12 +1,12 @@ module github.com/newrelic/go-agent/v3/integrations/nrstan/examples // This module exists to avoid a dependency on nrnrats. -go 1.13 +go 1.19 require ( github.com/nats-io/stan.go v0.5.0 - github.com/newrelic/go-agent/v3 v3.4.0 + github.com/newrelic/go-agent/v3 v3.24.1 github.com/newrelic/go-agent/v3/integrations/nrnats v0.0.0 github.com/newrelic/go-agent/v3/integrations/nrstan v0.0.0 ) -replace github.com/newrelic/go-agent/v3 => ../../../ replace github.com/newrelic/go-agent/v3/integrations/nrstan => ../ replace github.com/newrelic/go-agent/v3/integrations/nrnats => ../../nrnats/ +replace github.com/newrelic/go-agent/v3 => ../../.. diff --git a/v3/integrations/nrstan/go.mod b/v3/integrations/nrstan/go.mod index 2f8c61ca5..f79d32ddf 100644 --- a/v3/integrations/nrstan/go.mod +++ b/v3/integrations/nrstan/go.mod @@ -2,10 +2,12 @@ module github.com/newrelic/go-agent/v3/integrations/nrstan // As of Dec 2019, 1.11 is the earliest Go version tested by Stan: // https://github.com/nats-io/stan.go/blob/master/.travis.yml -go 1.18 +go 1.19 require ( github.com/nats-io/stan.go v0.10.4 - github.com/newrelic/go-agent/v3 v3.24.0 + github.com/newrelic/go-agent/v3 v3.24.1 ) + +replace github.com/newrelic/go-agent/v3 => ../.. diff --git a/v3/integrations/nrstan/test/go.mod b/v3/integrations/nrstan/test/go.mod index ef00e73b6..54839f195 100644 --- a/v3/integrations/nrstan/test/go.mod +++ b/v3/integrations/nrstan/test/go.mod @@ -1,12 +1,12 @@ module github.com/newrelic/go-agent/v3/integrations/nrstan/test // This module exists to avoid a dependency on // github.com/nats-io/nats-streaming-server in nrstan. -go 1.13 +go 1.19 require ( github.com/nats-io/nats-streaming-server v0.24.3 github.com/nats-io/stan.go v0.10.3 - github.com/newrelic/go-agent/v3 v3.18.2 + github.com/newrelic/go-agent/v3 v3.24.1 github.com/newrelic/go-agent/v3/integrations/nrstan v0.0.0 ) -replace github.com/newrelic/go-agent/v3 => ../../../ replace github.com/newrelic/go-agent/v3/integrations/nrstan => ../ +replace github.com/newrelic/go-agent/v3 => ../../.. diff --git a/v3/integrations/nrzap/go.mod b/v3/integrations/nrzap/go.mod index a3a74eb4f..dae7df3a3 100644 --- a/v3/integrations/nrzap/go.mod +++ b/v3/integrations/nrzap/go.mod @@ -2,10 +2,13 @@ module github.com/newrelic/go-agent/v3/integrations/nrzap // As of Dec 2019, zap has 1.13 in their go.mod file: // https://github.com/uber-go/zap/blob/master/go.mod -go 1.13 +go 1.19 require ( - github.com/newrelic/go-agent/v3 v3.24.0 + github.com/newrelic/go-agent/v3 v3.24.1 // v1.12.0 is the earliest version of zap using modules. go.uber.org/zap v1.12.0 ) + + +replace github.com/newrelic/go-agent/v3 => ../.. diff --git a/v3/newrelic/instrumentation.go b/v3/newrelic/instrumentation.go index a118aef9f..4e37e5316 100644 --- a/v3/newrelic/instrumentation.go +++ b/v3/newrelic/instrumentation.go @@ -121,7 +121,9 @@ func WrapHandleFunc(app *Application, pattern string, handler func(http.Response // http.ListenAndServe(newrelic.WrapListen(":8000"), nil) // func WrapListen(endpoint string) string { - secureAgent.SendEvent("APP_INFO", endpoint) + if IsSecurityAgentPresent() { + secureAgent.SendEvent("APP_INFO", endpoint) + } return endpoint } diff --git a/v3/newrelic/internal_response_writer.go b/v3/newrelic/internal_response_writer.go index 4535ccb92..4271a93f4 100644 --- a/v3/newrelic/internal_response_writer.go +++ b/v3/newrelic/internal_response_writer.go @@ -30,7 +30,9 @@ func (rw *replacementResponseWriter) Write(b []byte) (n int, err error) { headersJustWritten(rw.thd, http.StatusOK, hdr) - secureAgent.SendEvent("INBOUND_WRITE", string(b), hdr) + if IsSecurityAgentPresent() { + secureAgent.SendEvent("INBOUND_WRITE", string(b), hdr) + } return } diff --git a/v3/newrelic/internal_txn.go b/v3/newrelic/internal_txn.go index a11afa271..30fe644d4 100644 --- a/v3/newrelic/internal_txn.go +++ b/v3/newrelic/internal_txn.go @@ -1379,7 +1379,7 @@ func (txn *txn) getCsecData() any { func (txn *txn) setCsecData() { txn.Lock() defer txn.Unlock() - if txn.csecData == nil { + if txn.csecData == nil && IsSecurityAgentPresent() { txn.csecData = secureAgent.SendEvent("NEW_GOROUTINE", "") } } diff --git a/v3/newrelic/segments.go b/v3/newrelic/segments.go index a9c96d52c..91f8fcc5a 100644 --- a/v3/newrelic/segments.go +++ b/v3/newrelic/segments.go @@ -174,7 +174,7 @@ func (s *Segment) End() { return } - if s.StartTime.thread != nil && s.StartTime.thread.thread != nil && s.StartTime.thread.thread.threadID > 0 { + if s.StartTime.thread != nil && s.StartTime.thread.thread != nil && s.StartTime.thread.thread.threadID > 0 && IsSecurityAgentPresent() { // async thread secureAgent.SendEvent("NEW_GOROUTINE_END", "") } @@ -239,10 +239,9 @@ func (s *ExternalSegment) End() { s.StartTime.thread.logAPIError(err, "end external segment", extraDetails) } - if (s.statusCode != nil && *s.statusCode != 404) || (s.Response != nil && s.Response.StatusCode != 404) { + if ((s.statusCode != nil && *s.statusCode != 404) || (s.Response != nil && s.Response.StatusCode != 404)) && IsSecurityAgentPresent() { secureAgent.SendExitEvent(s.secureAgentEvent, nil) } - } // AddAttribute adds a key value pair to the current MessageProducerSegment. @@ -321,14 +320,18 @@ func StartExternalSegment(txn *Transaction, request *http.Request) *ExternalSegm StartTime: txn.StartSegmentNow(), Request: request, } - s.secureAgentEvent = secureAgent.SendEvent("OUTBOUND", request) + if IsSecurityAgentPresent() { + s.secureAgentEvent = secureAgent.SendEvent("OUTBOUND", request) + } if request != nil && request.Header != nil { for key, values := range s.outboundHeaders() { for _, value := range values { request.Header.Set(key, value) } } - secureAgent.DistributedTraceHeaders(request, s.secureAgentEvent) + if IsSecurityAgentPresent() { + secureAgent.DistributedTraceHeaders(request, s.secureAgentEvent) + } } return s diff --git a/v3/newrelic/sql_driver.go b/v3/newrelic/sql_driver.go index 9a30bf882..ee3be5d62 100644 --- a/v3/newrelic/sql_driver.go +++ b/v3/newrelic/sql_driver.go @@ -47,10 +47,11 @@ func InstrumentSQLConnector(connector driver.Connector, bld SQLDriverSegmentBuil func sendSecureEventSQL(query, args any) any { return secureAgent.SendEvent("SQL", query, args) } + func sendSecureEventSQLPrepare(query, obj any) { secureAgent.SendEvent("SQL_PREPARE", query, fmt.Sprintf("%p", obj)) - } + func sendSecureEventSQLPrepareArgs(args, obj any) any { return secureAgent.SendEvent("SQL_PREPARE_ARGS", args, fmt.Sprintf("%p", obj)) } @@ -152,14 +153,18 @@ func prepare(original driver.Stmt, err error, bld SQLDriverSegmentBuilder, query func (w *wrapConn) Prepare(query string) (driver.Stmt, error) { original, err := w.original.Prepare(query) - sendSecureEventSQLPrepare(query, original) + if IsSecurityAgentPresent() { + sendSecureEventSQLPrepare(query, original) + } return prepare(original, err, w.bld, query) } // PrepareContext implements ConnPrepareContext. func (w *wrapConn) PrepareContext(ctx context.Context, query string) (driver.Stmt, error) { original, err := w.original.(driver.ConnPrepareContext).PrepareContext(ctx, query) - sendSecureEventSQLPrepare(query, original) + if IsSecurityAgentPresent() { + sendSecureEventSQLPrepare(query, original) + } return prepare(original, err, w.bld, query) } @@ -178,22 +183,36 @@ func (w *wrapConn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.T // Exec implements Execer. func (w *wrapConn) Exec(query string, args []driver.Value) (driver.Result, error) { - secureAgentevent := sendSecureEventSQL(query, args) - result, err := w.original.(driver.Execer).Exec(query, args) - secureAgent.SendExitEvent(secureAgentevent, err) + var err error + var result driver.Result + + if IsSecurityAgentPresent() { + secureAgentevent := sendSecureEventSQL(query, args) + defer func() { + secureAgent.SendExitEvent(secureAgentevent, err) + }() + } + result, err = w.original.(driver.Execer).Exec(query, args) return result, err } // ExecContext implements ExecerContext. func (w *wrapConn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error) { - secureAgentevent := sendSecureEventSQL(query, args) + var err error + var result driver.Result + + if IsSecurityAgentPresent() { + secureAgentevent := sendSecureEventSQL(query, args) + defer func() { + secureAgent.SendExitEvent(secureAgentevent, err) + }() + } startTime := time.Now() - result, err := w.original.(driver.ExecerContext).ExecContext(ctx, query, args) + result, err = w.original.(driver.ExecerContext).ExecContext(ctx, query, args) if err != driver.ErrSkip { seg := w.bld.useQuery(query).startSegmentAt(ctx, startTime) seg.End() } - secureAgent.SendExitEvent(secureAgentevent, err) return result, err } @@ -208,22 +227,36 @@ func (w *wrapConn) Ping(ctx context.Context) error { } func (w *wrapConn) Query(query string, args []driver.Value) (driver.Rows, error) { - secureAgentevent := sendSecureEventSQL(query, args) - result, err := w.original.(driver.Queryer).Query(query, args) - secureAgent.SendExitEvent(secureAgentevent, err) + var err error + var result driver.Rows + + if IsSecurityAgentPresent() { + secureAgentevent := sendSecureEventSQL(query, args) + defer func() { + secureAgent.SendExitEvent(secureAgentevent, err) + }() + } + result, err = w.original.(driver.Queryer).Query(query, args) return result, err } // QueryContext implements QueryerContext. func (w *wrapConn) QueryContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Rows, error) { - secureAgentevent := sendSecureEventSQL(query, args) + var rows driver.Rows + var err error + + if IsSecurityAgentPresent() { + secureAgentevent := sendSecureEventSQL(query, args) + defer func() { + secureAgent.SendExitEvent(secureAgentevent, err) + }() + } startTime := time.Now() - rows, err := w.original.(driver.QueryerContext).QueryContext(ctx, query, args) + rows, err = w.original.(driver.QueryerContext).QueryContext(ctx, query, args) if err != driver.ErrSkip { seg := w.bld.useQuery(query).startSegmentAt(ctx, startTime) seg.End() } - secureAgent.SendExitEvent(secureAgentevent, err) return rows, err } @@ -241,16 +274,30 @@ func (w *wrapStmt) NumInput() int { } func (w *wrapStmt) Exec(args []driver.Value) (driver.Result, error) { - secureAgentevent := sendSecureEventSQLPrepareArgs(args, w.original) - result, err := w.original.Exec(args) - secureAgent.SendExitEvent(secureAgentevent, err) + var result driver.Result + var err error + + if IsSecurityAgentPresent() { + secureAgentevent := sendSecureEventSQLPrepareArgs(args, w.original) + defer func() { + secureAgent.SendExitEvent(secureAgentevent, err) + }() + } + result, err = w.original.Exec(args) return result, err } func (w *wrapStmt) Query(args []driver.Value) (driver.Rows, error) { - secureAgentevent := sendSecureEventSQLPrepareArgs(args, w) - result, err := w.original.Query(args) - secureAgent.SendExitEvent(secureAgentevent, err) + var result driver.Rows + var err error + + if IsSecurityAgentPresent() { + secureAgentevent := sendSecureEventSQLPrepareArgs(args, w) + defer func() { + secureAgent.SendExitEvent(secureAgentevent, err) + }() + } + result, err = w.original.Query(args) return result, err } @@ -266,21 +313,35 @@ func (w *wrapStmt) CheckNamedValue(v *driver.NamedValue) error { // ExecContext implements StmtExecContext. func (w *wrapStmt) ExecContext(ctx context.Context, args []driver.NamedValue) (driver.Result, error) { - secureAgentevent := sendSecureEventSQLPrepareArgs(args, w) + var result driver.Result + var err error + + if IsSecurityAgentPresent() { + secureAgentevent := sendSecureEventSQLPrepareArgs(args, w) + defer func() { + secureAgent.SendExitEvent(secureAgentevent, err) + }() + } segment := w.bld.startSegment(ctx) - result, err := w.original.(driver.StmtExecContext).ExecContext(ctx, args) + result, err = w.original.(driver.StmtExecContext).ExecContext(ctx, args) segment.End() - secureAgent.SendExitEvent(secureAgentevent, err) return result, err } // QueryContext implements StmtQueryContext. func (w *wrapStmt) QueryContext(ctx context.Context, args []driver.NamedValue) (driver.Rows, error) { - secureAgentevent := sendSecureEventSQLPrepareArgs(args, w) + var rows driver.Rows + var err error + + if IsSecurityAgentPresent() { + secureAgentevent := sendSecureEventSQLPrepareArgs(args, w) + defer func() { + secureAgent.SendExitEvent(secureAgentevent, err) + }() + } segment := w.bld.startSegment(ctx) - rows, err := w.original.(driver.StmtQueryContext).QueryContext(ctx, args) + rows, err = w.original.(driver.StmtQueryContext).QueryContext(ctx, args) segment.End() - secureAgent.SendExitEvent(secureAgentevent, err) return rows, err } diff --git a/v3/newrelic/transaction.go b/v3/newrelic/transaction.go index 9e620c6f4..d1d519c63 100644 --- a/v3/newrelic/transaction.go +++ b/v3/newrelic/transaction.go @@ -39,7 +39,7 @@ func (txn *Transaction) End() { // not any nested call! r = recover() } - if txn.thread.IsWeb { + if txn.thread.IsWeb && IsSecurityAgentPresent() { secureAgent.SendEvent("INBOUND_END", "") } txn.thread.logAPIError(txn.thread.End(r), "end transaction", nil) @@ -271,7 +271,9 @@ func (txn *Transaction) SetWebRequest(r WebRequest) { if txn == nil || txn.thread == nil { return } - secureAgent.SendEvent("INBOUND", r) + if IsSecurityAgentPresent() { + secureAgent.SendEvent("INBOUND", r) + } txn.thread.logAPIError(txn.thread.SetWebRequest(r), "set web request", nil) } diff --git a/v3/newrelic/version.go b/v3/newrelic/version.go index 6959820c0..b1a8adefd 100644 --- a/v3/newrelic/version.go +++ b/v3/newrelic/version.go @@ -11,7 +11,7 @@ import ( const ( // Version is the full string version of this Go Agent. - Version = "3.24.0" + Version = "3.24.1" ) var ( From 9d4c938dc984f92b265477bab0878fd85dabb903 Mon Sep 17 00:00:00 2001 From: Steve Willoughby Date: Thu, 10 Aug 2023 14:10:23 -0700 Subject: [PATCH 3/5] update ci tests to new go version, logrus --- .github/workflows/ci.yaml | 91 +++++++++++++++++++-------------------- 1 file changed, 45 insertions(+), 46 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f48c47b3c..2e3b02c6d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -17,95 +17,95 @@ jobs: fail-fast: false matrix: include: - - go-version: 1.18.x - dirs: v3/newrelic,v3/internal,v3/examples - go-version: 1.19.x dirs: v3/newrelic,v3/internal,v3/examples - go-version: 1.20.x dirs: v3/newrelic,v3/internal,v3/examples + - go-version: 1.21.x + dirs: v3/newrelic,v3/internal,v3/examples # v3 integrations - go-version: 1.19.x dirs: v3/integrations/nrsarama - - go-version: 1.18.x + - go-version: 1.19.x dirs: v3/integrations/logcontext/nrlogrusplugin - extratesting: go get -u github.com/sirupsen/logrus@master - - go-version: 1.18.x + # extratesting: go get -u github.com/sirupsen/logrus@master + - go-version: 1.19.x dirs: v3/integrations/logcontext-v2/nrlogrus - extratesting: go get -u github.com/sirupsen/logrus@master - - go-version: 1.18.x + # extratesting: go get -u github.com/sirupsen/logrus@master + - go-version: 1.19.x dirs: v3/integrations/logcontext-v2/nrzerolog extratesting: go get -u github.com/rs/zerolog@master - - go-version: 1.18.x + - go-version: 1.19.x dirs: v3/integrations/logcontext-v2/nrzap - - go-version: 1.18.x + - go-version: 1.19.x dirs: v3/integrations/logcontext-v2/nrwriter - - go-version: 1.18.x + - go-version: 1.19.x dirs: v3/integrations/logcontext-v2/zerologWriter extratesting: go get -u github.com/rs/zerolog@master - - go-version: 1.18.x + - go-version: 1.19.x dirs: v3/integrations/logcontext-v2/logWriter - - go-version: 1.18.x + - go-version: 1.19.x dirs: v3/integrations/nrawssdk-v1 extratesting: go get -u github.com/aws/aws-sdk-go@main - - go-version: 1.18.x + - go-version: 1.19.x dirs: v3/integrations/nrawssdk-v2 extratesting: go get -u github.com/aws/aws-sdk-go-v2@main - - go-version: 1.18.x + - go-version: 1.19.x dirs: v3/integrations/nrecho-v3 # Test against the latest v3 Echo: extratesting: go get -u github.com/labstack/echo@v3 # go/new/http no longer stable under go 1.18.x - - go-version: 1.18.x + - go-version: 1.19.x dirs: v3/integrations/nrecho-v4 extratesting: go get -u github.com/labstack/echo/v4@master - - go-version: 1.18.x + - go-version: 1.19.x dirs: v3/integrations/nrelasticsearch-v7 extratesting: go get -u github.com/elastic/go-elasticsearch/v7@7.x - - go-version: 1.18.x + - go-version: 1.19.x dirs: v3/integrations/nrgin extratesting: go get -u github.com/gin-gonic/gin@master - - go-version: 1.18.x + - go-version: 1.19.x dirs: v3/integrations/nrgorilla extratesting: go get -u github.com/gorilla/mux@master - - go-version: 1.18.x + - go-version: 1.19.x dirs: v3/integrations/nrgraphgophers - - go-version: 1.18.x + - go-version: 1.19.x dirs: v3/integrations/nrlogrus - - go-version: 1.18.x + - go-version: 1.19.x dirs: v3/integrations/nrlogxi extratesting: go get -u github.com/mgutz/logxi@master - - go-version: 1.18.x + - go-version: 1.19.x dirs: v3/integrations/nrpkgerrors extratesting: go get -u github.com/pkg/errors@master - - go-version: 1.18.x + - go-version: 1.19.x dirs: v3/integrations/nrlambda extratesting: go get -u github.com/aws/aws-lambda-go@master - - go-version: 1.18.x + - go-version: 1.19.x dirs: v3/integrations/nrmysql extratesting: go get -u github.com/go-sql-driver/mysql@master - - go-version: 1.18.x + - go-version: 1.19.x dirs: v3/integrations/nrpq extratesting: go get -u github.com/lib/pq@master - - go-version: 1.18.x + - go-version: 1.19.x dirs: v3/integrations/nrpgx5 - - go-version: 1.18.x + - go-version: 1.19.x dirs: v3/integrations/nrpq/example/sqlx - - go-version: 1.18.x + - go-version: 1.19.x dirs: v3/integrations/nrredis-v7 extratesting: go get -u github.com/go-redis/redis/v7@master - - go-version: 1.18.x + - go-version: 1.19.x dirs: v3/integrations/nrredis-v9 extratesting: go get -u github.com/redis/go-redis/v9@master - - go-version: 1.18.x + - go-version: 1.19.x dirs: v3/integrations/nrsqlite3 extratesting: go get -u github.com/mattn/go-sqlite3@master - - go-version: 1.18.x + - go-version: 1.19.x dirs: v3/integrations/nrsnowflake - - go-version: 1.18.x + - go-version: 1.19.x dirs: v3/integrations/nrgrpc extratesting: go get -u google.golang.org/grpc@master - - go-version: 1.18.x + - go-version: 1.19.x dirs: v3/integrations/nrmicro # As of Dec 2019, there is a race condition in when using go-micro@master # in their logging system. Instead, we'll test against the latest @@ -114,34 +114,34 @@ jobs: # As of June 2020, confirmed errors still result # extratesting: go get -u github.com/micro/go-micro@latest # If we are using the latest released version to test, we need to use a newer version of go - - go-version: 1.18.x + - go-version: 1.19.x dirs: v3/integrations/nrnats extratesting: go get -u github.com/nats-io/nats.go/@master - - go-version: 1.18.x + - go-version: 1.19.x dirs: v3/integrations/nrstan extratesting: go get -u github.com/nats-io/stan.go/@master - - go-version: 1.18.x + - go-version: 1.19.x dirs: v3/integrations/nrstan/test - - go-version: 1.18.x + - go-version: 1.19.x dirs: v3/integrations/nrstan/examples - - go-version: 1.18.x + - go-version: 1.19.x dirs: v3/integrations/logcontext extratesting: go get -u github.com/sirupsen/logrus@master # nrzap only supports the two most recent minor go releases - - go-version: 1.18.x + - go-version: 1.19.x dirs: v3/integrations/nrzap - - go-version: 1.18.x + - go-version: 1.19.x dirs: v3/integrations/nrhttprouter extratesting: go get -u github.com/julienschmidt/httprouter@master - - go-version: 1.18.x + - go-version: 1.19.x dirs: v3/integrations/nrb3 - - go-version: 1.18.x + - go-version: 1.19.x dirs: v3/integrations/nrmongo extratesting: go get -u go.mongodb.org/mongo-driver@master - - go-version: 1.18.x + - go-version: 1.19.x dirs: v3/integrations/nrgraphqlgo,v3/integrations/nrgraphqlgo/example extratesting: go get -u github.com/graphql-go/graphql@master - - go-version: 1.18.x + - go-version: 1.19.x dirs: v3/integrations/nrmssql extratesting: go get -u github.com/microsoft/go-mssqldb@main @@ -180,8 +180,7 @@ jobs: fail-fast: false matrix: include: - - go-version: 1.18.6 - - go-version: 1.19.1 + - go-version: 1.19.x steps: - uses: actions/checkout@v1 with: From 6ec04009228630519bd13c8f439d496f3004e8d0 Mon Sep 17 00:00:00 2001 From: Steve Willoughby Date: Thu, 10 Aug 2023 14:20:32 -0700 Subject: [PATCH 4/5] fixed clm for unit test --- v3/integrations/nrstan/test/go.mod | 37 +++++++++++++++++++++- v3/integrations/nrstan/test/nrstan_test.go | 2 +- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/v3/integrations/nrstan/test/go.mod b/v3/integrations/nrstan/test/go.mod index 54839f195..405ecc39e 100644 --- a/v3/integrations/nrstan/test/go.mod +++ b/v3/integrations/nrstan/test/go.mod @@ -1,12 +1,47 @@ module github.com/newrelic/go-agent/v3/integrations/nrstan/test + // This module exists to avoid a dependency on // github.com/nats-io/nats-streaming-server in nrstan. go 1.19 + require ( github.com/nats-io/nats-streaming-server v0.24.3 - github.com/nats-io/stan.go v0.10.3 + github.com/nats-io/stan.go v0.10.4 github.com/newrelic/go-agent/v3 v3.24.1 github.com/newrelic/go-agent/v3/integrations/nrstan v0.0.0 ) + +require ( + github.com/armon/go-metrics v0.0.0-20190430140413-ec5e00d3c878 // indirect + github.com/fatih/color v1.7.0 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/protobuf v1.5.3 // indirect + github.com/hashicorp/go-hclog v1.1.0 // indirect + github.com/hashicorp/go-immutable-radix v1.0.0 // indirect + github.com/hashicorp/go-msgpack v1.1.5 // indirect + github.com/hashicorp/golang-lru v0.5.0 // indirect + github.com/hashicorp/raft v1.3.6 // indirect + github.com/klauspost/compress v1.14.4 // indirect + github.com/mattn/go-colorable v0.1.4 // indirect + github.com/mattn/go-isatty v0.0.10 // indirect + github.com/minio/highwayhash v1.0.2 // indirect + github.com/nats-io/jwt/v2 v2.2.1-0.20220113022732-58e87895b296 // indirect + github.com/nats-io/nats-server/v2 v2.7.4 // indirect + github.com/nats-io/nats.go v1.22.1 // indirect + github.com/nats-io/nkeys v0.3.0 // indirect + github.com/nats-io/nuid v1.0.1 // indirect + github.com/prometheus/procfs v0.7.3 // indirect + go.etcd.io/bbolt v1.3.6 // indirect + golang.org/x/crypto v0.5.0 // indirect + golang.org/x/net v0.8.0 // indirect + golang.org/x/sys v0.6.0 // indirect + golang.org/x/text v0.8.0 // indirect + golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 // indirect + google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect + google.golang.org/grpc v1.54.0 // indirect + google.golang.org/protobuf v1.28.1 // indirect +) + replace github.com/newrelic/go-agent/v3/integrations/nrstan => ../ + replace github.com/newrelic/go-agent/v3 => ../../.. diff --git a/v3/integrations/nrstan/test/nrstan_test.go b/v3/integrations/nrstan/test/nrstan_test.go index a41ae44d7..1f77c5f1b 100644 --- a/v3/integrations/nrstan/test/nrstan_test.go +++ b/v3/integrations/nrstan/test/nrstan_test.go @@ -31,7 +31,7 @@ func TestMain(m *testing.M) { } func createTestApp() integrationsupport.ExpectApp { - return integrationsupport.NewTestApp(integrationsupport.SampleEverythingReplyFn, integrationsupport.ConfigFullTraces, cfgFn) + return integrationsupport.NewTestApp(integrationsupport.SampleEverythingReplyFn, integrationsupport.ConfigFullTraces, cfgFn, newrelic.ConfigCodeLevelMetricsEnabled(false)) } var cfgFn = func(cfg *newrelic.Config) { From c8f3fba90b44c739e06f4adabc908dd56d009c8f Mon Sep 17 00:00:00 2001 From: Steve Willoughby Date: Thu, 10 Aug 2023 14:21:26 -0700 Subject: [PATCH 5/5] removed indirects --- v3/integrations/nrstan/test/go.mod | 31 ------------------------------ 1 file changed, 31 deletions(-) diff --git a/v3/integrations/nrstan/test/go.mod b/v3/integrations/nrstan/test/go.mod index 405ecc39e..aabad5475 100644 --- a/v3/integrations/nrstan/test/go.mod +++ b/v3/integrations/nrstan/test/go.mod @@ -11,37 +11,6 @@ require ( github.com/newrelic/go-agent/v3/integrations/nrstan v0.0.0 ) -require ( - github.com/armon/go-metrics v0.0.0-20190430140413-ec5e00d3c878 // indirect - github.com/fatih/color v1.7.0 // indirect - github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/protobuf v1.5.3 // indirect - github.com/hashicorp/go-hclog v1.1.0 // indirect - github.com/hashicorp/go-immutable-radix v1.0.0 // indirect - github.com/hashicorp/go-msgpack v1.1.5 // indirect - github.com/hashicorp/golang-lru v0.5.0 // indirect - github.com/hashicorp/raft v1.3.6 // indirect - github.com/klauspost/compress v1.14.4 // indirect - github.com/mattn/go-colorable v0.1.4 // indirect - github.com/mattn/go-isatty v0.0.10 // indirect - github.com/minio/highwayhash v1.0.2 // indirect - github.com/nats-io/jwt/v2 v2.2.1-0.20220113022732-58e87895b296 // indirect - github.com/nats-io/nats-server/v2 v2.7.4 // indirect - github.com/nats-io/nats.go v1.22.1 // indirect - github.com/nats-io/nkeys v0.3.0 // indirect - github.com/nats-io/nuid v1.0.1 // indirect - github.com/prometheus/procfs v0.7.3 // indirect - go.etcd.io/bbolt v1.3.6 // indirect - golang.org/x/crypto v0.5.0 // indirect - golang.org/x/net v0.8.0 // indirect - golang.org/x/sys v0.6.0 // indirect - golang.org/x/text v0.8.0 // indirect - golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 // indirect - google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect - google.golang.org/grpc v1.54.0 // indirect - google.golang.org/protobuf v1.28.1 // indirect -) - replace github.com/newrelic/go-agent/v3/integrations/nrstan => ../ replace github.com/newrelic/go-agent/v3 => ../../..