Skip to content

Commit 6c84bcf

Browse files
authored
Merge pull request #945 from newrelic/develop
Release 3.34.0
2 parents dd2e359 + b838457 commit 6c84bcf

33 files changed

+918
-47
lines changed

.github/auto_assign.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
addReviewers: true
33

44
# Set to true to add assignees to pull requests
5-
addAssignees: false
5+
addAssignees: true
66

77
# A list of reviewers to be added to pull requests (GitHub user name)
88
reviewers:

.github/workflows/autoassign.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ jobs:
77
add-reviews:
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: kentaro-m/auto-assign-action@v1.2.0
10+
- uses: kentaro-m/auto-assign-action@v2.0.0

.github/workflows/ci.yaml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ name: Go Agent CI
44
on: pull_request
55
env:
66
# Specifies which go version to run integration tests on
7-
INTEGRATION_TESTS_GO_VERSION: 1.21.5
7+
INTEGRATION_TESTS_GO_VERSION: latest
88

99
jobs:
1010
go-agent-v3:
@@ -15,11 +15,13 @@ jobs:
1515
matrix:
1616
include:
1717
# Core Tests on 3 most recent major Go versions
18-
- go-version: 1.19.0
18+
- go-version: 1.20.14
1919
dirs: v3/newrelic,v3/internal,v3/examples
20-
- go-version: 1.20.0
20+
- go-version: 1.21
2121
dirs: v3/newrelic,v3/internal,v3/examples
22-
- go-version: 1.21.0
22+
- go-version: latest
23+
dirs: v3/newrelic,v3/internal,v3/examples
24+
- go-version: 1.23rc2
2325
dirs: v3/newrelic,v3/internal,v3/examples
2426

2527
# Integration Tests on highest Supported Go Version
@@ -68,6 +70,7 @@ jobs:
6870
- dirs: v3/integrations/nrgraphqlgo,v3/integrations/nrgraphqlgo/example
6971
- dirs: v3/integrations/nrmssql
7072
- dirs: v3/integrations/nropenai
73+
- dirs: v3/integrations/nrslog
7174
steps:
7275
- name: Checkout Code
7376
uses: actions/checkout@v2
@@ -106,11 +109,11 @@ jobs:
106109
matrix:
107110
include:
108111
# Core Tests on 3 most recent major Go versions
109-
- go-version: 1.19.0
112+
- go-version: 1.20.14
110113
dirs: v3/newrelic,v3/internal,v3/examples
111-
- go-version: 1.20.0
114+
- go-version: 1.21
112115
dirs: v3/newrelic,v3/internal,v3/examples
113-
- go-version: 1.21.0
116+
- go-version: latest
114117
dirs: v3/newrelic,v3/internal,v3/examples
115118
steps:
116119
- name: Checkout Code

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
## 3.34.0
2+
### Added
3+
- logcontext-v2/nrlogrus can now collect user attributes
4+
- logcontext-v2/nrslog can now collect user attributes
5+
- use slog to manage Go agent logs with the new nrslog library
6+
- use zerolog go manage Go agent logs with the new nrzerolog library
7+
- support for `RegisterTLSConfig` in nrmysql
8+
### Fixed
9+
- logcontext-v2/nrlogrus will still print user logs without isses if the Go agent has already been shut down.
10+
- switched protobuff to google.golang.org/protobuff in modfile
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.1
217
### Added
318
- Increased max span events default limit to 2,000 to align with agent specifications

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This file is used to build the docker image for the Go Agent's GitHub Action tests
22
# Default go version if no arguments passed in
3-
ARG GO_VERSION=1.19
3+
ARG GO_VERSION=1.20
44

55
# Takes in go version
66
FROM golang:${GO_VERSION} as builder

