Skip to content

Commit

Permalink
Merge pull request #764 from newrelic/develop
Browse files Browse the repository at this point in the history
Release 3.24.0
  • Loading branch information
nr-swilloughby committed Jul 31, 2023
2 parents ab9e248 + 5986bbc commit 046b4fc
Show file tree
Hide file tree
Showing 62 changed files with 403 additions and 66 deletions.
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
## 3.24.0

### Added
* Turned Code Level Metrics on by default
* Added new test case to check if the nrsecurityagent is enabled in the gRPC integration
* Added new test case for InfoInterceptorStatusHandler function in the gRPC integration
* Added Name() method for Transaction values to get the current transaction name.


### Fixed
* Bumped gin from 1.9.0 to 1.9.1
* Bumped gosnowflake from 1.6.16 to 1.6.19
* Bumped nrsecurityagent to 1.1.0 with improved reporting of gRPC protocol versions.
* Fixed a bug where expected errors weren't being properly marked as expected on new relic dashboards

### Support statement

We use the latest version of the Go language. At minimum, you should be using no version of Go older than what is supported by the Go team themselves (i.e., Go versions 1.19 and later are supported).

We recommend updating to the latest agent version as soon as it's available. If you can't upgrade to the latest version, update your agents to a version no more than 90 days old. Read more about keeping agents up to date. (https://docs.newrelic.com/docs/new-relic-solutions/new-relic-one/install-configure/update-new-relic-agent/)

See the [Go agent EOL Policy](/docs/apm/agents/go-agent/get-started/go-agent-eol-policy/) for details about supported versions of the Go agent and third-party components.



## 3.23.1

## Added
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Go is a compiled language, and doesn’t use a virtual machine. This means that

### Compatibility and Requirements

For the latest version of the agent, Go 1.17+ is required.
For the latest version of the agent, Go 1.18+ is required.

Linux, OS X, and Windows (Vista, Server 2008 and later) are supported.

Expand Down
4 changes: 4 additions & 0 deletions v3/go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
module github.com/newrelic/go-agent/v3

go 1.18

require (
github.com/golang/protobuf v1.5.3
google.golang.org/grpc v1.54.0
)


retract v3.22.0 // release process error corrected in v3.22.1
3 changes: 3 additions & 0 deletions v3/integrations/logcontext-v2/logWriter/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
module github.com/newrelic/go-agent/v3/integrations/logcontext-v2/logWriter

go 1.17

require (
github.com/newrelic/go-agent/v3 v3.19.1
github.com/newrelic/go-agent/v3/integrations/logcontext-v2/nrwriter v1.0.0
)

3 changes: 3 additions & 0 deletions v3/integrations/logcontext-v2/nrlogrus/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
module github.com/newrelic/go-agent/v3/integrations/logcontext-v2/nrlogrus

go 1.17

require (
github.com/newrelic/go-agent/v3 v3.18.0
github.com/sirupsen/logrus v1.8.1
)

3 changes: 3 additions & 0 deletions v3/integrations/logcontext-v2/nrwriter/go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
module github.com/newrelic/go-agent/v3/integrations/logcontext-v2/nrwriter

go 1.17

require github.com/newrelic/go-agent/v3 v3.19.1

3 changes: 3 additions & 0 deletions v3/integrations/logcontext-v2/nrzap/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
module github.com/newrelic/go-agent/v3/integrations/logcontext-v2/nrzap

go 1.18

require (
github.com/newrelic/go-agent/v3 v3.21.1
go.uber.org/zap v1.24.0
)

3 changes: 3 additions & 0 deletions v3/integrations/logcontext-v2/nrzerolog/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
module github.com/newrelic/go-agent/v3/integrations/logcontext-v2/nrzerolog

go 1.17

require (
github.com/newrelic/go-agent/v3 v3.18.0
github.com/rs/zerolog v1.26.1
)

3 changes: 3 additions & 0 deletions v3/integrations/logcontext-v2/zerologWriter/go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
module github.com/newrelic/go-agent/v3/integrations/logcontext-v2/zerologWriter

go 1.17

require (
github.com/newrelic/go-agent/v3 v3.19.1
github.com/newrelic/go-agent/v3/integrations/logcontext-v2/nrwriter v1.0.0
github.com/rs/zerolog v1.27.0
)

2 changes: 2 additions & 0 deletions v3/integrations/logcontext/nrlogrusplugin/go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
module github.com/newrelic/go-agent/v3/integrations/logcontext/nrlogrusplugin

// As of Dec 2019, the logrus go.mod file uses 1.13:
// https://github.com/sirupsen/logrus/blob/master/go.mod
go 1.13

require (
github.com/newrelic/go-agent/v3 v3.17.0
// v1.4.0 is required for for the log.WithContext.
Expand Down
4 changes: 3 additions & 1 deletion v3/integrations/nrawssdk-v1/go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,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.7

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.16.0
github.com/newrelic/go-agent/v3 v3.24.0
)
5 changes: 4 additions & 1 deletion v3/integrations/nrawssdk-v2/go.mod
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
module github.com/newrelic/go-agent/v3/integrations/nrawssdk-v2

// As of May 2021, the aws-sdk-go-v2 go.mod file uses 1.15:
// https://github.com/aws/aws-sdk-go-v2/blob/master/go.mod
go 1.17

require (
github.com/aws/aws-sdk-go-v2 v1.16.15
github.com/aws/aws-sdk-go-v2/config v1.17.6
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.17.0
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.18.2
github.com/newrelic/go-agent/v3 v3.24.0
)

5 changes: 4 additions & 1 deletion v3/integrations/nrb3/go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
module github.com/newrelic/go-agent/v3/integrations/nrb3

go 1.19
require github.com/newrelic/go-agent/v3 v3.21.1

require github.com/newrelic/go-agent/v3 v3.24.0

4 changes: 3 additions & 1 deletion v3/integrations/nrecho-v3/go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
module github.com/newrelic/go-agent/v3/integrations/nrecho-v3

// 1.7 is the earliest version of Go tested by v3.1.0:
// https://github.com/labstack/echo/blob/v3.1.0/.travis.yml
go 1.7

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.17.0
github.com/newrelic/go-agent/v3 v3.24.0
)
5 changes: 4 additions & 1 deletion v3/integrations/nrecho-v4/go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,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.17

