From 8476b0f23c49b8a4a5a250b507a293dfe309453f Mon Sep 17 00:00:00 2001 From: aayush-ap Date: Wed, 28 Jun 2023 10:22:02 +0530 Subject: [PATCH 01/20] Initial changes for detect all api endpoints. --- v3/integrations/nrecho-v3/nrecho.go | 11 ++++- v3/integrations/nrecho-v4/nrecho.go | 9 +++- v3/integrations/nrgin/nrgin.go | 8 ++++ v3/integrations/nrgorilla/nrgorilla.go | 19 +++++++++ v3/integrations/nrhttprouter/nrhttprouter.go | 45 ++++++++++---------- v3/newrelic/instrumentation.go | 12 +++--- v3/newrelic/secure_agent.go | 10 +---- 7 files changed, 75 insertions(+), 39 deletions(-) diff --git a/v3/integrations/nrecho-v3/nrecho.go b/v3/integrations/nrecho-v3/nrecho.go index ad5f862b8..4b46bbf50 100644 --- a/v3/integrations/nrecho-v3/nrecho.go +++ b/v3/integrations/nrecho-v3/nrecho.go @@ -51,9 +51,7 @@ func transactionName(c echo.Context) string { // e := echo.New() // // Add the nrecho middleware before other middlewares or routes: // e.Use(nrecho.Middleware(app)) -// func Middleware(app *newrelic.Application) func(echo.HandlerFunc) echo.HandlerFunc { - if nil == app { return func(next echo.HandlerFunc) echo.HandlerFunc { return next @@ -93,3 +91,12 @@ func Middleware(app *newrelic.Application) func(echo.HandlerFunc) echo.HandlerFu } } } + +func WrapRouter(engine *echo.Echo) { + if engine != nil { + router := engine.Routes() + for _, r := range router { + newrelic.GetSecurityAgentInterface().SendEvent("API_END_POINTS", r.Path, r.Method) + } + } +} diff --git a/v3/integrations/nrecho-v4/nrecho.go b/v3/integrations/nrecho-v4/nrecho.go index 4c3b8cd18..c6e1511fb 100644 --- a/v3/integrations/nrecho-v4/nrecho.go +++ b/v3/integrations/nrecho-v4/nrecho.go @@ -71,7 +71,6 @@ func WithSkipper(skipper Skipper) ConfigOption { // e := echo.New() // // Add the nrecho middleware before other middlewares or routes: // e.Use(nrecho.MiddlewareWithConfig(nrecho.Config{App: app})) -// func Middleware(app *newrelic.Application, opts ...ConfigOption) func(echo.HandlerFunc) echo.HandlerFunc { if app == nil { return func(next echo.HandlerFunc) echo.HandlerFunc { @@ -131,3 +130,11 @@ func Middleware(app *newrelic.Application, opts ...ConfigOption) func(echo.Handl } } } +func WrapRouter(engine *echo.Echo) { + if engine != nil { + router := engine.Routes() + for _, r := range router { + newrelic.GetSecurityAgentInterface().SendEvent("API_END_POINTS", r.Path, r.Method) + } + } +} diff --git a/v3/integrations/nrgin/nrgin.go b/v3/integrations/nrgin/nrgin.go index 88ef11b24..954a752da 100644 --- a/v3/integrations/nrgin/nrgin.go +++ b/v3/integrations/nrgin/nrgin.go @@ -144,6 +144,14 @@ func MiddlewareHandlerTxnNames(app *newrelic.Application) gin.HandlerFunc { return middleware(app, false) } +func WrapRouter(engine *gin.Engine) { + if engine != nil { + router := engine.Routes() + for _, r := range router { + newrelic.GetSecurityAgentInterface().SendEvent("API_END_POINTS", r.Path, r.Method) + } + } +} func middleware(app *newrelic.Application, useNewNames bool) gin.HandlerFunc { return func(c *gin.Context) { if app != nil { diff --git a/v3/integrations/nrgorilla/nrgorilla.go b/v3/integrations/nrgorilla/nrgorilla.go index dd2088a25..872161e21 100644 --- a/v3/integrations/nrgorilla/nrgorilla.go +++ b/v3/integrations/nrgorilla/nrgorilla.go @@ -111,3 +111,22 @@ func Middleware(app *newrelic.Application) mux.MiddlewareFunc { }) } } +func WrapRouter(router *mux.Router) { + if router != nil { + router.Walk(func(route *mux.Route, router *mux.Router, ancestors []*mux.Route) error { + path, err1 := route.GetPathTemplate() + if err1 != nil { + return nil + } + methods, _ := route.GetMethods() + if len(methods) == 0 { + newrelic.GetSecurityAgentInterface().SendEvent("API_END_POINTS", path, "*") + } else { + for _, method := range methods { + newrelic.GetSecurityAgentInterface().SendEvent("API_END_POINTS", path, method) + } + } + return nil + }) + } +} diff --git a/v3/integrations/nrhttprouter/nrhttprouter.go b/v3/integrations/nrhttprouter/nrhttprouter.go index 75cb73ff4..66854ab96 100644 --- a/v3/integrations/nrhttprouter/nrhttprouter.go +++ b/v3/integrations/nrhttprouter/nrhttprouter.go @@ -8,33 +8,33 @@ // httprouter.Router. Use an *nrhttprouter.Router in place of your // *httprouter.Router. Example: // -// package main +// package main // -// import ( -// "fmt" -// "net/http" -// "os" +// import ( +// "fmt" +// "net/http" +// "os" // -// "github.com/julienschmidt/httprouter" -// newrelic "github.com/newrelic/go-agent/v3/newrelic" -// "github.com/newrelic/go-agent/v3/integrations/nrhttprouter" -// ) +// "github.com/julienschmidt/httprouter" +// newrelic "github.com/newrelic/go-agent/v3/newrelic" +// "github.com/newrelic/go-agent/v3/integrations/nrhttprouter" +// ) // -// func main() { -// cfg := newrelic.NewConfig("httprouter App", os.Getenv("NEW_RELIC_LICENSE_KEY")) -// app, _ := newrelic.NewApplication(cfg) +// func main() { +// cfg := newrelic.NewConfig("httprouter App", os.Getenv("NEW_RELIC_LICENSE_KEY")) +// app, _ := newrelic.NewApplication(cfg) // -// // Create the Router replacement: -// router := nrhttprouter.New(app) +// // Create the Router replacement: +// router := nrhttprouter.New(app) // -// router.GET("/", func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { -// w.Write([]byte("welcome\n")) -// }) -// router.GET("/hello/:name", (w http.ResponseWriter, r *http.Request, ps httprouter.Params) { -// w.Write([]byte(fmt.Sprintf("hello %s\n", ps.ByName("name")))) -// }) -// http.ListenAndServe(":8000", router) -// } +// router.GET("/", func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { +// w.Write([]byte("welcome\n")) +// }) +// router.GET("/hello/:name", (w http.ResponseWriter, r *http.Request, ps httprouter.Params) { +// w.Write([]byte(fmt.Sprintf("hello %s\n", ps.ByName("name")))) +// }) +// http.ListenAndServe(":8000", router) +// } // // Runnable example: https://github.com/newrelic/go-agent/tree/master/v3/integrations/nrhttprouter/example/main.go package nrhttprouter @@ -84,6 +84,7 @@ func (r *Router) handle(method string, path string, original httprouter.Handle) } } r.Router.Handle(method, path, handle) + newrelic.GetSecurityAgentInterface().SendEvent("API_END_POINTS", path, method) } // DELETE replaces httprouter.Router.DELETE. diff --git a/v3/newrelic/instrumentation.go b/v3/newrelic/instrumentation.go index a118aef9f..f31c16b31 100644 --- a/v3/newrelic/instrumentation.go +++ b/v3/newrelic/instrumentation.go @@ -12,11 +12,11 @@ import ( // WrapHandle instruments http.Handler handlers with Transactions. To // instrument this code: // -// http.Handle("/foo", myHandler) +// http.Handle("/foo", myHandler) // // Perform this replacement: // -// http.Handle(newrelic.WrapHandle(app, "/foo", myHandler)) +// http.Handle(newrelic.WrapHandle(app, "/foo", myHandler)) // // WrapHandle adds the Transaction to the request's context. Access it using // FromContext to add attributes, create segments, or notice errors: @@ -41,7 +41,7 @@ func WrapHandle(app *Application, pattern string, handler http.Handler, options // (but only if we know we're collecting CLM for this transaction and the user didn't already // specify a different code location explicitly). cache := NewCachedCodeLocation() - + secureAgent.SendEvent("API_END_POINTS", pattern, "*") return pattern, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { var tOptions *traceOptSet var txnOptionList []TraceOption @@ -111,15 +111,15 @@ func WrapHandleFunc(app *Application, pattern string, handler func(http.Response return p, func(w http.ResponseWriter, r *http.Request) { h.ServeHTTP(w, r) } } -// // WrapListen wraps an HTTP endpoint reference passed to functions like http.ListenAndServe, // which causes security scanning to be done for that incoming endpoint when vulnerability // scanning is enabled. It returns the endpoint string, so you can replace a call like // -// http.ListenAndServe(":8000", nil) +// http.ListenAndServe(":8000", nil) +// // with -// http.ListenAndServe(newrelic.WrapListen(":8000"), nil) // +// http.ListenAndServe(newrelic.WrapListen(":8000"), nil) func WrapListen(endpoint string) string { secureAgent.SendEvent("APP_INFO", endpoint) return endpoint diff --git a/v3/newrelic/secure_agent.go b/v3/newrelic/secure_agent.go index 0b6225185..f58724c31 100644 --- a/v3/newrelic/secure_agent.go +++ b/v3/newrelic/secure_agent.go @@ -4,18 +4,15 @@ import ( "net/http" ) -// // secureAgent is a global interface point for the nrsecureagent's hooks into the go agent. // The default value for this is a noOpSecurityAgent value, which has null definitions for // the methods. The Go compiler is expected to optimize away all the securityAgent method // calls in this case, effectively removing the hooks from the running agent. // // If the nrsecureagent integration was initialized, it will register a real securityAgent -// value in the securityAgent varialble instead, thus "activating" the hooks. -// +// value in the securityAgent variable instead, thus "activating" the hooks. var secureAgent securityAgent = noOpSecurityAgent{} -// // GetSecurityAgentInterface returns the securityAgent value // which provides the working interface to the installed // security agent (or to a no-op interface if none were @@ -23,10 +20,9 @@ var secureAgent securityAgent = noOpSecurityAgent{} // // Packages which need to make calls to secureAgent's methods // may obtain the secureAgent value by calling this function. -// This avoids exposing the variable itself so it's not +// This avoids exposing the variable itself, so it's not // writable externally and also sets up for the future if this // ends up not being a global variable later. -// func GetSecurityAgentInterface() securityAgent { return secureAgent } @@ -86,11 +82,9 @@ func (t noOpSecurityAgent) DistributedTraceHeaders(hdrs *http.Request, secureAge func (t noOpSecurityAgent) SendExitEvent(secureAgentevent any, err error) { } -// // IsSecurityAgentPresent returns true if there's an actual security agent hooked in to the // Go APM agent, whether or not it's enabled or operating in any particular mode. It returns // false only if the hook-in interface for those functions is a No-Op will null functionality. -// func IsSecurityAgentPresent() bool { _, isNoOp := secureAgent.(noOpSecurityAgent) return !isNoOp From d71c0a1d76195344f813448e77e11dc4c02610bb Mon Sep 17 00:00:00 2001 From: Aayush garg Date: Wed, 7 Feb 2024 21:55:27 +0530 Subject: [PATCH 02/20] Added api detection for fasthttp --- v3/integrations/nrfasthttp/instrumentation.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v3/integrations/nrfasthttp/instrumentation.go b/v3/integrations/nrfasthttp/instrumentation.go index abefb8460..41d621edd 100644 --- a/v3/integrations/nrfasthttp/instrumentation.go +++ b/v3/integrations/nrfasthttp/instrumentation.go @@ -50,7 +50,7 @@ func WrapHandle(app *newrelic.Application, pattern string, handler fasthttp.Requ if app == nil { return pattern, handler } - + secureAgent.SendEvent("API_END_POINTS", pattern, "*") // add the wrapped function to the trace options as the source code reference point // (but only if we know we're collecting CLM for this transaction and the user didn't already // specify a different code location explicitly). From 1cd514f45ffbd5d11a68e47d3b2965a82401ca99 Mon Sep 17 00:00:00 2001 From: Aayush garg Date: Mon, 19 Feb 2024 10:59:47 +0530 Subject: [PATCH 03/20] Added functionality get handler function name --- v3/integrations/nrecho-v3/nrecho.go | 2 +- v3/integrations/nrecho-v4/nrecho.go | 2 +- v3/integrations/nrfasthttp/instrumentation.go | 2 +- v3/integrations/nrgin/nrgin.go | 2 +- v3/integrations/nrgorilla/nrgorilla.go | 4 ++-- v3/integrations/nrhttprouter/nrhttprouter.go | 2 +- v3/internal/utilities.go | 16 ++++++++++++++++ v3/newrelic/instrumentation.go | 4 +++- 8 files changed, 26 insertions(+), 8 deletions(-) diff --git a/v3/integrations/nrecho-v3/nrecho.go b/v3/integrations/nrecho-v3/nrecho.go index 4b46bbf50..ad01b871e 100644 --- a/v3/integrations/nrecho-v3/nrecho.go +++ b/v3/integrations/nrecho-v3/nrecho.go @@ -96,7 +96,7 @@ func WrapRouter(engine *echo.Echo) { if engine != nil { router := engine.Routes() for _, r := range router { - newrelic.GetSecurityAgentInterface().SendEvent("API_END_POINTS", r.Path, r.Method) + newrelic.GetSecurityAgentInterface().SendEvent("API_END_POINTS", r.Path, r.Method, r.Name) } } } diff --git a/v3/integrations/nrecho-v4/nrecho.go b/v3/integrations/nrecho-v4/nrecho.go index c6e1511fb..0b5b9fe87 100644 --- a/v3/integrations/nrecho-v4/nrecho.go +++ b/v3/integrations/nrecho-v4/nrecho.go @@ -134,7 +134,7 @@ func WrapRouter(engine *echo.Echo) { if engine != nil { router := engine.Routes() for _, r := range router { - newrelic.GetSecurityAgentInterface().SendEvent("API_END_POINTS", r.Path, r.Method) + newrelic.GetSecurityAgentInterface().SendEvent("API_END_POINTS", r.Path, r.Method, r.Name) } } } diff --git a/v3/integrations/nrfasthttp/instrumentation.go b/v3/integrations/nrfasthttp/instrumentation.go index 41d621edd..92e7990ee 100644 --- a/v3/integrations/nrfasthttp/instrumentation.go +++ b/v3/integrations/nrfasthttp/instrumentation.go @@ -50,7 +50,7 @@ func WrapHandle(app *newrelic.Application, pattern string, handler fasthttp.Requ if app == nil { return pattern, handler } - secureAgent.SendEvent("API_END_POINTS", pattern, "*") + secureAgent.SendEvent("API_END_POINTS", pattern, "*", internal.HandlerName(handler)) // add the wrapped function to the trace options as the source code reference point // (but only if we know we're collecting CLM for this transaction and the user didn't already // specify a different code location explicitly). diff --git a/v3/integrations/nrgin/nrgin.go b/v3/integrations/nrgin/nrgin.go index 954a752da..5c4b46401 100644 --- a/v3/integrations/nrgin/nrgin.go +++ b/v3/integrations/nrgin/nrgin.go @@ -148,7 +148,7 @@ func WrapRouter(engine *gin.Engine) { if engine != nil { router := engine.Routes() for _, r := range router { - newrelic.GetSecurityAgentInterface().SendEvent("API_END_POINTS", r.Path, r.Method) + newrelic.GetSecurityAgentInterface().SendEvent("API_END_POINTS", r.Path, r.Method, internal.HandlerName(r.HandlerFunc)) } } } diff --git a/v3/integrations/nrgorilla/nrgorilla.go b/v3/integrations/nrgorilla/nrgorilla.go index 872161e21..418f2d2d6 100644 --- a/v3/integrations/nrgorilla/nrgorilla.go +++ b/v3/integrations/nrgorilla/nrgorilla.go @@ -120,10 +120,10 @@ func WrapRouter(router *mux.Router) { } methods, _ := route.GetMethods() if len(methods) == 0 { - newrelic.GetSecurityAgentInterface().SendEvent("API_END_POINTS", path, "*") + newrelic.GetSecurityAgentInterface().SendEvent("API_END_POINTS", path, "*", internal.HandlerName(route.GetHandler())) } else { for _, method := range methods { - newrelic.GetSecurityAgentInterface().SendEvent("API_END_POINTS", path, method) + newrelic.GetSecurityAgentInterface().SendEvent("API_END_POINTS", path, method, internal.HandlerName(route.GetHandler())) } } return nil diff --git a/v3/integrations/nrhttprouter/nrhttprouter.go b/v3/integrations/nrhttprouter/nrhttprouter.go index 66854ab96..4babe08b8 100644 --- a/v3/integrations/nrhttprouter/nrhttprouter.go +++ b/v3/integrations/nrhttprouter/nrhttprouter.go @@ -84,7 +84,7 @@ func (r *Router) handle(method string, path string, original httprouter.Handle) } } r.Router.Handle(method, path, handle) - newrelic.GetSecurityAgentInterface().SendEvent("API_END_POINTS", path, method) + newrelic.GetSecurityAgentInterface().SendEvent("API_END_POINTS", path, method, internal.HandlerName(original)) } // DELETE replaces httprouter.Router.DELETE. diff --git a/v3/internal/utilities.go b/v3/internal/utilities.go index e6c78e5ca..d57538b9a 100644 --- a/v3/internal/utilities.go +++ b/v3/internal/utilities.go @@ -7,6 +7,8 @@ import ( "bytes" "encoding/json" "fmt" + "reflect" + "runtime" "time" ) @@ -26,3 +28,17 @@ func CompactJSONString(js string) string { } return buf.String() } + +// HandlerName return name of a function. +func HandlerName(h interface{}) string { + if h == nil { + return "" + } + t := reflect.ValueOf(h).Type() + if t.Kind() == reflect.Func { + if pointer := runtime.FuncForPC(reflect.ValueOf(h).Pointer()); pointer != nil { + return pointer.Name() + } + } + return "" +} diff --git a/v3/newrelic/instrumentation.go b/v3/newrelic/instrumentation.go index cd42e7de5..6e38eec1b 100644 --- a/v3/newrelic/instrumentation.go +++ b/v3/newrelic/instrumentation.go @@ -5,6 +5,8 @@ package newrelic import ( "net/http" + + "github.com/newrelic/go-agent/v3/internal" ) // instrumentation.go contains helpers built on the lower level api. @@ -41,7 +43,7 @@ func WrapHandle(app *Application, pattern string, handler http.Handler, options // (but only if we know we're collecting CLM for this transaction and the user didn't already // specify a different code location explicitly). cache := NewCachedCodeLocation() - secureAgent.SendEvent("API_END_POINTS", pattern, "*") + secureAgent.SendEvent("API_END_POINTS", pattern, "*", internal.HandlerName(handler)) return pattern, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { var tOptions *traceOptSet var txnOptionList []TraceOption From 10c70a053ff92e72fb081d4523f92502e8774906 Mon Sep 17 00:00:00 2001 From: Emilio Garcia Date: Wed, 6 Mar 2024 14:24:08 -0500 Subject: [PATCH 04/20] unit test ignore txn --- v3/newrelic/internal_txn_test.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/v3/newrelic/internal_txn_test.go b/v3/newrelic/internal_txn_test.go index c9ef3a298..bbe42c9d0 100644 --- a/v3/newrelic/internal_txn_test.go +++ b/v3/newrelic/internal_txn_test.go @@ -587,6 +587,26 @@ func TestGetName(t *testing.T) { } } +func TestIgnoreTransaction(t *testing.T) { + replyfn := func(reply *internal.ConnectReply) { + reply.SetSampleEverything() + reply.EntityGUID = "entities-are-guid" + reply.TraceIDGenerator = internal.NewTraceIDGenerator(12345) + } + cfgfn := func(cfg *Config) { + cfg.AppName = "app-name" + cfg.DistributedTracer.Enabled = true + } + app := testApp(replyfn, cfgfn, t) + txn := app.StartTransaction("hello") + txn.Ignore() + txn.SetName("hello世界") + txn.NoticeError(errors.New("hi")) + txn.End() + + app.ExpectTxnTraces(t, []internal.WantTxnTrace{}) +} + func TestEmptyTransaction(t *testing.T) { txn := &Transaction{} From 0bfe0cd21005ec4fdbfd9976f8d28ab64a68b0ea Mon Sep 17 00:00:00 2001 From: Emilio Garcia Date: Mon, 11 Mar 2024 16:06:00 -0400 Subject: [PATCH 05/20] test sugared logger captures logs --- .../logcontext-v2/nrzap/nrzap_test.go | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/v3/integrations/logcontext-v2/nrzap/nrzap_test.go b/v3/integrations/logcontext-v2/nrzap/nrzap_test.go index 923de536a..6890d8f9a 100644 --- a/v3/integrations/logcontext-v2/nrzap/nrzap_test.go +++ b/v3/integrations/logcontext-v2/nrzap/nrzap_test.go @@ -43,6 +43,37 @@ func TestBackgroundLogger(t *testing.T) { }) } +func TestBackgroundLoggerSugared(t *testing.T) { + app := integrationsupport.NewTestApp(integrationsupport.SampleEverythingReplyFn, + newrelic.ConfigAppLogDecoratingEnabled(true), + newrelic.ConfigAppLogForwardingEnabled(true), + ) + + core := zapcore.NewCore(zapcore.NewJSONEncoder(zap.NewProductionEncoderConfig()), zapcore.AddSync(os.Stdout), zap.InfoLevel) + + backgroundCore, err := WrapBackgroundCore(core, app.Application) + if err != nil && err != ErrNilApp { + t.Fatal(err) + } + + logger := zap.New(backgroundCore).Sugar() + + err = errors.New("this is a test error") + msg := "this is a test error message" + + // for background logging: + logger.Error(msg, zap.Error(err), zap.String("test-key", "test-val")) + logger.Sync() + + app.ExpectLogEvents(t, []internal.WantLog{ + { + Severity: zap.ErrorLevel.String(), + Message: msg, + Timestamp: internal.MatchAnyUnixMilli, + }, + }) +} + func TestBackgroundLoggerNilApp(t *testing.T) { app := integrationsupport.NewTestApp(integrationsupport.SampleEverythingReplyFn, newrelic.ConfigAppLogDecoratingEnabled(true), From 2e972b570c311d4b9ef712bcf3cec8f4fc026b11 Mon Sep 17 00:00:00 2001 From: Emilio Garcia Date: Mon, 11 Mar 2024 16:07:43 -0400 Subject: [PATCH 06/20] fix nrzap test to pass --- v3/integrations/logcontext-v2/nrzap/nrzap_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v3/integrations/logcontext-v2/nrzap/nrzap_test.go b/v3/integrations/logcontext-v2/nrzap/nrzap_test.go index 6890d8f9a..33adfcd26 100644 --- a/v3/integrations/logcontext-v2/nrzap/nrzap_test.go +++ b/v3/integrations/logcontext-v2/nrzap/nrzap_test.go @@ -68,7 +68,7 @@ func TestBackgroundLoggerSugared(t *testing.T) { app.ExpectLogEvents(t, []internal.WantLog{ { Severity: zap.ErrorLevel.String(), - Message: msg, + Message: `this is a test error message{error 26 0 this is a test error} {test-key 15 0 test-val }`, Timestamp: internal.MatchAnyUnixMilli, }, }) From 88ab1e19b55b6107b10c5a6e3a00415daff76e49 Mon Sep 17 00:00:00 2001 From: Emilio Garcia Date: Fri, 15 Mar 2024 12:56:39 -0400 Subject: [PATCH 07/20] pgxpool example thread safety fix credit @WillAbides https://github.com/newrelic/go-agent/issues/855#issuecomment-1999758432 --- .../nrpgx5/example/pgxpool/main.go | 19 ++++++++++++++----- v3/integrations/nrpgx5/go.mod | 3 --- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/v3/integrations/nrpgx5/example/pgxpool/main.go b/v3/integrations/nrpgx5/example/pgxpool/main.go index 8457a478d..f7eb38329 100644 --- a/v3/integrations/nrpgx5/example/pgxpool/main.go +++ b/v3/integrations/nrpgx5/example/pgxpool/main.go @@ -7,19 +7,28 @@ import ( "os" "time" + "github.com/jackc/pgx/v5" "github.com/jackc/pgx/v5/pgxpool" "github.com/newrelic/go-agent/v3/integrations/nrpgx5" "github.com/newrelic/go-agent/v3/newrelic" ) -func main() { - cfg, err := pgxpool.ParseConfig("postgres://postgres:postgres@localhost:5432") +func NewPgxPool(ctx context.Context, dbURL string) (*pgxpool.Pool, error) { + cfg, err := pgxpool.ParseConfig(dbURL) if err != nil { - panic(err) + return nil, err + } + + cfg.BeforeConnect = func(_ context.Context, config *pgx.ConnConfig) error { + config.Tracer = nrpgx5.NewTracer() + return nil } - cfg.ConnConfig.Tracer = nrpgx5.NewTracer() - db, err := pgxpool.NewWithConfig(context.Background(), cfg) + return pgxpool.NewWithConfig(ctx, cfg) +} + +func main() { + db, err := NewPgxPool(context.Background(), "postgres://postgres:postgres@localhost:5432") if err != nil { panic(err) } diff --git a/v3/integrations/nrpgx5/go.mod b/v3/integrations/nrpgx5/go.mod index 554db5aaa..bbf674c0c 100644 --- a/v3/integrations/nrpgx5/go.mod +++ b/v3/integrations/nrpgx5/go.mod @@ -8,6 +8,3 @@ require ( github.com/newrelic/go-agent/v3 v3.30.0 github.com/stretchr/testify v1.8.0 ) - - -replace github.com/newrelic/go-agent/v3 => ../.. From 90f295878f0cd61895970a3001c61b55e194521d Mon Sep 17 00:00:00 2001 From: Aayush garg Date: Mon, 18 Mar 2024 17:31:19 +0530 Subject: [PATCH 08/20] minor fix --- v3/integrations/nrfasthttp/instrumentation.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v3/integrations/nrfasthttp/instrumentation.go b/v3/integrations/nrfasthttp/instrumentation.go index 92e7990ee..a8949d57d 100644 --- a/v3/integrations/nrfasthttp/instrumentation.go +++ b/v3/integrations/nrfasthttp/instrumentation.go @@ -50,7 +50,7 @@ func WrapHandle(app *newrelic.Application, pattern string, handler fasthttp.Requ if app == nil { return pattern, handler } - secureAgent.SendEvent("API_END_POINTS", pattern, "*", internal.HandlerName(handler)) + newrelic.GetSecurityAgentInterface().SendEvent("API_END_POINTS", pattern, "*", internal.HandlerName(handler)) // add the wrapped function to the trace options as the source code reference point // (but only if we know we're collecting CLM for this transaction and the user didn't already // specify a different code location explicitly). From 5295ca744ab78761a0498db14d8dea8edb68308a Mon Sep 17 00:00:00 2001 From: Aayush garg Date: Wed, 20 Mar 2024 13:28:40 +0530 Subject: [PATCH 09/20] Added document for wrapRouter --- v3/integrations/nrecho-v3/nrecho.go | 13 ++++++++++++- v3/integrations/nrecho-v4/nrecho.go | 14 +++++++++++++- v3/integrations/nrgin/nrgin.go | 11 +++++++++++ v3/integrations/nrgorilla/nrgorilla.go | 14 +++++++++++++- 4 files changed, 49 insertions(+), 3 deletions(-) diff --git a/v3/integrations/nrecho-v3/nrecho.go b/v3/integrations/nrecho-v3/nrecho.go index ad01b871e..b6793a4bd 100644 --- a/v3/integrations/nrecho-v3/nrecho.go +++ b/v3/integrations/nrecho-v3/nrecho.go @@ -92,8 +92,19 @@ func Middleware(app *newrelic.Application) func(echo.HandlerFunc) echo.HandlerFu } } +// WrapRouter extract api endpoints from the echo instance passed to it +// which is used to detect application URL mapping(api-endpoints) for provable security. +// Skip if you are not using [nrsecurityagent](https://pkg.go.dev/github.com/newrelic/go-agent/v3/integrations/nrsecurityagent). +// e := echo.New() +// .... +// .... +// .... +// +// nrecho.WrapRouter(e) +// + func WrapRouter(engine *echo.Echo) { - if engine != nil { + if engine != nil && newrelic.IsSecurityAgentPresent() { router := engine.Routes() for _, r := range router { newrelic.GetSecurityAgentInterface().SendEvent("API_END_POINTS", r.Path, r.Method, r.Name) diff --git a/v3/integrations/nrecho-v4/nrecho.go b/v3/integrations/nrecho-v4/nrecho.go index 0b5b9fe87..c8327afa4 100644 --- a/v3/integrations/nrecho-v4/nrecho.go +++ b/v3/integrations/nrecho-v4/nrecho.go @@ -130,8 +130,20 @@ func Middleware(app *newrelic.Application, opts ...ConfigOption) func(echo.Handl } } } + +// WrapRouter extract api endpoints from the echo instance passed to it +// which is used to detect application URL mapping(api-endpoints) for provable security. +// Skip if you are not using [nrsecurityagent](https://pkg.go.dev/github.com/newrelic/go-agent/v3/integrations/nrsecurityagent). +// e := echo.New() +// .... +// .... +// .... +// +// nrecho.WrapRouter(e) +// + func WrapRouter(engine *echo.Echo) { - if engine != nil { + if engine != nil && newrelic.IsSecurityAgentPresent() { router := engine.Routes() for _, r := range router { newrelic.GetSecurityAgentInterface().SendEvent("API_END_POINTS", r.Path, r.Method, r.Name) diff --git a/v3/integrations/nrgin/nrgin.go b/v3/integrations/nrgin/nrgin.go index 5c4b46401..d5c8a4dd0 100644 --- a/v3/integrations/nrgin/nrgin.go +++ b/v3/integrations/nrgin/nrgin.go @@ -144,6 +144,17 @@ func MiddlewareHandlerTxnNames(app *newrelic.Application) gin.HandlerFunc { return middleware(app, false) } +// WrapRouter extract api endpoints from the router instance passed to it +// which is used to detect application URL mapping(api-endpoints) for provable security. +// Skip if you are not using [nrsecurityagent](https://pkg.go.dev/github.com/newrelic/go-agent/v3/integrations/nrsecurityagent). +// router := gin.Default() +// .... +// .... +// .... +// +// nrgin.WrapRouter(router) +// + func WrapRouter(engine *gin.Engine) { if engine != nil { router := engine.Routes() diff --git a/v3/integrations/nrgorilla/nrgorilla.go b/v3/integrations/nrgorilla/nrgorilla.go index 418f2d2d6..53e10c72e 100644 --- a/v3/integrations/nrgorilla/nrgorilla.go +++ b/v3/integrations/nrgorilla/nrgorilla.go @@ -111,8 +111,20 @@ func Middleware(app *newrelic.Application) mux.MiddlewareFunc { }) } } + +// WrapRouter extract api endpoints from the router object passed to it +// which is used to detect application URL mapping(api-endpoints) for provable security. +// Skip if you are not using [nrsecurityagent](https://pkg.go.dev/github.com/newrelic/go-agent/v3/integrations/nrsecurityagent). +// r := mux.NewRouter() +// .... +// .... +// .... +// +// nrgorilla.WrapRouter(router) +// + func WrapRouter(router *mux.Router) { - if router != nil { + if router != nil && newrelic.IsSecurityAgentPresent() { router.Walk(func(route *mux.Route, router *mux.Router, ancestors []*mux.Route) error { path, err1 := route.GetPathTemplate() if err1 != nil { From 97147762bb0872c500de4c5332d610de37297031 Mon Sep 17 00:00:00 2001 From: Aayush garg Date: Tue, 26 Mar 2024 16:38:23 +0530 Subject: [PATCH 10/20] update security agent version --- v3/integrations/nrsecurityagent/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v3/integrations/nrsecurityagent/go.mod b/v3/integrations/nrsecurityagent/go.mod index a02f77032..5bf053dcd 100644 --- a/v3/integrations/nrsecurityagent/go.mod +++ b/v3/integrations/nrsecurityagent/go.mod @@ -3,7 +3,7 @@ module github.com/newrelic/go-agent/v3/integrations/nrsecurityagent go 1.19 require ( - github.com/newrelic/csec-go-agent v0.7.0 + github.com/newrelic/csec-go-agent v1.1.0 github.com/newrelic/go-agent/v3 v3.29.0 github.com/newrelic/go-agent/v3/integrations/nrsqlite3 v1.2.0 gopkg.in/yaml.v2 v2.4.0 From eee75aedb39ea0e0c71a993dee9c7a3bc0a3df94 Mon Sep 17 00:00:00 2001 From: Adomas Kizogian Date: Tue, 26 Mar 2024 16:42:54 +0200 Subject: [PATCH 11/20] feat: introduce TransactionFromContextHandler --- .../logcontext-v2/nrslog/handler.go | 49 +++++++++++++++++++ .../logcontext-v2/nrslog/handler_test.go | 37 ++++++++++++++ 2 files changed, 86 insertions(+) diff --git a/v3/integrations/logcontext-v2/nrslog/handler.go b/v3/integrations/logcontext-v2/nrslog/handler.go index 551e32b0c..f75e825b8 100644 --- a/v3/integrations/logcontext-v2/nrslog/handler.go +++ b/v3/integrations/logcontext-v2/nrslog/handler.go @@ -39,6 +39,7 @@ func JSONHandler(app *newrelic.Application, w io.Writer, opts *slog.HandlerOptio } // WithTransaction creates a new Slog Logger object to be used for logging within a given transaction. +// Calling this function with a logger having underlying TransactionFromContextHandler handler is a no-op. func WithTransaction(txn *newrelic.Transaction, logger *slog.Logger) *slog.Logger { if txn == nil || logger == nil { return logger @@ -56,6 +57,7 @@ func WithTransaction(txn *newrelic.Transaction, logger *slog.Logger) *slog.Logge // WithTransaction creates a new Slog Logger object to be used for logging within a given transaction it its found // in a context. +// Calling this function with a logger having underlying TransactionFromContextHandler handler is a no-op. func WithContext(ctx context.Context, logger *slog.Logger) *slog.Logger { if ctx == nil { return logger @@ -181,3 +183,50 @@ func (h NRHandler) WithGroup(name string) slog.Handler { txn: h.txn, } } + +// NRHandler is an Slog handler that includes logic to implement New Relic Logs in Context. +// New Relic transaction value is taken from context. It cannot be set directly. +// This serves as a quality of life improvement for cases where slog.Default global instance is +// referenced, allowing to use slog methods directly and maintaining New Relic instrumentation. +type TransactionFromContextHandler struct { + NRHandler +} + +// WithTransactionFromContext creates a wrapped NRHandler, enabling it to automatically reference New Relic +// transaction from context. +func WithTransactionFromContext(handler NRHandler) TransactionFromContextHandler { + return TransactionFromContextHandler{handler} +} + +// Handle handles the Record. +// It will only be called when Enabled returns true. +// The Context argument is as for Enabled and NewRelic transaction. +// Canceling the context should not affect record processing. +// (Among other things, log messages may be necessary to debug a +// cancellation-related problem.) +// +// Handle methods that produce output should observe the following rules: +// - If r.Time is the zero time, ignore the time. +// - If r.PC is zero, ignore it. +// - Attr's values should be resolved. +// - If an Attr's key and value are both the zero value, ignore the Attr. +// This can be tested with attr.Equal(Attr{}). +// - If a group's key is empty, inline the group's Attrs. +// - If a group has no Attrs (even if it has a non-empty key), +// ignore it. +func (h TransactionFromContextHandler) Handle(ctx context.Context, record slog.Record) error { + data := newrelic.LogData{ + Severity: record.Level.String(), + Timestamp: record.Time.UnixMilli(), + Message: record.Message, + } + + if txn := newrelic.FromContext(ctx); txn != nil { + txn.RecordLog(data) + return h.NRHandler.WithTransaction(txn).Handle(ctx, record) + } + + h.app.RecordLog(data) + + return h.handler.Handle(ctx, record) +} diff --git a/v3/integrations/logcontext-v2/nrslog/handler_test.go b/v3/integrations/logcontext-v2/nrslog/handler_test.go index 503fec909..550650dd3 100644 --- a/v3/integrations/logcontext-v2/nrslog/handler_test.go +++ b/v3/integrations/logcontext-v2/nrslog/handler_test.go @@ -258,3 +258,40 @@ func TestWithGroup(t *testing.T) { } } + +func TestTransactionFromContextHandler(t *testing.T) { + app := integrationsupport.NewTestApp(integrationsupport.SampleEverythingReplyFn, + newrelic.ConfigAppLogDecoratingEnabled(true), + newrelic.ConfigAppLogForwardingEnabled(true), + ) + + out := bytes.NewBuffer([]byte{}) + message := "Hello World!" + + handler := TextHandler(app.Application, out, &slog.HandlerOptions{}) + log := slog.New(WithTransactionFromContext(handler)) + + txn := app.Application.StartTransaction("my txn") + ctx := newrelic.NewContext(context.Background(), txn) + txninfo := txn.GetLinkingMetadata() + + log.InfoContext(ctx, message) + + txn.End() + + logcontext.ValidateDecoratedOutput(t, out, &logcontext.DecorationExpect{ + EntityGUID: integrationsupport.TestEntityGUID, + Hostname: host, + EntityName: integrationsupport.SampleAppName, + }) + + app.ExpectLogEvents(t, []internal.WantLog{ + { + Severity: slog.LevelInfo.String(), + Message: message, + Timestamp: internal.MatchAnyUnixMilli, + SpanID: txninfo.SpanID, + TraceID: txninfo.TraceID, + }, + }) +} From 8253e489f4dea44d01bed5d14ce5e6aafdee24ee Mon Sep 17 00:00:00 2001 From: Adomas Kizogian Date: Tue, 26 Mar 2024 17:09:30 +0200 Subject: [PATCH 12/20] fix double log --- v3/integrations/logcontext-v2/nrslog/handler.go | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/v3/integrations/logcontext-v2/nrslog/handler.go b/v3/integrations/logcontext-v2/nrslog/handler.go index f75e825b8..4e0d3c90f 100644 --- a/v3/integrations/logcontext-v2/nrslog/handler.go +++ b/v3/integrations/logcontext-v2/nrslog/handler.go @@ -215,18 +215,9 @@ func WithTransactionFromContext(handler NRHandler) TransactionFromContextHandler // - If a group has no Attrs (even if it has a non-empty key), // ignore it. func (h TransactionFromContextHandler) Handle(ctx context.Context, record slog.Record) error { - data := newrelic.LogData{ - Severity: record.Level.String(), - Timestamp: record.Time.UnixMilli(), - Message: record.Message, - } - if txn := newrelic.FromContext(ctx); txn != nil { - txn.RecordLog(data) return h.NRHandler.WithTransaction(txn).Handle(ctx, record) } - h.app.RecordLog(data) - - return h.handler.Handle(ctx, record) + return h.NRHandler.Handle(ctx, record) } From d8cab45ef887816bbf5b0f812496753bd4c4ba97 Mon Sep 17 00:00:00 2001 From: Adomas Kizogian <100681941+adomaskizogian@users.noreply.github.com> Date: Wed, 27 Mar 2024 22:10:59 +0200 Subject: [PATCH 13/20] run nrslog tests on ci --- .github/workflows/ci.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index efaae3ba6..eb2f2684e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -30,6 +30,7 @@ jobs: - dirs: v3/integrations/logcontext-v2/nrlogrus - dirs: v3/integrations/logcontext-v2/nrzerolog - dirs: v3/integrations/logcontext-v2/nrzap + - dirs: v3/integrations/logcontext-v2/nrslog - dirs: v3/integrations/logcontext-v2/nrwriter - dirs: v3/integrations/logcontext-v2/zerologWriter - dirs: v3/integrations/logcontext-v2/logWriter @@ -138,4 +139,4 @@ jobs: else echo "Directory /app/$dir does not exist." fi - done \ No newline at end of file + done From 78ded2fa06b95700043772186e18f7cc7acfc5d6 Mon Sep 17 00:00:00 2001 From: Steve Willoughby Date: Thu, 28 Mar 2024 09:51:26 -0700 Subject: [PATCH 14/20] doc fixes --- v3/integrations/nrawsbedrock/nrawsbedrock.go | 5 + v3/integrations/nropenai/LICENSE.txt | 206 +++++++++++++++++++ 2 files changed, 211 insertions(+) create mode 100644 v3/integrations/nropenai/LICENSE.txt diff --git a/v3/integrations/nrawsbedrock/nrawsbedrock.go b/v3/integrations/nrawsbedrock/nrawsbedrock.go index 99114a5f1..4a96db74a 100644 --- a/v3/integrations/nrawsbedrock/nrawsbedrock.go +++ b/v3/integrations/nrawsbedrock/nrawsbedrock.go @@ -28,11 +28,16 @@ // ConfigAIMonitoringStreamingEnabled(true), // enable instrumentation of streaming invocations // ConfigAIMonitoringRecordContentEnabled(true), // include input/output data in instrumentation // +// Currently, the following must also be set for AIM reporting to function correctly: +// ConfigCustomInsightsEventsEnabled(true) // (the default) +// ConfigHighSecurityEnabled(false) // (the default) +// // Or, if ConfigFromEnvironment() is included in your configuration options, the above configuration // options may be specified using these environment variables, respectively: // NEW_RELIC_AI_MONITORING_ENABLED=true // NEW_RELIC_AI_MONITORING_STREAMING_ENABLED=true // NEW_RELIC_AI_MONITORING_RECORD_CONTENT_ENABLED=true +// NEW_RELIC_HIGH_SECURITY=false // The values for these variables may be any form accepted by strconv.ParseBool (e.g., 1, t, T, true, TRUE, True, // 0, f, F, false, FALSE, or False). // diff --git a/v3/integrations/nropenai/LICENSE.txt b/v3/integrations/nropenai/LICENSE.txt new file mode 100644 index 000000000..cee548c2d --- /dev/null +++ b/v3/integrations/nropenai/LICENSE.txt @@ -0,0 +1,206 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +Versions 3.8.0 and above for this project are licensed under Apache 2.0. For +prior versions of this project, please see the LICENCE.txt file in the root +directory of that version for more information. From 5a07607deae97b831f920a6e212844801e752a6c Mon Sep 17 00:00:00 2001 From: mirackara Date: Thu, 28 Mar 2024 12:25:29 -0500 Subject: [PATCH 15/20] Add AI integration packages --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index c5d5347d8..063f837e1 100644 --- a/README.md +++ b/README.md @@ -102,6 +102,14 @@ package primitives can be found [here](GUIDE.md#datastore-segments). | [snowflakedb/gosnowflake](https://github.com/snowflakedb/gosnowflake) | [v3/integrations/nrsnowflake](https://godoc.org/github.com/newrelic/go-agent/v3/integrations/nrsnowflake) | Instrument Snowflake driver | | [mongodb/mongo-go-driver](https://github.com/mongodb/mongo-go-driver) | [v3/integrations/nrmongo](https://godoc.org/github.com/newrelic/go-agent/v3/integrations/nrmongo) | Instrument MongoDB calls | +#### AI + +| Project | Integration Package | | +| ------------- | ------------- | - | +| [sashabaranov/go-openai](https://github.com/sashabaranov/go-openai) | [v3/integrations/nropenai](https://godoc.org/github.com/newrelic/go-agent/v3/integrations/nropenai) | Send AI Monitoring Events with OpenAI | +| [aws/aws-sdk-go-v2/tree/main/service/bedrockruntime](https://github.com/aws/aws-sdk-go-v2/tree/main/service/bedrockruntime) | [v3/integrations/nrawsbedrock](https://godoc.org/github.com/newrelic/go-agent/v3/integrations/nrawsbedrock) | Send AI Monitoring Events with AWS Bedrock | + + #### Agent Logging | Project | Integration Package | | From 25526a6f6c700c96423372a8b7ab4e98e5d6f7b4 Mon Sep 17 00:00:00 2001 From: Aayush garg Date: Fri, 29 Mar 2024 20:14:24 +0530 Subject: [PATCH 16/20] Added IsSecurityAgentPresent check --- v3/integrations/nrecho-v3/nrecho.go | 5 +++-- v3/integrations/nrecho-v4/nrecho.go | 5 +++-- v3/integrations/nrfasthttp/instrumentation.go | 4 +++- v3/integrations/nrgin/nrgin.go | 7 ++++--- v3/integrations/nrgorilla/nrgorilla.go | 5 +++-- v3/integrations/nrhttprouter/nrhttprouter.go | 4 +++- v3/newrelic/instrumentation.go | 6 +++++- 7 files changed, 24 insertions(+), 12 deletions(-) diff --git a/v3/integrations/nrecho-v3/nrecho.go b/v3/integrations/nrecho-v3/nrecho.go index b6793a4bd..8125265b6 100644 --- a/v3/integrations/nrecho-v3/nrecho.go +++ b/v3/integrations/nrecho-v3/nrecho.go @@ -92,9 +92,10 @@ func Middleware(app *newrelic.Application) func(echo.HandlerFunc) echo.HandlerFu } } -// WrapRouter extract api endpoints from the echo instance passed to it +// WrapRouter extracts API endpoints from the echo instance passed to it // which is used to detect application URL mapping(api-endpoints) for provable security. -// Skip if you are not using [nrsecurityagent](https://pkg.go.dev/github.com/newrelic/go-agent/v3/integrations/nrsecurityagent). +// In this version of the integration, this wrapper is only necessary if you are using the New Relic security agent integration [https://github.com/newrelic/go-agent/tree/master/v3/integrations/nrsecurityagent], +// but it may be enhanced to provide additional functionality in future releases. // e := echo.New() // .... // .... diff --git a/v3/integrations/nrecho-v4/nrecho.go b/v3/integrations/nrecho-v4/nrecho.go index c8327afa4..d768c7a76 100644 --- a/v3/integrations/nrecho-v4/nrecho.go +++ b/v3/integrations/nrecho-v4/nrecho.go @@ -131,9 +131,10 @@ func Middleware(app *newrelic.Application, opts ...ConfigOption) func(echo.Handl } } -// WrapRouter extract api endpoints from the echo instance passed to it +// WrapRouter extracts API endpoints from the echo instance passed to it // which is used to detect application URL mapping(api-endpoints) for provable security. -// Skip if you are not using [nrsecurityagent](https://pkg.go.dev/github.com/newrelic/go-agent/v3/integrations/nrsecurityagent). +// In this version of the integration, this wrapper is only necessary if you are using the New Relic security agent integration [https://github.com/newrelic/go-agent/tree/master/v3/integrations/nrsecurityagent], +// but it may be enhanced to provide additional functionality in future releases. // e := echo.New() // .... // .... diff --git a/v3/integrations/nrfasthttp/instrumentation.go b/v3/integrations/nrfasthttp/instrumentation.go index a8949d57d..f05a8b770 100644 --- a/v3/integrations/nrfasthttp/instrumentation.go +++ b/v3/integrations/nrfasthttp/instrumentation.go @@ -50,7 +50,9 @@ func WrapHandle(app *newrelic.Application, pattern string, handler fasthttp.Requ if app == nil { return pattern, handler } - newrelic.GetSecurityAgentInterface().SendEvent("API_END_POINTS", pattern, "*", internal.HandlerName(handler)) + if newrelic.IsSecurityAgentPresent() { + newrelic.GetSecurityAgentInterface().SendEvent("API_END_POINTS", pattern, "*", internal.HandlerName(handler)) + } // add the wrapped function to the trace options as the source code reference point // (but only if we know we're collecting CLM for this transaction and the user didn't already // specify a different code location explicitly). diff --git a/v3/integrations/nrgin/nrgin.go b/v3/integrations/nrgin/nrgin.go index d5c8a4dd0..e2943466b 100644 --- a/v3/integrations/nrgin/nrgin.go +++ b/v3/integrations/nrgin/nrgin.go @@ -144,9 +144,10 @@ func MiddlewareHandlerTxnNames(app *newrelic.Application) gin.HandlerFunc { return middleware(app, false) } -// WrapRouter extract api endpoints from the router instance passed to it +// WrapRouter extracts API endpoints from the router instance passed to it // which is used to detect application URL mapping(api-endpoints) for provable security. -// Skip if you are not using [nrsecurityagent](https://pkg.go.dev/github.com/newrelic/go-agent/v3/integrations/nrsecurityagent). +// In this version of the integration, this wrapper is only necessary if you are using the New Relic security agent integration [https://github.com/newrelic/go-agent/tree/master/v3/integrations/nrsecurityagent], +// but it may be enhanced to provide additional functionality in future releases. // router := gin.Default() // .... // .... @@ -156,7 +157,7 @@ func MiddlewareHandlerTxnNames(app *newrelic.Application) gin.HandlerFunc { // func WrapRouter(engine *gin.Engine) { - if engine != nil { + if engine != nil && newrelic.IsSecurityAgentPresent() { router := engine.Routes() for _, r := range router { newrelic.GetSecurityAgentInterface().SendEvent("API_END_POINTS", r.Path, r.Method, internal.HandlerName(r.HandlerFunc)) diff --git a/v3/integrations/nrgorilla/nrgorilla.go b/v3/integrations/nrgorilla/nrgorilla.go index 53e10c72e..a8425d0a3 100644 --- a/v3/integrations/nrgorilla/nrgorilla.go +++ b/v3/integrations/nrgorilla/nrgorilla.go @@ -112,9 +112,10 @@ func Middleware(app *newrelic.Application) mux.MiddlewareFunc { } } -// WrapRouter extract api endpoints from the router object passed to it +// WrapRouter extracts API endpoints from the router object passed to it // which is used to detect application URL mapping(api-endpoints) for provable security. -// Skip if you are not using [nrsecurityagent](https://pkg.go.dev/github.com/newrelic/go-agent/v3/integrations/nrsecurityagent). +// In this version of the integration, this wrapper is only necessary if you are using the New Relic security agent integration [https://github.com/newrelic/go-agent/tree/master/v3/integrations/nrsecurityagent], +// but it may be enhanced to provide additional functionality in future releases. // r := mux.NewRouter() // .... // .... diff --git a/v3/integrations/nrhttprouter/nrhttprouter.go b/v3/integrations/nrhttprouter/nrhttprouter.go index 4babe08b8..d1df356eb 100644 --- a/v3/integrations/nrhttprouter/nrhttprouter.go +++ b/v3/integrations/nrhttprouter/nrhttprouter.go @@ -84,7 +84,9 @@ func (r *Router) handle(method string, path string, original httprouter.Handle) } } r.Router.Handle(method, path, handle) - newrelic.GetSecurityAgentInterface().SendEvent("API_END_POINTS", path, method, internal.HandlerName(original)) + if newrelic.IsSecurityAgentPresent() { + newrelic.GetSecurityAgentInterface().SendEvent("API_END_POINTS", path, method, internal.HandlerName(original)) + } } // DELETE replaces httprouter.Router.DELETE. diff --git a/v3/newrelic/instrumentation.go b/v3/newrelic/instrumentation.go index 6e38eec1b..b58db6ccc 100644 --- a/v3/newrelic/instrumentation.go +++ b/v3/newrelic/instrumentation.go @@ -43,7 +43,11 @@ func WrapHandle(app *Application, pattern string, handler http.Handler, options // (but only if we know we're collecting CLM for this transaction and the user didn't already // specify a different code location explicitly). cache := NewCachedCodeLocation() - secureAgent.SendEvent("API_END_POINTS", pattern, "*", internal.HandlerName(handler)) + + if IsSecurityAgentPresent() { + secureAgent.SendEvent("API_END_POINTS", pattern, "*", internal.HandlerName(handler)) + } + return pattern, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { var tOptions *traceOptSet var txnOptionList []TraceOption From a7f91ba9bae31c859eeb7f1e335edf5049f931da Mon Sep 17 00:00:00 2001 From: Steve Willoughby Date: Thu, 4 Apr 2024 10:20:05 -0700 Subject: [PATCH 17/20] interface for bedrock client --- v3/integrations/nrawsbedrock/go.mod | 1 - v3/integrations/nrawsbedrock/nrawsbedrock.go | 20 ++++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/v3/integrations/nrawsbedrock/go.mod b/v3/integrations/nrawsbedrock/go.mod index cab2c2de9..785c10cee 100644 --- a/v3/integrations/nrawsbedrock/go.mod +++ b/v3/integrations/nrawsbedrock/go.mod @@ -11,5 +11,4 @@ require ( github.com/newrelic/go-agent/v3 v3.31.0 ) - replace github.com/newrelic/go-agent/v3 => ../.. diff --git a/v3/integrations/nrawsbedrock/nrawsbedrock.go b/v3/integrations/nrawsbedrock/nrawsbedrock.go index 4a96db74a..640bf37d7 100644 --- a/v3/integrations/nrawsbedrock/nrawsbedrock.go +++ b/v3/integrations/nrawsbedrock/nrawsbedrock.go @@ -115,13 +115,18 @@ func isEnabled(app *newrelic.Application, streaming bool) (bool, bool) { return config.AIMonitoring.Enabled, config.AIMonitoring.RecordContent.Enabled } +// Modeler is any type that can invoke Bedrock models (e.g., bedrockruntime.Client). +type Modeler interface { + InvokeModel(context.Context, *bedrockruntime.InvokeModelInput, ...func(*bedrockruntime.Options)) (*bedrockruntime.InvokeModelOutput, error) + InvokeModelWithResponseStream(context.Context, *bedrockruntime.InvokeModelWithResponseStreamInput, ...func(*bedrockruntime.Options)) (*bedrockruntime.InvokeModelWithResponseStreamOutput, error) +} + // ResponseStream tracks the model invocation throughout its lifetime until all stream events // are processed. type ResponseStream struct { // The request parameters that started the invocation ctx context.Context app *newrelic.Application - client *bedrockruntime.Client params *bedrockruntime.InvokeModelWithResponseStreamInput attrs map[string]any meta map[string]any @@ -178,7 +183,7 @@ type modelInputList struct { // Either start a transaction on your own and add it to the context c passed into this function, or // a transaction will be started for you that lasts only for the duration of the model invocation. // -func InvokeModelWithResponseStream(app *newrelic.Application, brc *bedrockruntime.Client, ctx context.Context, params *bedrockruntime.InvokeModelWithResponseStreamInput, optFns ...func(*bedrockruntime.Options)) (ResponseStream, error) { +func InvokeModelWithResponseStream(app *newrelic.Application, brc Modeler, ctx context.Context, params *bedrockruntime.InvokeModelWithResponseStreamInput, optFns ...func(*bedrockruntime.Options)) (ResponseStream, error) { return InvokeModelWithResponseStreamAttributes(app, brc, ctx, params, nil, optFns...) } @@ -193,7 +198,7 @@ func InvokeModelWithResponseStream(app *newrelic.Application, brc *bedrockruntim // // We recommend including at least "llm.conversation_id" in your attributes. // -func InvokeModelWithResponseStreamAttributes(app *newrelic.Application, brc *bedrockruntime.Client, ctx context.Context, params *bedrockruntime.InvokeModelWithResponseStreamInput, attrs map[string]any, optFns ...func(*bedrockruntime.Options)) (ResponseStream, error) { +func InvokeModelWithResponseStreamAttributes(app *newrelic.Application, brc Modeler, ctx context.Context, params *bedrockruntime.InvokeModelWithResponseStreamInput, attrs map[string]any, optFns ...func(*bedrockruntime.Options)) (ResponseStream, error) { var aiEnabled bool var err error @@ -201,7 +206,6 @@ func InvokeModelWithResponseStreamAttributes(app *newrelic.Application, brc *bed ctx: ctx, app: app, meta: map[string]any{}, - client: brc, params: params, attrs: attrs, } @@ -380,7 +384,7 @@ func (s *ResponseStream) Close() error { // If your callback function returns an error, the processing of the response stream will // terminate at that point. // -func ProcessModelWithResponseStream(app *newrelic.Application, brc *bedrockruntime.Client, ctx context.Context, callback func([]byte) error, params *bedrockruntime.InvokeModelWithResponseStreamInput, optFns ...func(*bedrockruntime.Options)) error { +func ProcessModelWithResponseStream(app *newrelic.Application, brc Modeler, ctx context.Context, callback func([]byte) error, params *bedrockruntime.InvokeModelWithResponseStreamInput, optFns ...func(*bedrockruntime.Options)) error { return ProcessModelWithResponseStreamAttributes(app, brc, ctx, callback, params, nil, optFns...) } @@ -395,7 +399,7 @@ func ProcessModelWithResponseStream(app *newrelic.Application, brc *bedrockrunti // // We recommend including at least "llm.conversation_id" in your attributes. // -func ProcessModelWithResponseStreamAttributes(app *newrelic.Application, brc *bedrockruntime.Client, ctx context.Context, callback func([]byte) error, params *bedrockruntime.InvokeModelWithResponseStreamInput, attrs map[string]any, optFns ...func(*bedrockruntime.Options)) error { +func ProcessModelWithResponseStreamAttributes(app *newrelic.Application, brc Modeler, ctx context.Context, callback func([]byte) error, params *bedrockruntime.InvokeModelWithResponseStreamInput, attrs map[string]any, optFns ...func(*bedrockruntime.Options)) error { var err error var userErr error @@ -442,7 +446,7 @@ func ProcessModelWithResponseStreamAttributes(app *newrelic.Application, brc *be // // If the transaction is unable to be created or used, the Bedrock call will be made anyway, without instrumentation. // -func InvokeModel(app *newrelic.Application, brc *bedrockruntime.Client, ctx context.Context, params *bedrockruntime.InvokeModelInput, optFns ...func(*bedrockruntime.Options)) (*bedrockruntime.InvokeModelOutput, error) { +func InvokeModel(app *newrelic.Application, brc Modeler, ctx context.Context, params *bedrockruntime.InvokeModelInput, optFns ...func(*bedrockruntime.Options)) (*bedrockruntime.InvokeModelOutput, error) { return InvokeModelWithAttributes(app, brc, ctx, params, nil, optFns...) } @@ -456,7 +460,7 @@ func InvokeModel(app *newrelic.Application, brc *bedrockruntime.Client, ctx cont // // We recommend including at least "llm.conversation_id" in your attributes. // -func InvokeModelWithAttributes(app *newrelic.Application, brc *bedrockruntime.Client, ctx context.Context, params *bedrockruntime.InvokeModelInput, attrs map[string]any, optFns ...func(*bedrockruntime.Options)) (*bedrockruntime.InvokeModelOutput, error) { +func InvokeModelWithAttributes(app *newrelic.Application, brc Modeler, ctx context.Context, params *bedrockruntime.InvokeModelInput, attrs map[string]any, optFns ...func(*bedrockruntime.Options)) (*bedrockruntime.InvokeModelOutput, error) { var txn *newrelic.Transaction // the transaction to record in, or nil if we aren't instrumenting this time var err error From 4c91dab0ea5545327b8f896268c0d7ff9d8f551f Mon Sep 17 00:00:00 2001 From: Steve Willoughby Date: Thu, 4 Apr 2024 12:25:58 -0700 Subject: [PATCH 18/20] correct struct field name --- CHANGELOG.md | 13 +++++++++++++ v3/go.mod | 3 +-- v3/integrations/logcontext-v2/logWriter/go.mod | 4 ++-- v3/integrations/logcontext-v2/nrlogrus/go.mod | 4 ++-- v3/integrations/logcontext-v2/nrslog/go.mod | 4 ++-- v3/integrations/logcontext-v2/nrwriter/go.mod | 4 ++-- v3/integrations/logcontext-v2/nrzap/go.mod | 4 ++-- v3/integrations/logcontext-v2/nrzerolog/go.mod | 4 ++-- v3/integrations/logcontext-v2/zerologWriter/go.mod | 4 ++-- v3/integrations/logcontext/nrlogrusplugin/go.mod | 4 ++-- v3/integrations/nramqp/go.mod | 4 ++-- v3/integrations/nrawsbedrock/go.mod | 5 +++-- v3/integrations/nrawssdk-v1/go.mod | 4 ++-- v3/integrations/nrawssdk-v2/go.mod | 4 ++-- v3/integrations/nrb3/go.mod | 4 ++-- v3/integrations/nrecho-v3/go.mod | 4 ++-- v3/integrations/nrecho-v3/nrecho.go | 2 +- v3/integrations/nrecho-v4/go.mod | 4 ++-- v3/integrations/nrelasticsearch-v7/go.mod | 4 ++-- .../nrfasthttp/examples/client-fasthttp/go.mod | 4 ++-- .../nrfasthttp/examples/server-fasthttp/go.mod | 4 ++-- v3/integrations/nrfasthttp/go.mod | 4 ++-- v3/integrations/nrgin/go.mod | 4 ++-- v3/integrations/nrgorilla/go.mod | 4 ++-- v3/integrations/nrgraphgophers/go.mod | 4 ++-- v3/integrations/nrgraphqlgo/example/go.mod | 4 ++-- v3/integrations/nrgraphqlgo/go.mod | 4 ++-- v3/integrations/nrgrpc/go.mod | 4 ++-- v3/integrations/nrhttprouter/go.mod | 4 ++-- v3/integrations/nrlambda/go.mod | 4 ++-- v3/integrations/nrlogrus/go.mod | 4 ++-- v3/integrations/nrlogxi/go.mod | 4 ++-- v3/integrations/nrmicro/go.mod | 4 ++-- v3/integrations/nrmongo/go.mod | 4 ++-- v3/integrations/nrmssql/go.mod | 4 ++-- v3/integrations/nrmysql/go.mod | 4 ++-- v3/integrations/nrnats/go.mod | 4 ++-- v3/integrations/nrnats/test/go.mod | 4 ++-- v3/integrations/nropenai/go.mod | 4 ++-- v3/integrations/nrpgx/example/sqlx/go.mod | 4 ++-- v3/integrations/nrpgx/go.mod | 4 ++-- v3/integrations/nrpgx5/go.mod | 4 ++-- v3/integrations/nrpkgerrors/go.mod | 4 ++-- v3/integrations/nrpq/example/sqlx/go.mod | 4 ++-- v3/integrations/nrpq/go.mod | 4 ++-- v3/integrations/nrredis-v7/go.mod | 4 ++-- v3/integrations/nrredis-v8/go.mod | 4 ++-- v3/integrations/nrredis-v9/go.mod | 4 ++-- v3/integrations/nrsarama/go.mod | 4 ++-- v3/integrations/nrsecurityagent/go.mod | 5 +++-- v3/integrations/nrsnowflake/go.mod | 4 ++-- v3/integrations/nrsqlite3/go.mod | 4 ++-- v3/integrations/nrstan/examples/go.mod | 4 ++-- v3/integrations/nrstan/go.mod | 4 ++-- v3/integrations/nrstan/test/go.mod | 4 ++-- v3/integrations/nrzap/go.mod | 4 ++-- 56 files changed, 123 insertions(+), 109 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 90083c249..92b6c53d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,16 @@ +## 3.32.0 +### Added + * Updates to support for the New Relic security agent to report API endpoints. + * Adds new wrapper function for the `nrecho`, `nrgin`, and `nrgorilla` integrations. + * Handler to take New Relic transaction data from context automatically when using `nrslog` integration (thanks, @adomaskizogian!) + +### Fixed + * Adds missing license file to the `nropenai` integration. + * Changes `*bedrockruntime.Client` parameters in `nrawsbedrock` integration to use a more general interface type, allowing the use of custom types which extend the bedrock client type. + * Fixes `pgx5` pool example + * Updated unit tests to check `Transaction.Ignore` + * Updated `nrzap` unit tests to add background logger sugared test case. + ## 3.31.0 ### Added * Integration packages to instrument AI model invocations (see below). diff --git a/v3/go.mod b/v3/go.mod index c2d68c2a3..afbca8df0 100644 --- a/v3/go.mod +++ b/v3/go.mod @@ -1,10 +1,9 @@ module github.com/newrelic/go-agent/v3 -go 1.19 +go 1.20 require ( github.com/golang/protobuf v1.5.3 - golang.org/x/exp v0.0.0-20240318143956-a85f2c67cd81 google.golang.org/grpc v1.56.3 ) diff --git a/v3/integrations/logcontext-v2/logWriter/go.mod b/v3/integrations/logcontext-v2/logWriter/go.mod index f61edf225..6f5b7e47c 100644 --- a/v3/integrations/logcontext-v2/logWriter/go.mod +++ b/v3/integrations/logcontext-v2/logWriter/go.mod @@ -1,9 +1,9 @@ module github.com/newrelic/go-agent/v3/integrations/logcontext-v2/logWriter -go 1.19 +go 1.20 require ( - github.com/newrelic/go-agent/v3 v3.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 github.com/newrelic/go-agent/v3/integrations/logcontext-v2/nrwriter v1.0.0 ) diff --git a/v3/integrations/logcontext-v2/nrlogrus/go.mod b/v3/integrations/logcontext-v2/nrlogrus/go.mod index fb1f34055..16e4e2805 100644 --- a/v3/integrations/logcontext-v2/nrlogrus/go.mod +++ b/v3/integrations/logcontext-v2/nrlogrus/go.mod @@ -1,9 +1,9 @@ module github.com/newrelic/go-agent/v3/integrations/logcontext-v2/nrlogrus -go 1.19 +go 1.20 require ( - github.com/newrelic/go-agent/v3 v3.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 github.com/sirupsen/logrus v1.8.1 ) diff --git a/v3/integrations/logcontext-v2/nrslog/go.mod b/v3/integrations/logcontext-v2/nrslog/go.mod index 4cdd8758c..cb9c8a719 100644 --- a/v3/integrations/logcontext-v2/nrslog/go.mod +++ b/v3/integrations/logcontext-v2/nrslog/go.mod @@ -1,8 +1,8 @@ module github.com/newrelic/go-agent/v3/integrations/logcontext-v2/nrslog -go 1.19 +go 1.20 -require github.com/newrelic/go-agent/v3 v3.31.0 +require github.com/newrelic/go-agent/v3 v3.32.0 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 b0e8dfa37..10f545e23 100644 --- a/v3/integrations/logcontext-v2/nrwriter/go.mod +++ b/v3/integrations/logcontext-v2/nrwriter/go.mod @@ -1,8 +1,8 @@ module github.com/newrelic/go-agent/v3/integrations/logcontext-v2/nrwriter -go 1.19 +go 1.20 -require github.com/newrelic/go-agent/v3 v3.31.0 +require github.com/newrelic/go-agent/v3 v3.32.0 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 8eb005634..d7a336e3a 100644 --- a/v3/integrations/logcontext-v2/nrzap/go.mod +++ b/v3/integrations/logcontext-v2/nrzap/go.mod @@ -1,9 +1,9 @@ module github.com/newrelic/go-agent/v3/integrations/logcontext-v2/nrzap -go 1.19 +go 1.20 require ( - github.com/newrelic/go-agent/v3 v3.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 go.uber.org/zap v1.24.0 ) diff --git a/v3/integrations/logcontext-v2/nrzerolog/go.mod b/v3/integrations/logcontext-v2/nrzerolog/go.mod index b54d7233a..d8b2781d0 100644 --- a/v3/integrations/logcontext-v2/nrzerolog/go.mod +++ b/v3/integrations/logcontext-v2/nrzerolog/go.mod @@ -1,9 +1,9 @@ module github.com/newrelic/go-agent/v3/integrations/logcontext-v2/nrzerolog -go 1.19 +go 1.20 require ( - github.com/newrelic/go-agent/v3 v3.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 github.com/rs/zerolog v1.26.1 ) diff --git a/v3/integrations/logcontext-v2/zerologWriter/go.mod b/v3/integrations/logcontext-v2/zerologWriter/go.mod index c7c423c18..dfdd583e6 100644 --- a/v3/integrations/logcontext-v2/zerologWriter/go.mod +++ b/v3/integrations/logcontext-v2/zerologWriter/go.mod @@ -1,9 +1,9 @@ module github.com/newrelic/go-agent/v3/integrations/logcontext-v2/zerologWriter -go 1.19 +go 1.20 require ( - github.com/newrelic/go-agent/v3 v3.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 github.com/newrelic/go-agent/v3/integrations/logcontext-v2/nrwriter v1.0.0 github.com/rs/zerolog v1.27.0 ) diff --git a/v3/integrations/logcontext/nrlogrusplugin/go.mod b/v3/integrations/logcontext/nrlogrusplugin/go.mod index 358ca628b..2e6ec317e 100644 --- a/v3/integrations/logcontext/nrlogrusplugin/go.mod +++ b/v3/integrations/logcontext/nrlogrusplugin/go.mod @@ -2,10 +2,10 @@ 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.19 +go 1.20 require ( - github.com/newrelic/go-agent/v3 v3.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 // v1.4.0 is required for for the log.WithContext. github.com/sirupsen/logrus v1.4.0 ) diff --git a/v3/integrations/nramqp/go.mod b/v3/integrations/nramqp/go.mod index b41a912b2..72015f620 100644 --- a/v3/integrations/nramqp/go.mod +++ b/v3/integrations/nramqp/go.mod @@ -1,9 +1,9 @@ module github.com/newrelic/go-agent/v3/integrations/nramqp -go 1.19 +go 1.20 require ( - github.com/newrelic/go-agent/v3 v3.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 github.com/rabbitmq/amqp091-go v1.9.0 ) replace github.com/newrelic/go-agent/v3 => ../.. diff --git a/v3/integrations/nrawsbedrock/go.mod b/v3/integrations/nrawsbedrock/go.mod index 785c10cee..2b7a3917d 100644 --- a/v3/integrations/nrawsbedrock/go.mod +++ b/v3/integrations/nrawsbedrock/go.mod @@ -1,6 +1,6 @@ module github.com/newrelic/go-agent/v3/integrations/nrawsbedrock -go 1.19 +go 1.20 require ( github.com/aws/aws-sdk-go-v2 v1.26.0 @@ -8,7 +8,8 @@ require ( github.com/aws/aws-sdk-go-v2/service/bedrock v1.7.3 github.com/aws/aws-sdk-go-v2/service/bedrockruntime v1.7.1 github.com/google/uuid v1.3.0 - github.com/newrelic/go-agent/v3 v3.31.0 + github.com/newrelic/go-agent/v3 v3.32.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 8f224f3d9..10a481a16 100644 --- a/v3/integrations/nrawssdk-v1/go.mod +++ b/v3/integrations/nrawssdk-v1/go.mod @@ -3,12 +3,12 @@ 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.19 +go 1.20 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.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 ) diff --git a/v3/integrations/nrawssdk-v2/go.mod b/v3/integrations/nrawssdk-v2/go.mod index b04fac799..d503c908d 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.19 +go 1.20 require ( github.com/aws/aws-sdk-go-v2 v1.16.15 @@ -11,7 +11,7 @@ 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.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 ) diff --git a/v3/integrations/nrb3/go.mod b/v3/integrations/nrb3/go.mod index ba44d1ea6..14dd3694d 100644 --- a/v3/integrations/nrb3/go.mod +++ b/v3/integrations/nrb3/go.mod @@ -1,8 +1,8 @@ module github.com/newrelic/go-agent/v3/integrations/nrb3 -go 1.19 +go 1.20 -require github.com/newrelic/go-agent/v3 v3.31.0 +require github.com/newrelic/go-agent/v3 v3.32.0 replace github.com/newrelic/go-agent/v3 => ../.. diff --git a/v3/integrations/nrecho-v3/go.mod b/v3/integrations/nrecho-v3/go.mod index 76d71b4d9..53f9ea7ee 100644 --- a/v3/integrations/nrecho-v3/go.mod +++ b/v3/integrations/nrecho-v3/go.mod @@ -2,13 +2,13 @@ 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.19 +go 1.20 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.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 ) diff --git a/v3/integrations/nrecho-v3/nrecho.go b/v3/integrations/nrecho-v3/nrecho.go index 8125265b6..9fe29f54b 100644 --- a/v3/integrations/nrecho-v3/nrecho.go +++ b/v3/integrations/nrecho-v3/nrecho.go @@ -108,7 +108,7 @@ func WrapRouter(engine *echo.Echo) { if engine != nil && newrelic.IsSecurityAgentPresent() { router := engine.Routes() for _, r := range router { - newrelic.GetSecurityAgentInterface().SendEvent("API_END_POINTS", r.Path, r.Method, r.Name) + newrelic.GetSecurityAgentInterface().SendEvent("API_END_POINTS", r.Path, r.Method, r.Handler) } } } diff --git a/v3/integrations/nrecho-v4/go.mod b/v3/integrations/nrecho-v4/go.mod index fde8e8d4c..709dae0cd 100644 --- a/v3/integrations/nrecho-v4/go.mod +++ b/v3/integrations/nrecho-v4/go.mod @@ -2,11 +2,11 @@ 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.19 +go 1.20 require ( github.com/labstack/echo/v4 v4.9.0 - github.com/newrelic/go-agent/v3 v3.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 ) diff --git a/v3/integrations/nrelasticsearch-v7/go.mod b/v3/integrations/nrelasticsearch-v7/go.mod index 109f83fcc..c1a838d43 100644 --- a/v3/integrations/nrelasticsearch-v7/go.mod +++ b/v3/integrations/nrelasticsearch-v7/go.mod @@ -2,11 +2,11 @@ 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.19 +go 1.20 require ( github.com/elastic/go-elasticsearch/v7 v7.17.0 - github.com/newrelic/go-agent/v3 v3.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 ) diff --git a/v3/integrations/nrfasthttp/examples/client-fasthttp/go.mod b/v3/integrations/nrfasthttp/examples/client-fasthttp/go.mod index f83576a4a..9a1d14830 100644 --- a/v3/integrations/nrfasthttp/examples/client-fasthttp/go.mod +++ b/v3/integrations/nrfasthttp/examples/client-fasthttp/go.mod @@ -1,9 +1,9 @@ module client-example -go 1.19 +go 1.20 require ( - github.com/newrelic/go-agent/v3 v3.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 github.com/newrelic/go-agent/v3/integrations/nrfasthttp v1.0.0 github.com/valyala/fasthttp v1.49.0 ) diff --git a/v3/integrations/nrfasthttp/examples/server-fasthttp/go.mod b/v3/integrations/nrfasthttp/examples/server-fasthttp/go.mod index ffe9afaee..a1f5053a1 100644 --- a/v3/integrations/nrfasthttp/examples/server-fasthttp/go.mod +++ b/v3/integrations/nrfasthttp/examples/server-fasthttp/go.mod @@ -1,9 +1,9 @@ module server-example -go 1.19 +go 1.20 require ( - github.com/newrelic/go-agent/v3 v3.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 github.com/newrelic/go-agent/v3/integrations/nrfasthttp v1.0.0 github.com/valyala/fasthttp v1.49.0 ) diff --git a/v3/integrations/nrfasthttp/go.mod b/v3/integrations/nrfasthttp/go.mod index 084624aa6..deaf31122 100644 --- a/v3/integrations/nrfasthttp/go.mod +++ b/v3/integrations/nrfasthttp/go.mod @@ -1,9 +1,9 @@ module github.com/newrelic/go-agent/v3/integrations/nrfasthttp -go 1.19 +go 1.20 require ( - github.com/newrelic/go-agent/v3 v3.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 github.com/valyala/fasthttp v1.49.0 ) diff --git a/v3/integrations/nrgin/go.mod b/v3/integrations/nrgin/go.mod index 151d5d70a..5b440be98 100644 --- a/v3/integrations/nrgin/go.mod +++ b/v3/integrations/nrgin/go.mod @@ -2,11 +2,11 @@ module github.com/newrelic/go-agent/v3/integrations/nrgin // As of Dec 2019, the gin go.mod file uses 1.12: // https://github.com/gin-gonic/gin/blob/master/go.mod -go 1.19 +go 1.20 require ( github.com/gin-gonic/gin v1.9.1 - github.com/newrelic/go-agent/v3 v3.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 ) diff --git a/v3/integrations/nrgorilla/go.mod b/v3/integrations/nrgorilla/go.mod index 3f90d6488..d515a54d0 100644 --- a/v3/integrations/nrgorilla/go.mod +++ b/v3/integrations/nrgorilla/go.mod @@ -2,12 +2,12 @@ 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.19 +go 1.20 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.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 ) diff --git a/v3/integrations/nrgraphgophers/go.mod b/v3/integrations/nrgraphgophers/go.mod index d31aa17fe..ca56c234e 100644 --- a/v3/integrations/nrgraphgophers/go.mod +++ b/v3/integrations/nrgraphgophers/go.mod @@ -2,12 +2,12 @@ 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.19 +go 1.20 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.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 ) diff --git a/v3/integrations/nrgraphqlgo/example/go.mod b/v3/integrations/nrgraphqlgo/example/go.mod index 6658d1500..2018d0d9d 100644 --- a/v3/integrations/nrgraphqlgo/example/go.mod +++ b/v3/integrations/nrgraphqlgo/example/go.mod @@ -1,11 +1,11 @@ module github.com/newrelic/go-agent/v3/integrations/nrgraphqlgo/example -go 1.19 +go 1.20 require ( github.com/graphql-go/graphql v0.8.1 github.com/graphql-go/graphql-go-handler v0.2.3 - github.com/newrelic/go-agent/v3 v3.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 github.com/newrelic/go-agent/v3/integrations/nrgraphqlgo v1.0.0 ) diff --git a/v3/integrations/nrgraphqlgo/go.mod b/v3/integrations/nrgraphqlgo/go.mod index f812ba0de..c99dff089 100644 --- a/v3/integrations/nrgraphqlgo/go.mod +++ b/v3/integrations/nrgraphqlgo/go.mod @@ -1,10 +1,10 @@ module github.com/newrelic/go-agent/v3/integrations/nrgraphqlgo -go 1.19 +go 1.20 require ( github.com/graphql-go/graphql v0.8.1 - github.com/newrelic/go-agent/v3 v3.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 ) diff --git a/v3/integrations/nrgrpc/go.mod b/v3/integrations/nrgrpc/go.mod index bd71b2b31..aaa6c82a2 100644 --- a/v3/integrations/nrgrpc/go.mod +++ b/v3/integrations/nrgrpc/go.mod @@ -1,12 +1,12 @@ module github.com/newrelic/go-agent/v3/integrations/nrgrpc -go 1.19 +go 1.20 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.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 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.56.3 diff --git a/v3/integrations/nrhttprouter/go.mod b/v3/integrations/nrhttprouter/go.mod index 231bd7667..a1cc04662 100644 --- a/v3/integrations/nrhttprouter/go.mod +++ b/v3/integrations/nrhttprouter/go.mod @@ -2,12 +2,12 @@ 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.19 +go 1.20 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.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 ) diff --git a/v3/integrations/nrlambda/go.mod b/v3/integrations/nrlambda/go.mod index e4ffb607b..534debcf6 100644 --- a/v3/integrations/nrlambda/go.mod +++ b/v3/integrations/nrlambda/go.mod @@ -1,10 +1,10 @@ module github.com/newrelic/go-agent/v3/integrations/nrlambda -go 1.19 +go 1.20 require ( github.com/aws/aws-lambda-go v1.41.0 - github.com/newrelic/go-agent/v3 v3.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 ) diff --git a/v3/integrations/nrlogrus/go.mod b/v3/integrations/nrlogrus/go.mod index dddba8e82..241faf5c1 100644 --- a/v3/integrations/nrlogrus/go.mod +++ b/v3/integrations/nrlogrus/go.mod @@ -2,10 +2,10 @@ 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.19 +go 1.20 require ( - github.com/newrelic/go-agent/v3 v3.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 github.com/newrelic/go-agent/v3/integrations/logcontext-v2/nrlogrus v1.0.0 // v1.1.0 is required for the Logger.GetLevel method, and is the earliest // version of logrus using modules. diff --git a/v3/integrations/nrlogxi/go.mod b/v3/integrations/nrlogxi/go.mod index 118d30cb4..c2632d57b 100644 --- a/v3/integrations/nrlogxi/go.mod +++ b/v3/integrations/nrlogxi/go.mod @@ -2,12 +2,12 @@ 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.19 +go 1.20 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.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 ) diff --git a/v3/integrations/nrmicro/go.mod b/v3/integrations/nrmicro/go.mod index d345b6d57..ee19c0d00 100644 --- a/v3/integrations/nrmicro/go.mod +++ b/v3/integrations/nrmicro/go.mod @@ -2,12 +2,12 @@ module github.com/newrelic/go-agent/v3/integrations/nrmicro // As of Dec 2019, the go-micro go.mod file uses 1.13: // https://github.com/micro/go-micro/blob/master/go.mod -go 1.19 +go 1.20 require ( github.com/golang/protobuf v1.5.4 github.com/micro/go-micro v1.8.0 - github.com/newrelic/go-agent/v3 v3.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 google.golang.org/protobuf v1.33.0 ) diff --git a/v3/integrations/nrmongo/go.mod b/v3/integrations/nrmongo/go.mod index 23103f360..078f8f0de 100644 --- a/v3/integrations/nrmongo/go.mod +++ b/v3/integrations/nrmongo/go.mod @@ -2,10 +2,10 @@ module github.com/newrelic/go-agent/v3/integrations/nrmongo // As of Dec 2019, 1.10 is the mongo-driver requirement: // https://github.com/mongodb/mongo-go-driver#requirements -go 1.19 +go 1.20 require ( - github.com/newrelic/go-agent/v3 v3.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 // mongo-driver does not support modules as of Nov 2019. go.mongodb.org/mongo-driver v1.10.2 ) diff --git a/v3/integrations/nrmssql/go.mod b/v3/integrations/nrmssql/go.mod index 77fb20cb9..dfd549cbc 100644 --- a/v3/integrations/nrmssql/go.mod +++ b/v3/integrations/nrmssql/go.mod @@ -1,10 +1,10 @@ module github.com/newrelic/go-agent/v3/integrations/nrmssql -go 1.19 +go 1.20 require ( github.com/microsoft/go-mssqldb v0.19.0 - github.com/newrelic/go-agent/v3 v3.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 ) diff --git a/v3/integrations/nrmysql/go.mod b/v3/integrations/nrmysql/go.mod index 674a4ec68..44514daa6 100644 --- a/v3/integrations/nrmysql/go.mod +++ b/v3/integrations/nrmysql/go.mod @@ -1,13 +1,13 @@ module github.com/newrelic/go-agent/v3/integrations/nrmysql // 1.10 is the Go version in mysql's go.mod -go 1.19 +go 1.20 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.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 ) diff --git a/v3/integrations/nrnats/go.mod b/v3/integrations/nrnats/go.mod index 380cdba69..56ea68997 100644 --- a/v3/integrations/nrnats/go.mod +++ b/v3/integrations/nrnats/go.mod @@ -2,12 +2,12 @@ module github.com/newrelic/go-agent/v3/integrations/nrnats // As of Jun 2023, 1.19 is the earliest version of Go tested by nats: // https://github.com/nats-io/nats.go/blob/master/.travis.yml -go 1.19 +go 1.20 require ( github.com/nats-io/nats-server v1.4.1 github.com/nats-io/nats.go v1.28.0 - github.com/newrelic/go-agent/v3 v3.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 ) diff --git a/v3/integrations/nrnats/test/go.mod b/v3/integrations/nrnats/test/go.mod index d390cbb67..7ae18f9c5 100644 --- a/v3/integrations/nrnats/test/go.mod +++ b/v3/integrations/nrnats/test/go.mod @@ -1,14 +1,14 @@ module github.com/newrelic/go-agent/v3/integrations/test // This module exists to avoid having extra nrnats module dependencies. -go 1.19 +go 1.20 replace github.com/newrelic/go-agent/v3/integrations/nrnats v1.0.0 => ../ 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.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 github.com/newrelic/go-agent/v3/integrations/nrnats v1.0.0 ) diff --git a/v3/integrations/nropenai/go.mod b/v3/integrations/nropenai/go.mod index a434d09a9..ccb8a89cc 100644 --- a/v3/integrations/nropenai/go.mod +++ b/v3/integrations/nropenai/go.mod @@ -1,10 +1,10 @@ module github.com/newrelic/go-agent/v3/integrations/nropenai -go 1.19 +go 1.20 require ( github.com/google/uuid v1.6.0 - github.com/newrelic/go-agent/v3 v3.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 github.com/pkoukk/tiktoken-go v0.1.6 github.com/sashabaranov/go-openai v1.20.2 ) diff --git a/v3/integrations/nrpgx/example/sqlx/go.mod b/v3/integrations/nrpgx/example/sqlx/go.mod index 797b84d3e..777934c00 100644 --- a/v3/integrations/nrpgx/example/sqlx/go.mod +++ b/v3/integrations/nrpgx/example/sqlx/go.mod @@ -1,10 +1,10 @@ // 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.19 +go 1.20 require ( github.com/jmoiron/sqlx v1.2.0 - github.com/newrelic/go-agent/v3 v3.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 github.com/newrelic/go-agent/v3/integrations/nrpgx v0.0.0 ) replace github.com/newrelic/go-agent/v3/integrations/nrpgx => ../../ diff --git a/v3/integrations/nrpgx/go.mod b/v3/integrations/nrpgx/go.mod index 821dd13c5..0b1539aef 100644 --- a/v3/integrations/nrpgx/go.mod +++ b/v3/integrations/nrpgx/go.mod @@ -1,11 +1,11 @@ module github.com/newrelic/go-agent/v3/integrations/nrpgx -go 1.19 +go 1.20 require ( github.com/jackc/pgx v3.6.2+incompatible github.com/jackc/pgx/v4 v4.18.2 - github.com/newrelic/go-agent/v3 v3.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 ) diff --git a/v3/integrations/nrpgx5/go.mod b/v3/integrations/nrpgx5/go.mod index 9914ca701..3f7cb5026 100644 --- a/v3/integrations/nrpgx5/go.mod +++ b/v3/integrations/nrpgx5/go.mod @@ -1,11 +1,11 @@ module github.com/newrelic/go-agent/v3/integrations/nrpgx5 -go 1.19 +go 1.20 require ( github.com/egon12/pgsnap v0.0.0-20221022154027-2847f0124ed8 github.com/jackc/pgx/v5 v5.5.4 - github.com/newrelic/go-agent/v3 v3.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 github.com/stretchr/testify v1.8.1 ) diff --git a/v3/integrations/nrpkgerrors/go.mod b/v3/integrations/nrpkgerrors/go.mod index 7830f0065..b5d3022a3 100644 --- a/v3/integrations/nrpkgerrors/go.mod +++ b/v3/integrations/nrpkgerrors/go.mod @@ -2,10 +2,10 @@ 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.19 +go 1.20 require ( - github.com/newrelic/go-agent/v3 v3.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 // v0.8.0 was the last release in 2016, and when // major development on pkg/errors stopped. github.com/pkg/errors v0.8.0 diff --git a/v3/integrations/nrpq/example/sqlx/go.mod b/v3/integrations/nrpq/example/sqlx/go.mod index 43604e893..e41cddc77 100644 --- a/v3/integrations/nrpq/example/sqlx/go.mod +++ b/v3/integrations/nrpq/example/sqlx/go.mod @@ -1,11 +1,11 @@ // 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.19 +go 1.20 require ( github.com/jmoiron/sqlx v1.2.0 github.com/lib/pq v1.1.0 - github.com/newrelic/go-agent/v3 v3.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 github.com/newrelic/go-agent/v3/integrations/nrpq v0.0.0 ) replace github.com/newrelic/go-agent/v3/integrations/nrpq => ../../ diff --git a/v3/integrations/nrpq/go.mod b/v3/integrations/nrpq/go.mod index f2c639f4d..cf01efa1f 100644 --- a/v3/integrations/nrpq/go.mod +++ b/v3/integrations/nrpq/go.mod @@ -1,12 +1,12 @@ module github.com/newrelic/go-agent/v3/integrations/nrpq -go 1.19 +go 1.20 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.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 ) diff --git a/v3/integrations/nrredis-v7/go.mod b/v3/integrations/nrredis-v7/go.mod index 9879a1878..4483f63b0 100644 --- a/v3/integrations/nrredis-v7/go.mod +++ b/v3/integrations/nrredis-v7/go.mod @@ -1,11 +1,11 @@ module github.com/newrelic/go-agent/v3/integrations/nrredis-v7 // https://github.com/go-redis/redis/blob/master/go.mod -go 1.19 +go 1.20 require ( github.com/go-redis/redis/v7 v7.0.0-beta.5 - github.com/newrelic/go-agent/v3 v3.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 ) diff --git a/v3/integrations/nrredis-v8/go.mod b/v3/integrations/nrredis-v8/go.mod index 30b446fdb..bcc60d118 100644 --- a/v3/integrations/nrredis-v8/go.mod +++ b/v3/integrations/nrredis-v8/go.mod @@ -1,11 +1,11 @@ module github.com/newrelic/go-agent/v3/integrations/nrredis-v8 // https://github.com/go-redis/redis/blob/master/go.mod -go 1.19 +go 1.20 require ( github.com/go-redis/redis/v8 v8.4.0 - github.com/newrelic/go-agent/v3 v3.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 ) diff --git a/v3/integrations/nrredis-v9/go.mod b/v3/integrations/nrredis-v9/go.mod index bd52c7fb3..7e58a6341 100644 --- a/v3/integrations/nrredis-v9/go.mod +++ b/v3/integrations/nrredis-v9/go.mod @@ -1,10 +1,10 @@ module github.com/newrelic/go-agent/v3/integrations/nrredis-v9 // https://github.com/redis/go-redis/blob/a38f75b640398bd709ee46c778a23e80e09d48b5/go.mod#L3 -go 1.19 +go 1.20 require ( - github.com/newrelic/go-agent/v3 v3.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 github.com/redis/go-redis/v9 v9.0.2 ) diff --git a/v3/integrations/nrsarama/go.mod b/v3/integrations/nrsarama/go.mod index b3fe4825e..627c0e17d 100644 --- a/v3/integrations/nrsarama/go.mod +++ b/v3/integrations/nrsarama/go.mod @@ -1,10 +1,10 @@ module github.com/newrelic/go-agent/v3/integrations/nrsarama -go 1.19 +go 1.20 require ( github.com/Shopify/sarama v1.38.1 - github.com/newrelic/go-agent/v3 v3.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 github.com/stretchr/testify v1.8.1 ) diff --git a/v3/integrations/nrsecurityagent/go.mod b/v3/integrations/nrsecurityagent/go.mod index 26f12cd40..321e774b6 100644 --- a/v3/integrations/nrsecurityagent/go.mod +++ b/v3/integrations/nrsecurityagent/go.mod @@ -1,12 +1,13 @@ module github.com/newrelic/go-agent/v3/integrations/nrsecurityagent -go 1.19 +go 1.20 require ( github.com/newrelic/csec-go-agent v1.1.0 - github.com/newrelic/go-agent/v3 v3.30.0 + github.com/newrelic/go-agent/v3 v3.32.0 github.com/newrelic/go-agent/v3/integrations/nrsqlite3 v1.2.0 gopkg.in/yaml.v2 v2.4.0 ) + replace github.com/newrelic/go-agent/v3 => ../.. diff --git a/v3/integrations/nrsnowflake/go.mod b/v3/integrations/nrsnowflake/go.mod index 3b58181da..b2e7f4b5c 100644 --- a/v3/integrations/nrsnowflake/go.mod +++ b/v3/integrations/nrsnowflake/go.mod @@ -1,9 +1,9 @@ module github.com/newrelic/go-agent/v3/integrations/nrsnowflake -go 1.19 +go 1.20 require ( - github.com/newrelic/go-agent/v3 v3.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 github.com/snowflakedb/gosnowflake v1.6.19 ) diff --git a/v3/integrations/nrsqlite3/go.mod b/v3/integrations/nrsqlite3/go.mod index c930c0569..3a6eddb79 100644 --- a/v3/integrations/nrsqlite3/go.mod +++ b/v3/integrations/nrsqlite3/go.mod @@ -2,12 +2,12 @@ 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.19 +go 1.20 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.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 ) diff --git a/v3/integrations/nrstan/examples/go.mod b/v3/integrations/nrstan/examples/go.mod index a698c1873..f57e435b4 100644 --- a/v3/integrations/nrstan/examples/go.mod +++ b/v3/integrations/nrstan/examples/go.mod @@ -1,9 +1,9 @@ module github.com/newrelic/go-agent/v3/integrations/nrstan/examples // This module exists to avoid a dependency on nrnrats. -go 1.19 +go 1.20 require ( github.com/nats-io/stan.go v0.5.0 - github.com/newrelic/go-agent/v3 v3.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 github.com/newrelic/go-agent/v3/integrations/nrnats v0.0.0 github.com/newrelic/go-agent/v3/integrations/nrstan v0.0.0 ) diff --git a/v3/integrations/nrstan/go.mod b/v3/integrations/nrstan/go.mod index af124b900..aa283ea2e 100644 --- a/v3/integrations/nrstan/go.mod +++ b/v3/integrations/nrstan/go.mod @@ -2,11 +2,11 @@ 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.19 +go 1.20 require ( github.com/nats-io/stan.go v0.10.4 - github.com/newrelic/go-agent/v3 v3.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 ) diff --git a/v3/integrations/nrstan/test/go.mod b/v3/integrations/nrstan/test/go.mod index 2c6f47a70..4708789e9 100644 --- a/v3/integrations/nrstan/test/go.mod +++ b/v3/integrations/nrstan/test/go.mod @@ -2,12 +2,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.19 +go 1.20 require ( github.com/nats-io/nats-streaming-server v0.25.6 github.com/nats-io/stan.go v0.10.4 - github.com/newrelic/go-agent/v3 v3.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 github.com/newrelic/go-agent/v3/integrations/nrstan v0.0.0 ) diff --git a/v3/integrations/nrzap/go.mod b/v3/integrations/nrzap/go.mod index e4bf61761..f3f0b26d9 100644 --- a/v3/integrations/nrzap/go.mod +++ b/v3/integrations/nrzap/go.mod @@ -2,10 +2,10 @@ 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.19 +go 1.20 require ( - github.com/newrelic/go-agent/v3 v3.31.0 + github.com/newrelic/go-agent/v3 v3.32.0 // v1.12.0 is the earliest version of zap using modules. go.uber.org/zap v1.12.0 ) From 6198f19992304410758408411c808ce03faa0e5d Mon Sep 17 00:00:00 2001 From: Steve Willoughby Date: Thu, 4 Apr 2024 12:32:57 -0700 Subject: [PATCH 19/20] release 3.32.0 --- v3/newrelic/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v3/newrelic/version.go b/v3/newrelic/version.go index 4a34de8eb..53df4c5bd 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.31.0" + Version = "3.32.0" ) var ( From 8218235632bbc5db68c935d2b33877d1c1cac1e7 Mon Sep 17 00:00:00 2001 From: Steve Willoughby Date: Thu, 4 Apr 2024 12:43:14 -0700 Subject: [PATCH 20/20] adds support statement --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 92b6c53d4..8a5dc4621 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ * Updated unit tests to check `Transaction.Ignore` * Updated `nrzap` unit tests to add background logger sugared test case. +### 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. +See the [Go agent EOL Policy](https://docs.newrelic.com/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.31.0 ### Added * Integration packages to instrument AI model invocations (see below).