Skip to content

Commit cab3b31

Browse files
Merge pull request #929 from newrelic/develop
Release 3.33.1
2 parents 424d175 + 4076dc0 commit cab3b31

File tree

72 files changed

+309
-152
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+309
-152
lines changed

CHANGELOG.md

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
## 3.33.1
2+
### Added
3+
- Increased max span events default limit to 2,000 to align with agent specifications
4+
- Added support for gRPC API endpoints and HTTP status codes in the nrsecurity integration
5+
- Added feature to detect route of an incoming request for all supported frameworks in the nrsecurity integration.
6+
- Updated support for latest New Relic Security Agent release.
7+
### Fixed
8+
- Fixed an issue with nrzap attributes not properly being forwarded
9+
- Improved comments on nropenai
10+
- Fixed a minor bug relating to ExpectStatusCodes in `app_run.go`
11+
### Support statement
12+
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.
13+
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.
14+
15+
116
## 3.33.0
217
### Added
318
- Support for Zap Field Attributes

v3/integrations/logcontext-v2/logWriter/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/newrelic/go-agent/v3/integrations/logcontext-v2/logWriter
33
go 1.20
44

55
require (
6-
github.com/newrelic/go-agent/v3 v3.32.0
6+
github.com/newrelic/go-agent/v3 v3.33.1
77
github.com/newrelic/go-agent/v3/integrations/logcontext-v2/nrwriter v1.0.0
88
)
99

v3/integrations/logcontext-v2/nrlogrus/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/newrelic/go-agent/v3/integrations/logcontext-v2/nrlogrus
33
go 1.20
44

55
require (
6-
github.com/newrelic/go-agent/v3 v3.32.0
6+
github.com/newrelic/go-agent/v3 v3.33.1
77
github.com/sirupsen/logrus v1.8.1
88
)
99

v3/integrations/logcontext-v2/nrslog/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module github.com/newrelic/go-agent/v3/integrations/logcontext-v2/nrslog
22

33
go 1.20
44

5-
require github.com/newrelic/go-agent/v3 v3.32.0
5+
require github.com/newrelic/go-agent/v3 v3.33.1
66

77

88
replace github.com/newrelic/go-agent/v3 => ../../..

v3/integrations/logcontext-v2/nrwriter/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module github.com/newrelic/go-agent/v3/integrations/logcontext-v2/nrwriter
22

33
go 1.20
44

5-
require github.com/newrelic/go-agent/v3 v3.32.0
5+
require github.com/newrelic/go-agent/v3 v3.33.1
66

77

88
replace github.com/newrelic/go-agent/v3 => ../../..

v3/integrations/logcontext-v2/nrzap/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/newrelic/go-agent/v3/integrations/logcontext-v2/nrzap
33
go 1.20
44

55
require (
6-
github.com/newrelic/go-agent/v3 v3.32.0
6+
github.com/newrelic/go-agent/v3 v3.33.1
77
go.uber.org/zap v1.24.0
88
)
99

v3/integrations/logcontext-v2/nrzap/nrzap.go

+14-11
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ func init() { internal.TrackUsage("integration", "logcontext-v2", "zap") }
1515

1616
// NewRelicZapCore implements zap.Core
1717
type NewRelicZapCore struct {
18-
core zapcore.Core
19-
nr newrelicApplicationState
18+
fields []zap.Field
19+
core zapcore.Core
20+
nr newrelicApplicationState
2021
}
2122