require (
github.com/labstack/echo/v4 v4.9.0
github.com/newrelic/go-agent/v3 v3.18.2
github.com/newrelic/go-agent/v3 v3.24.0
)

4 changes: 3 additions & 1 deletion v3/integrations/nrelasticsearch-v7/go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
module github.com/newrelic/go-agent/v3/integrations/nrelasticsearch-v7

// As of Jan 2020, the v7 elasticsearch go.mod uses 1.11:
// https://github.com/elastic/go-elasticsearch/blob/7.x/go.mod
go 1.11

require (
github.com/elastic/go-elasticsearch/v7 v7.17.0
github.com/newrelic/go-agent/v3 v3.17.0
github.com/newrelic/go-agent/v3 v3.24.0
)
8 changes: 6 additions & 2 deletions v3/integrations/nrgin/go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
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

require (
github.com/gin-gonic/gin v1.9.0
github.com/newrelic/go-agent/v3 v3.23.0
github.com/gin-gonic/gin v1.9.1
github.com/newrelic/go-agent/v3 v3.24.0
)


replace github.com/newrelic/go-agent/v3 => ../..
8 changes: 8 additions & 0 deletions v3/integrations/nrgin/nrgin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,10 @@ func TestStatusCodes(t *testing.T) {
"request.method": "GET",
"request.uri": "/err",
"response.headers.contentType": "text/plain; charset=utf-8",
"code.function": internal.MatchAnything,
"code.namespace": internal.MatchAnything,
"code.filepath": internal.MatchAnything,
"code.lineno": internal.MatchAnything,
},
}})
}
Expand Down Expand Up @@ -338,6 +342,10 @@ func TestNoResponseBody(t *testing.T) {
"http.statusCode": expectCode,
"request.method": "GET",
"request.uri": "/nobody",
"code.function": internal.MatchAnything,
"code.namespace": internal.MatchAnything,
"code.filepath": internal.MatchAnything,
"code.lineno": internal.MatchAnything,
},
}})
}
Expand Down
4 changes: 3 additions & 1 deletion v3/integrations/nrgorilla/go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
module github.com/newrelic/go-agent/v3/integrations/nrgorilla

// As of Dec 2019, the gorilla/mux go.mod file uses 1.12:
// https://github.com/gorilla/mux/blob/master/go.mod
go 1.12

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.17.0
github.com/newrelic/go-agent/v3 v3.24.0
)
2 changes: 1 addition & 1 deletion v3/integrations/nrgraphgophers/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ go 1.13
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.17.0
github.com/newrelic/go-agent/v3 v3.24.0
)
4 changes: 3 additions & 1 deletion v3/integrations/nrgraphqlgo/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module github.com/newrelic/go-agent/v3/integrations/nrgraphqlgo

go 1.13

require (
github.com/graphql-go/graphql v0.7.9
github.com/newrelic/go-agent/v3 v3.17.0
github.com/newrelic/go-agent/v3 v3.24.0
)
8 changes: 7 additions & 1 deletion v3/integrations/nrgrpc/go.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
module github.com/newrelic/go-agent/v3/integrations/nrgrpc