GUIDE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,13 @@ if nil == err {
137137
}
138138
```
139139

140-
Popular logging libraries `logrus`, `logxi` and `zap` are supported by
140+
Popular logging libraries `logrus`, `logxi`, `zap` and `zerolog` are supported by
141141
integration packages:
142142

143143
* [v3/integrations/nrlogrus](https://godoc.org/github.com/newrelic/go-agent/v3/integrations/nrlogrus/)
144144
* [v3/integrations/nrlogxi](https://godoc.org/github.com/newrelic/go-agent/v3/integrations/nrlogxi/)
145145
* [v3/integrations/nrzap](https://godoc.org/github.com/newrelic/go-agent/v3/integrations/nrzap/)
146+
* [v3/integrations/nrzerolog](https://godoc.org/github.com/newrelic/go-agent/v3/integrations/nrzerolog/)
146147

147148
## Transactions
148149

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,13 @@ package primitives can be found [here](GUIDE.md#datastore-segments).
112112

113113
#### Agent Logging
114114

115-
| Project | Integration Package | |
116-
| ------------- | ------------- | - |
117-
| [sirupsen/logrus](https://github.com/sirupsen/logrus) | [v3/integrations/nrlogrus](https://godoc.org/github.com/newrelic/go-agent/v3/integrations/nrlogrus) | Send agent log messages to Logrus |
118-
| [mgutz/logxi](https://github.com/mgutz/logxi) | [v3/integrations/nrlogxi](https://godoc.org/github.com/newrelic/go-agent/v3/integrations/nrlogxi) | Send agent log messages to Logxi |
119-
| [uber-go/zap](https://github.com/uber-go/zap) | [v3/integrations/nrzap](https://godoc.org/github.com/newrelic/go-agent/v3/integrations/nrzap) | Send agent log messages to Zap |
115+
| Project | Integration Package | |
116+
|-------------------------------------------------------|-----------------------------------------------------------------------------------------------------|---------------------------------------|
117+
| [sirupsen/logrus](https://github.com/sirupsen/logrus) | [v3/integrations/nrlogrus](https://godoc.org/github.com/newrelic/go-agent/v3/integrations/nrlogrus) | Send agent log messages to Logrus |
118+
| [mgutz/logxi](https://github.com/mgutz/logxi) | [v3/integrations/nrlogxi](https://godoc.org/github.com/newrelic/go-agent/v3/integrations/nrlogxi) | Send agent log messages to Logxi |
119+
| [uber-go/zap](https://github.com/uber-go/zap) | [v3/integrations/nrzap](https://godoc.org/github.com/newrelic/go-agent/v3/integrations/nrzap) | Send agent log messages to Zap |
120+
| [log/slog](https://pkg.go.dev/log/slog) | [v3/integrations/nrslog](https://godoc.org/github.com/newrelic/go-agent/v3/integrations/nrslog) | Send agent log messages to `log/slog` |
121+
| [rs/zerolog](https://github.com/rs/zerolog) | [v3/integrations/nrzerolog](https://godoc.org/github.com/newrelic/go-agent/v3/integrations/nrzerolog) | Send agent log messages to Zerolog |
120122

121123
#### Logs in Context
122124

v3/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/newrelic/go-agent/v3
33
go 1.20
44

55
require (
6-
github.com/golang/protobuf v1.5.3
6+
google.golang.org/protobuf v1.5.3
77
google.golang.org/grpc v1.56.3
88
)
99

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ func NewFormatter(app *newrelic.Application, formatter logrus.Formatter) Context
3030
// Format renders a single log entry.
3131
func (f ContextFormatter) Format(e *logrus.Entry) ([]byte, error) {
3232
logData := newrelic.LogData{
33-
Severity: e.Level.String(),
34-
Message: e.Message,
33+
Severity: e.Level.String(),
34+
Message: e.Message,
35+
Attributes: e.Data,
3536
}
3637

3738
logBytes, err := f.formatter.Format(e)

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

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,32 @@ func TestBackgroundLog(t *testing.T) {
114114
})
115115
}
116116

117+
func TestBackgroundLogWithFields(t *testing.T) {
118+
app := integrationsupport.NewTestApp(integrationsupport.SampleEverythingReplyFn,
119+
newrelic.ConfigAppLogDecoratingEnabled(true),
120+
newrelic.ConfigAppLogForwardingEnabled(true),
121+
)
122+
out := bytes.NewBuffer([]byte{})
123+
log := newTextLogger(out, app.Application)
124+
message := "Hello World!"
125+
log.WithField("test field", []string{"a", "b"}).Info(message)
126+
logcontext.ValidateDecoratedOutput(t, out, &logcontext.DecorationExpect{
127+
EntityGUID: integrationsupport.TestEntityGUID,
128+
Hostname: host,
129+
EntityName: integrationsupport.SampleAppName,
130+
})
131+
app.ExpectLogEvents(t, []internal.WantLog{
132+
{
133+
Severity: logrus.InfoLevel.String(),
134+
Message: message,
135+
Timestamp: internal.MatchAnyUnixMilli,
136+
Attributes: map[string]interface{}{
137+
"test field": []string{"a", "b"},
138+
},
139+
},
140+
})
141+
}
142+
117143
func TestJSONBackgroundLog(t *testing.T) {
118144
app := integrationsupport.NewTestApp(integrationsupport.SampleEverythingReplyFn,
119145
newrelic.ConfigAppLogDecoratingEnabled(true),
@@ -192,3 +218,39 @@ func TestLogInContext(t *testing.T) {
192218

193219
txn.End()
194220
}
221+
222+
func TestLogInContextWithFields(t *testing.T) {
223+
app := integrationsupport.NewTestApp(integrationsupport.SampleEverythingReplyFn,
224+
newrelic.ConfigAppLogDecoratingEnabled(true),
225+
newrelic.ConfigAppLogForwardingEnabled(true),
226+
)
227+
out := bytes.NewBuffer([]byte{})
228+
log := newTextLogger(out, app.Application)
229+
txn := app.StartTransaction("test txn")
230+
231+
ctx := newrelic.NewContext(context.Background(), txn)
232+
message := "Hello World!"
233+
log.WithField("hi", 1).WithContext(ctx).Info(message)
234+
235+
logcontext.ValidateDecoratedOutput(t, out, &logcontext.DecorationExpect{
236+
EntityGUID: integrationsupport.TestEntityGUID,
237+
Hostname: host,
238+
EntityName: integrationsupport.SampleAppName,
239+
TraceID: txn.GetLinkingMetadata().TraceID,
240+
SpanID: txn.GetLinkingMetadata().SpanID,
241+
})
242+
txn.ExpectLogEvents(t, []internal.WantLog{
243+
{
244+
Severity: logrus.InfoLevel.String(),
245+
Message: message,
246+
Timestamp: internal.MatchAnyUnixMilli,
247+
SpanID: txn.GetLinkingMetadata().SpanID,
248+
TraceID: txn.GetLinkingMetadata().TraceID,
249+
Attributes: map[string]interface{}{
250+
"hi": 1,
251+
},
252+
},
253+
})
254+
255+
txn.End()
256+
}

0 commit comments

Comments
 (0)