2223
// newrelicApplicationState is a private struct that stores newrelic application data
@@ -147,7 +148,7 @@ func WrapBackgroundCore(core zapcore.Core, app *newrelic.Application) (*NewRelic
147148
// Errors will be returned if the zapcore object is nil, or if the application is nil. It is up to the user to decide
148149
// how to handle the case where the newrelic.Transaction is nil.
149150
// In the case that the newrelic.Application is nil, a valid NewRelicZapCore object will still be returned.
150-
func WrapTransactionCore(core zapcore.Core, txn *newrelic.Transaction) (*NewRelicZapCore, error) {
151+
func WrapTransactionCore(core zapcore.Core, txn *newrelic.Transaction) (zapcore.Core, error) {
151152
if core == nil {
152153
return nil, ErrNilZapcore
153154
}
@@ -167,9 +168,10 @@ func WrapTransactionCore(core zapcore.Core, txn *newrelic.Transaction) (*NewReli
167168
// With makes a copy of a NewRelicZapCore with new zap.Fields. It calls zapcore.With() on the zap core object
168169
// then makes a deepcopy of the NewRelicApplicationState object so the original
169170
// object can be deallocated when it's no longer in scope.
170-
func (c NewRelicZapCore) With(fields []zap.Field) zapcore.Core {
171-
return NewRelicZapCore{
172-
core: c.core.With(fields),
171+
func (c *NewRelicZapCore) With(fields []zap.Field) zapcore.Core {
172+
return &NewRelicZapCore{
173+
core: c.core.With(fields),
174+
fields: append(fields, c.fields...),
173175
nr: newrelicApplicationState{
174176
c.nr.app,
175177
c.nr.txn,
@@ -178,24 +180,25 @@ func (c NewRelicZapCore) With(fields []zap.Field) zapcore.Core {
178180
}
179181

180182
// Check simply calls zapcore.Check on the Core object.
181-
func (c NewRelicZapCore) Check(entry zapcore.Entry, checkedEntry *zapcore.CheckedEntry) *zapcore.CheckedEntry {
183+
func (c *NewRelicZapCore) Check(entry zapcore.Entry, checkedEntry *zapcore.CheckedEntry) *zapcore.CheckedEntry {
182184
ce := c.core.Check(entry, checkedEntry)
183185
ce.AddCore(entry, c)
184186
return ce
185187
}
186188

187189
// Write wraps zapcore.Write and captures the log entry and sends that data to New Relic.
188-
func (c NewRelicZapCore) Write(entry zapcore.Entry, fields []zap.Field) error {
189-
c.nr.recordLog(entry, fields)
190+
func (c *NewRelicZapCore) Write(entry zapcore.Entry, fields []zap.Field) error {
191+
allFields := append(fields, c.fields...)
192+
c.nr.recordLog(entry, allFields)
190193
return nil
191194
}
192195

193196
// Sync simply calls zapcore.Sync on the Core object.
194-
func (c NewRelicZapCore) Sync() error {
197+
func (c *NewRelicZapCore) Sync() error {
195198
return c.core.Sync()
196199
}
197200

198201
// Enabled simply calls zapcore.Enabled on the zapcore.Level passed to it.
199-
func (c NewRelicZapCore) Enabled(level zapcore.Level) bool {
202+
func (c *NewRelicZapCore) Enabled(level zapcore.Level) bool {
200203
return c.core.Enabled(level)
201204
}

v3/integrations/logcontext-v2/nrzap/nrzap_test.go

+5
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ func TestTransactionLoggerWithFields(t *testing.T) {
160160
t.Error(err)
161161
}
162162

163+
wrappedCore = wrappedCore.With([]zapcore.Field{
164+
zap.String("foo", "bar"),
165+
})
166+
163167
logger := zap.New(wrappedCore)
164168

165169
msg := "this is a test info message"
@@ -186,6 +190,7 @@ func TestTransactionLoggerWithFields(t *testing.T) {
186190
"duration": 1 * time.Second,
187191
"int": 123,
188192
"bool": true,
193+
"foo": "bar",
189194
},
190195
Severity: zap.InfoLevel.String(),
191196
Message: msg,

v3/integrations/logcontext-v2/nrzerolog/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/newrelic/go-agent/v3/integrations/logcontext-v2/nrzerolog
33
go 1.20
44

55
require (
6-
github.com/newrelic/go-agent/v3 v3.32.0
6+
github.com/newrelic/go-agent/v3 v3.33.1
77
github.com/rs/zerolog v1.26.1
88
)
99

v3/integrations/logcontext-v2/zerologWriter/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/newrelic/go-agent/v3/integrations/logcontext-v2/zerologWriter
33
go 1.20
44

55
require (
6-
github.com/newrelic/go-agent/v3 v3.32.0
6+
github.com/newrelic/go-agent/v3 v3.33.1
77
github.com/newrelic/go-agent/v3/integrations/logcontext-v2/nrwriter v1.0.0
88
github.com/rs/zerolog v1.27.0
99
)

v3/integrations/logcontext/nrlogrusplugin/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module github.com/newrelic/go-agent/v3/integrations/logcontext/nrlogrusplugin
55
go 1.20
66

77
require (
8-
github.com/newrelic/go-agent/v3 v3.32.0
8+
github.com/newrelic/go-agent/v3 v3.33.1
99
// v1.4.0 is required for for the log.WithContext.
1010
github.com/sirupsen/logrus v1.4.0
1111
)

v3/integrations/nramqp/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/newrelic/go-agent/v3/integrations/nramqp
33
go 1.20
44

55
require (
6-
github.com/newrelic/go-agent/v3 v3.32.0
6+
github.com/newrelic/go-agent/v3 v3.33.1
77
github.com/rabbitmq/amqp091-go v1.9.0
88
)
99
replace github.com/newrelic/go-agent/v3 => ../..

v3/integrations/nrawsbedrock/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require (
88
github.com/aws/aws-sdk-go-v2/service/bedrock v1.7.3
99
github.com/aws/aws-sdk-go-v2/service/bedrockruntime v1.7.1
1010
github.com/google/uuid v1.3.0
11-
github.com/newrelic/go-agent/v3 v3.32.0
11+
github.com/newrelic/go-agent/v3 v3.33.1
1212
)
1313

1414

v3/integrations/nrawssdk-v1/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ go 1.20
88
require (
99
// v1.15.0 is the first aws-sdk-go version with module support.
1010
github.com/aws/aws-sdk-go v1.34.0
11-
github.com/newrelic/go-agent/v3 v3.32.0
11+
github.com/newrelic/go-agent/v3 v3.33.1
1212
)
1313

1414

v3/integrations/nrawssdk-v2/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ require (
1111
github.com/aws/aws-sdk-go-v2/service/lambda v1.24.5
1212
github.com/aws/aws-sdk-go-v2/service/s3 v1.27.10
1313
github.com/aws/smithy-go v1.13.3
14-
github.com/newrelic/go-agent/v3 v3.32.0
14+
github.com/newrelic/go-agent/v3 v3.33.1
1515
)
1616

1717

v3/integrations/nrb3/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module github.com/newrelic/go-agent/v3/integrations/nrb3
22

33
go 1.20
44

5-
require github.com/newrelic/go-agent/v3 v3.32.0
5+
require github.com/newrelic/go-agent/v3 v3.33.1
66

77

88
replace github.com/newrelic/go-agent/v3 => ../..

v3/integrations/nrecho-v3/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require (
88
// v3.1.0 is the earliest v3 version of Echo that works with modules due
99
// to the github.com/rsc/letsencrypt import of v3.0.0.
1010
github.com/labstack/echo v3.1.0+incompatible
11-
github.com/newrelic/go-agent/v3 v3.32.0
11+
github.com/newrelic/go-agent/v3 v3.33.1
1212
)
1313

1414

v3/integrations/nrecho-v3/nrecho.go

+14-12
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ func handlerName(router interface{}) string {
5151
}
5252
}
5353

54-
func transactionName(c echo.Context) string {
54+
func transactionName(c echo.Context) (string, string) {
5555
ptr := handlerPointer(c.Handler())
5656
if ptr == handlerPointer(echo.NotFoundHandler) {
57-
return "NotFoundHandler"
57+
return "NotFoundHandler", ""
5858
}
5959
if ptr == handlerPointer(echo.MethodNotAllowedHandler) {
60-
return "MethodNotAllowedHandler"
60+
return "MethodNotAllowedHandler", ""
6161
}
62-
return c.Request().Method + " " + c.Path()
62+
return c.Request().Method + " " + c.Path(), c.Path()
6363
}
6464

6565
// Middleware creates Echo middleware that instruments requests.
@@ -77,9 +77,12 @@ func Middleware(app *newrelic.Application) func(echo.HandlerFunc) echo.HandlerFu
7777
return func(next echo.HandlerFunc) echo.HandlerFunc {
7878
return func(c echo.Context) (err error) {
7979
rw := c.Response().Writer
80-
txn := app.StartTransaction(transactionName(c))
80+
tName, route := transactionName(c)
81+
txn := app.StartTransaction(tName)
8182
defer txn.End()
82-
83+
if newrelic.IsSecurityAgentPresent() {
84+
txn.SetCsecAttributes(newrelic.AttributeCsecRoute, route)
85+
}
8386
txn.SetWebRequestHTTP(c.Request())
8487

8588
c.Response().Writer = txn.SetWebResponse(rw)
@@ -112,14 +115,13 @@ func Middleware(app *newrelic.Application) func(echo.HandlerFunc) echo.HandlerFu
112115
// which is used to detect application URL mapping(api-endpoints) for provable security.
113116
// 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],
114117
// but it may be enhanced to provide additional functionality in future releases.
115-
// e := echo.New()
116-
// ....
117-
// ....
118-
// ....
119118
//
120-
// nrecho.WrapRouter(e)
119+
// e := echo.New()
120+
// ....
121+
// ....
122+
// ....
121123
//
122-
124+
// nrecho.WrapRouter(e)
123125
func WrapRouter(engine *echo.Echo) {
124126
if engine != nil && newrelic.IsSecurityAgentPresent() {
125127
router := engine.Routes()

v3/integrations/nrecho-v4/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ go 1.20
66

77
require (
88
github.com/labstack/echo/v4 v4.9.0
9-
github.com/newrelic/go-agent/v3 v3.32.0
9+
github.com/newrelic/go-agent/v3 v3.33.1
1010
)
1111

1212

v3/integrations/nrecho-v4/nrecho.go

+14-12
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ func handlerPointer(handler echo.HandlerFunc) uintptr {
3535
return reflect.ValueOf(handler).Pointer()
3636
}
3737

38-
func transactionName(c echo.Context) string {
38+
func transactionName(c echo.Context) (string, string) {
3939
ptr := handlerPointer(c.Handler())
4040
if ptr == handlerPointer(echo.NotFoundHandler) {
41-
return "NotFoundHandler"
41+
return "NotFoundHandler", ""
4242
}
4343
if ptr == handlerPointer(echo.MethodNotAllowedHandler) {
44-
return "MethodNotAllowedHandler"
44+
return "MethodNotAllowedHandler", ""
4545
}
46-
return c.Request().Method + " " + c.Path()
46+
return c.Request().Method + " " + c.Path(), c.Path()
4747
}
4848

4949
// Skipper defines a function to skip middleware. Returning true skips processing
@@ -100,9 +100,12 @@ func Middleware(app *newrelic.Application, opts ...ConfigOption) func(echo.Handl
100100
}
101101

102102
rw := c.Response().Writer
103-
txn := config.App.StartTransaction(transactionName(c))
103+
tname, path := transactionName(c)
104+
txn := config.App.StartTransaction(tname)
104105
defer txn.End()
105-
106+
if newrelic.IsSecurityAgentPresent() {
107+
txn.SetCsecAttributes(newrelic.AttributeCsecRoute, path)
108+
}
106109
txn.SetWebRequestHTTP(c.Request())
107110

108111
c.Response().Writer = txn.SetWebResponse(rw)
@@ -135,14 +138,13 @@ func Middleware(app *newrelic.Application, opts ...ConfigOption) func(echo.Handl
135138
// which is used to detect application URL mapping(api-endpoints) for provable security.
136139
// 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],
137140
// but it may be enhanced to provide additional functionality in future releases.
138-
// e := echo.New()
139-
// ....
140-
// ....
141-
// ....
142141
//
143-
// nrecho.WrapRouter(e)
142+
// e := echo.New()
143+
// ....
144+
// ....
145+
// ....
144146
//
145-
147+
// nrecho.WrapRouter(e)
146148
func WrapRouter(engine *echo.Echo) {
147149
if engine != nil && newrelic.IsSecurityAgentPresent() {
148150
router := engine.Routes()

v3/integrations/nrelasticsearch-v7/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ go 1.20
66

77
require (
88
github.com/elastic/go-elasticsearch/v7 v7.17.0
9-
github.com/newrelic/go-agent/v3 v3.32.0
9+
github.com/newrelic/go-agent/v3 v3.33.1
1010
)
1111

1212

v3/integrations/nrfasthttp/examples/client-fasthttp/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module client-example
33
go 1.20
44

55
require (
6-
github.com/newrelic/go-agent/v3 v3.32.0
6+
github.com/newrelic/go-agent/v3 v3.33.1
77
github.com/newrelic/go-agent/v3/integrations/nrfasthttp v1.0.0
88
github.com/valyala/fasthttp v1.49.0
99
)

v3/integrations/nrfasthttp/examples/server-fasthttp/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module server-example
33
go 1.20
44

55
require (
6-
github.com/newrelic/go-agent/v3 v3.32.0
6+
github.com/newrelic/go-agent/v3 v3.33.1
77
github.com/newrelic/go-agent/v3/integrations/nrfasthttp v1.0.0
88
github.com/valyala/fasthttp v1.49.0
99
)

v3/integrations/nrfasthttp/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/newrelic/go-agent/v3/integrations/nrfasthttp
33
go 1.20
44

55
require (
6-
github.com/newrelic/go-agent/v3 v3.32.0
6+
github.com/newrelic/go-agent/v3 v3.33.1
77
github.com/valyala/fasthttp v1.49.0
88
)
99

0 commit comments

Comments
 (0)