go 1.19

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.23.0
github.com/newrelic/go-agent/v3 v3.24.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.54.0
google.golang.org/protobuf v1.28.1
)


replace github.com/newrelic/go-agent/v3 => ../..
15 changes: 14 additions & 1 deletion v3/integrations/nrgrpc/nrgrpc_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"testing"

"github.com/newrelic/go-agent/v3/integrations/nrgrpc/testapp"
"github.com/newrelic/go-agent/v3/integrations/nrsecurityagent"
"github.com/newrelic/go-agent/v3/internal"
"github.com/newrelic/go-agent/v3/internal/integrationsupport"
newrelic "github.com/newrelic/go-agent/v3/newrelic"
Expand Down Expand Up @@ -75,7 +76,7 @@ func TestGetURL(t *testing.T) {
}

func testApp() integrationsupport.ExpectApp {
return integrationsupport.NewTestApp(replyFn, integrationsupport.ConfigFullTraces)
return integrationsupport.NewTestApp(replyFn, integrationsupport.ConfigFullTraces, newrelic.ConfigCodeLevelMetricsEnabled(false))
}

var replyFn = func(reply *internal.ConnectReply) {
Expand Down Expand Up @@ -609,3 +610,15 @@ func TestClientStreamingError(t *testing.T) {
},
}})
}

func TestClientSecurityAgentEnabled(t *testing.T) {
app := testApp()
err := nrsecurityagent.InitSecurityAgent(app.Application,
nrsecurityagent.ConfigSecurityMode("IAST"),
nrsecurityagent.ConfigSecurityValidatorServiceEndPointUrl("wss://csec.nr-data.net"),
nrsecurityagent.ConfigSecurityEnable(true),
)
if err != nil {
t.Fatal("Could not setup the nrsecurityagent", err)
}
}
34 changes: 30 additions & 4 deletions v3/integrations/nrgrpc/nrgrpc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ import (
"net/http"
"strings"

protoV1 "github.com/golang/protobuf/proto"
"github.com/newrelic/go-agent/v3/newrelic"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
protoV2 "google.golang.org/protobuf/proto"
)

func startTransaction(ctx context.Context, app *newrelic.Application, fullMethod string) *newrelic.Transaction {
Expand Down Expand Up @@ -309,7 +311,11 @@ func UnaryServerInterceptor(app *newrelic.Application, options ...HandlerOption)

return func(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp any, err error) {
txn := startTransaction(ctx, app, info.FullMethod)
newrelic.GetSecurityAgentInterface().SendEvent("GRPC", req)

if newrelic.IsSecurityAgentPresent() {
messageType, version := getMessageType(req)
newrelic.GetSecurityAgentInterface().SendEvent("GRPC", req, messageType, version)
}
defer txn.End()

ctx = newrelic.NewContext(ctx, txn)
Expand All @@ -330,7 +336,10 @@ func (s wrappedServerStream) Context() context.Context {
}

func (s wrappedServerStream) RecvMsg(msg any) error {
newrelic.GetSecurityAgentInterface().SendEvent("GRPC", msg)
if newrelic.IsSecurityAgentPresent() {
messageType, version := getMessageType(msg)
newrelic.GetSecurityAgentInterface().SendEvent("GRPC", msg, messageType, version)
}
return s.ServerStream.RecvMsg(msg)
}

Expand All @@ -350,7 +359,6 @@ func newWrappedServerStream(stream grpc.ServerStream, txn *newrelic.Transaction)
// streaming calls.
//
// See the notes and examples for the UnaryServerInterceptor function.
//
func StreamServerInterceptor(app *newrelic.Application, options ...HandlerOption) grpc.StreamServerInterceptor {
if app == nil {
return func(srv any, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
Expand All @@ -369,9 +377,27 @@ func StreamServerInterceptor(app *newrelic.Application, options ...HandlerOption
return func(srv any, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
txn := startTransaction(ss.Context(), app, info.FullMethod)
defer txn.End()

if newrelic.IsSecurityAgentPresent() {
newrelic.GetSecurityAgentInterface().SendEvent("GRPC_INFO", info.IsClientStream, info.IsServerStream)
}
err := handler(srv, newWrappedServerStream(ss, txn))
reportInterceptorStatus(ss.Context(), txn, localHandlerMap, err)
return err
}
}

func getMessageType(req any) (string, string) {
messageType := ""
version := "v2"
messagev2, ok := req.(protoV2.Message)
if ok {
messageType = string(messagev2.ProtoReflect().Descriptor().FullName())
} else {
messagev1, ok := req.(protoV1.Message)
if ok {
messageType = string(protoV1.MessageReflect(messagev1).Descriptor().FullName())
version = "v1"
}
}
return messageType, version
}
Loading

0 comments on commit 046b4fc

Please sign in to comment.