Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 3.18.0 #546

Merged
merged 66 commits into from Aug 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
c3d47df
nrecho-v4: Add Skipper support
prashanthpai Mar 4, 2022
6dcad3d
use config function pattern
iamemilio Jun 27, 2022
85f18e4
Fixes the tests
iamemilio Jun 27, 2022
41da121
Test
mirackara Jul 6, 2022
9922894
Fixed nrgraphqlgo_test failing
mirackara Jul 6, 2022
aeac9c7
Fixed nrhttprouter test
mirackara Jul 6, 2022
3076d70
Fixed nrgorilla test
mirackara Jul 6, 2022
3c64a0f
Fixed nrredis test
mirackara Jul 6, 2022
306b675
Fixed nrgraphgophers test
mirackara Jul 6, 2022
3e4dac1
Fixes for nrzap tests
mirackara Jul 6, 2022
ff8d732
fixed typo
mirackara Jul 6, 2022
6ed3e9c
comment spacing
mirackara Jul 6, 2022
963a792
Changed go version for nrmicro test
mirackara Jul 6, 2022
5ae38e0
hotfix zerolog plugin
iamemilio Jul 6, 2022
f266a6a
Fixed elastic search test
mirackara Jul 6, 2022
116ab2e
Merge pull request #536 from iamemilio/hotfix
iamemilio Jul 6, 2022
7ea5bd3
Merge pull request #521 from iamemilio/nrecho-skipper-patch
iamemilio Jul 6, 2022
57ce828
nrlogrusplugin test fixes
mirackara Jul 6, 2022
3fdf185
Fixes for nrecho-v3 tests
mirackara Jul 6, 2022
d282ba5
Removed failing legacy tests
mirackara Jul 11, 2022
dd96758
Fix for nrgin test not passing
mirackara Jul 11, 2022
dcf061c
Merge branch 'develop' into test-dependancies
mirackara Jul 11, 2022
bad0166
Merge branch 'newrelic:master' into test-dependancies
mirackara Jul 12, 2022
3cc998a
Fixes for TestNewContextTransaction test
mirackara Jul 12, 2022
a57aea2
yaml fixes for nrgin and nrmssql
mirackara Jul 12, 2022
2ec3ceb
Removed agent replacement from local testing
mirackara Jul 12, 2022
48d578d
Removed extraneous space
mirackara Jul 12, 2022
d33c5dc
Removed indirect dependancies for nrgin mod file
mirackara Jul 13, 2022
2379f1c
Bumped go version back down to 1.12 for nrgin mod file
mirackara Jul 13, 2022
79f1da8
Increased Harvest Limit
mirackara Jul 15, 2022
31f62f6
Merge pull request #534 from mirackara/test-dependancies
iamemilio Jul 19, 2022
74283d4
transaction code level metrics experimental code
nr-swilloughby Jul 20, 2022
7c51295
added ignored prefix, cleaned up code
nr-swilloughby Jul 21, 2022
eecf68e
Support for Logrus with logs in context v2
iamemilio Jul 6, 2022
3729b18
Log decoration support
iamemilio Jul 11, 2022
2b98913
Tests for logging features hardened and made more generic
iamemilio Jul 12, 2022
cfe3d91
implemented environment settings
nr-swilloughby Jul 22, 2022
dbb8465
moved code level metrics to its own file, generalized it
nr-swilloughby Jul 22, 2022
2b9dae7
extended code level metrics options to the WrapHandle and WrapHandleF…
nr-swilloughby Jul 22, 2022
8577666
Patch DT Spans to read from span_event_harvest_config
mirackara Jul 22, 2022
7efe00f
Removed accidental comment
mirackara Jul 25, 2022
b75c9d9
Removed extraneous test case
mirackara Jul 25, 2022
66e950d
Removed extraneous else statement
mirackara Jul 25, 2022
87dcc8a
Made linter happy
mirackara Jul 25, 2022
f271dcd
added "all" for configuring CLM scope in the environment
nr-swilloughby Jul 26, 2022
9db8ea3
cleaned go.mod
nr-swilloughby Jul 26, 2022
a430859
removed old refactoring comment
nr-swilloughby Jul 26, 2022
1c91a92
added comment for the CodeLevelMetricsScope type
nr-swilloughby Jul 26, 2022
40a070f
remove DT enabled config from example
iamemilio Jul 21, 2022
22bb213
Revert back to 10k samples as default
mirackara Jul 26, 2022
cfe4013
Pin Logrus code to upcoming release version
iamemilio Jul 21, 2022
5ab0e09
initial release notes draft
nr-swilloughby Jul 27, 2022
a97e017
Add Logrus Commit message
iamemilio Jul 27, 2022
bb0b44a
added function CLM, altering transaction CLM after start, fixed wrapp…
nr-swilloughby Jul 27, 2022
e8ebe56
added initial set of unit tests for CLM
nr-swilloughby Jul 28, 2022
1a6d8a7
fixed comments
nr-swilloughby Jul 28, 2022
37da0f9
Merge pull request #538 from iamemilio/logrus_plugin
nr-swilloughby Jul 28, 2022
bbde81d
Merge pull request #541 from nr-swilloughby/clm
nr-swilloughby Jul 28, 2022
c9d5980
Merge pull request #542 from nr-swilloughby/release_3_18_0
nr-swilloughby Jul 28, 2022
9157849
clarified comment for txn.SetOption
nr-swilloughby Jul 29, 2022
eaaf111
Merge pull request #540 from mirackara/customeventlimitincrease
nr-swilloughby Aug 1, 2022
dbbf46a
Merge pull request #543 from nr-swilloughby/clm-update
iamemilio Aug 1, 2022
98e056c
updated changelog
nr-swilloughby Aug 1, 2022
167f21b
Merge pull request #544 from nr-swilloughby/tweak_3_18_0_release
iamemilio Aug 1, 2022
1a0ab33
updated changelog CodeStream note
nr-swilloughby Aug 1, 2022
dfb5698
Merge pull request #545 from nr-swilloughby/tweak_3_18_relnotes_again
iamemilio Aug 1, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 7 additions & 15 deletions .github/workflows/ci.yaml
Expand Up @@ -75,22 +75,16 @@ jobs:
# As of June 2020, confirmed errors still result
# - go-version: 1.13.x
# dirs: _integrations/nrmicro
- go-version: 1.13.x
dirs: _integrations/nrnats
- go-version: 1.13.x
dirs: _integrations/nrstan
# As of Jul 2022, we have depreciated the legacy nrnats,nrmssql, nrzap, and nrstan integrations tests.
# These tests still exist under the v3 versions of the integrations.
- go-version: 1.13.x
dirs: _integrations/logcontext
- go-version: 1.13.x
dirs: _integrations/nrzap
- go-version: 1.13.x
dirs: _integrations/nrhttprouter
- go-version: 1.13.x
dirs: _integrations/nrb3
- go-version: 1.13.x
dirs: _integrations/nrmongo
- go-version: 1.13.x
dirs: _integrations/nrmssql

# v3 agent
- go-version: 1.7.x
Expand All @@ -105,10 +99,6 @@ jobs:
dirs: v3/newrelic,v3/internal,v3/examples
- go-version: 1.12.x
dirs: v3/newrelic,v3/internal,v3/examples
- go-version: 1.13.x
dirs: v3/newrelic,v3/internal,v3/examples
- go-version: 1.14.x
dirs: v3/newrelic,v3/internal,v3/examples
- go-version: 1.15.x
dirs: v3/newrelic,v3/internal,v3/examples,v3/integrations/logcontext

Expand All @@ -133,7 +123,7 @@ jobs:
- go-version: 1.15.x
dirs: v3/integrations/nrelasticsearch-v7
extratesting: go get -u github.com/elastic/go-elasticsearch/v7@7.x
- go-version: 1.15.x
- go-version: 1.18.x
dirs: v3/integrations/nrgin
extratesting: go get -u github.com/gin-gonic/gin@master
- go-version: 1.15.x
Expand Down Expand Up @@ -174,14 +164,15 @@ jobs:
- go-version: 1.15.x
dirs: v3/integrations/nrgrpc
extratesting: go get -u google.golang.org/grpc@master
- go-version: 1.15.x
- go-version: 1.17.x
dirs: v3/integrations/nrmicro
# As of Dec 2019, there is a race condition in when using go-micro@master
# in their logging system. Instead, we'll test against the latest
# released version.
# As of Jan 2019, it is impossible to go get the latest micro version.
# As of June 2020, confirmed errors still result
# extratesting: go get -u github.com/micro/go-micro@latest
# If we are using the latest released version to test, we need to use a newer version of go
- go-version: 1.15.x
dirs: v3/integrations/nrnats
extratesting: go get -u github.com/nats-io/nats.go/@master
Expand All @@ -200,7 +191,8 @@ jobs:
- go-version: 1.15.x
dirs: v3/integrations/logcontext
extratesting: go get -u github.com/sirupsen/logrus@master
- go-version: 1.15.x
# nrzap only supports the two most recent minor go releases
- go-version: 1.17.x
dirs: v3/integrations/nrzap
extratesting: go get -u go.uber.org/zap@master
- go-version: 1.15.x
Expand Down
19 changes: 19 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,22 @@
## 3.18.0
### Added
* Code-Level Metrics are now available for instrumented transactions. This is off by default but once enabled via `ConfigCodeLevelMetricsEnabled(true)` transactions will include information about the location in the source code where `StartTransaction` was invoked.
* Adds information about where in your source code transaction traces originated.
* See the Go Agent documentation for details on [configuring](https://docs.newrelic.com/docs/apm/agents/go-agent/configuration/go-agent-code-level-metrics-config) Code-Level Metrics and how to [instrument](https://docs.newrelic.com/docs/apm/agents/go-agent/instrumentation/go-agent-code-level-metrics-instrument) your code using them.
* New V2 logs in context plugin is available for Logrus, packed with all the features you didn't know you wanted:
* Automatic Log Forwarding
* Log Metrics
* Capture logs anywhere in your code; both inside or outside of a transaction.
* Use the Logrus formatting package of your choice
* Local Log Decorating is now available for the new logcontext-v2/nrlogrus plugin only. This is off by default but can be enabled with `ConfigAppLogForwardingEnabled(true)`.

### Fixed
* Fixed issue with custom event limits and number of DT Spans to more accurately follow configured limits.

### Support Statement
New Relic recommends that you upgrade the agent regularly to ensure that you’re getting the latest features and performance benefits. Additionally, older releases will no longer be supported when they reach end-of-life.
* Note that the oldest supported version of the Go Agent is 3.6.0.

## 3.17.0
### Added
* Logs in context now supported for zerolog.
Expand Down
1 change: 0 additions & 1 deletion v3/examples/server-http/main.go
Expand Up @@ -50,7 +50,6 @@ func makeApplication() (*newrelic.Application, error) {
newrelic.ConfigAppName("HTTP Server App"),
newrelic.ConfigLicense(os.Getenv("NEW_RELIC_LICENSE_KEY")),
newrelic.ConfigDebugLogger(os.Stdout),
newrelic.ConfigDistributedTracerEnabled(true),
)
if nil != err {
return nil, err
Expand Down
5 changes: 4 additions & 1 deletion v3/examples/server/main.go
Expand Up @@ -262,6 +262,8 @@ func main() {
newrelic.ConfigFromEnvironment(),
newrelic.ConfigDebugLogger(os.Stdout),
newrelic.ConfigAppLogForwardingEnabled(true),
newrelic.ConfigCodeLevelMetricsEnabled(true),
newrelic.ConfigCodeLevelMetricsPathPrefix("go-agent/v3"),
)
if err != nil {
fmt.Println(err)
Expand All @@ -287,10 +289,11 @@ func main() {
http.HandleFunc(newrelic.WrapHandleFunc(app, "/message", message))
http.HandleFunc(newrelic.WrapHandleFunc(app, "/log", logTxnMessage))

//loc := newrelic.ThisCodeLocation()
http.HandleFunc("/background", func(w http.ResponseWriter, req *http.Request) {
// Transactions started without an http.Request are classified as
// background transactions.
txn := app.StartTransaction("background")
txn := app.StartTransaction("background", newrelic.WithThisCodeLocation())
defer txn.End()

io.WriteString(w, "background transaction")
Expand Down
63 changes: 63 additions & 0 deletions v3/integrations/logcontext-v2/nrlogrus/example/main.go
@@ -0,0 +1,63 @@
package main

import (
"context"
"log"
"os"
"time"

"github.com/newrelic/go-agent/v3/integrations/logcontext-v2/nrlogrus"
newrelic "github.com/newrelic/go-agent/v3/newrelic"
"github.com/sirupsen/logrus"
)

func doFunction2(txn *newrelic.Transaction, e *logrus.Entry) {
defer txn.StartSegment("doFunction2").End()
e.Error("In doFunction2")
}

func doFunction1(txn *newrelic.Transaction, e *logrus.Entry) {
defer txn.StartSegment("doFunction1").End()
e.Trace("In doFunction1")
doFunction2(txn, e)
}

func main() {
app, err := newrelic.NewApplication(
newrelic.ConfigAppName("Logrus Logs In Context Example"),
newrelic.ConfigLicense(os.Getenv("NEW_RELIC_LICENSE_KEY")),
newrelic.ConfigInfoLogger(os.Stdout),
newrelic.ConfigAppLogForwardingEnabled(true),

// If you wanted to forward your logs using a log forwarder instead
// newrelic.ConfigAppLogDecoratingEnabled(true),
// newrelic.ConfigAppLogForwardingEnabled(false),
)
if nil != err {
log.Panic("Failed to create application", err)
}

log := logrus.New()
log.SetLevel(logrus.TraceLevel)
// Enable New Relic log decoration
log.SetFormatter(nrlogrus.NewFormatter(app, &logrus.TextFormatter{}))
log.Trace("waiting for connection to New Relic...")

err = app.WaitForConnection(10 * time.Second)
if nil != err {
log.Panic("Failed to connect application", err)
}
defer app.Shutdown(10 * time.Second)
log.Info("application connected to New Relic")
log.Debug("Starting transaction now")
txn := app.StartTransaction("main")

// Add the transaction context to the logger. Only once this happens will
// the logs be properly decorated with all required fields.
e := log.WithContext(newrelic.NewContext(context.Background(), txn))

doFunction1(txn, e)

e.Info("Ending transaction")
txn.End()
}
64 changes: 64 additions & 0 deletions v3/integrations/logcontext-v2/nrlogrus/formatter.go
@@ -0,0 +1,64 @@
// Copyright 2020 New Relic Corporation. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

package nrlogrus

import (
"bytes"

"github.com/newrelic/go-agent/v3/internal"
newrelic "github.com/newrelic/go-agent/v3/newrelic"
"github.com/sirupsen/logrus"
)

func init() { internal.TrackUsage("integration", "logcontext-v2", "logrus") }

// ContextFormatter is a `logrus.Formatter` that will format logs for sending
// to New Relic.
type ContextFormatter struct {
app *newrelic.Application
formatter logrus.Formatter
}

func NewFormatter(app *newrelic.Application, formatter logrus.Formatter) ContextFormatter {
return ContextFormatter{
app: app,
formatter: formatter,
}
}

// Format renders a single log entry.
func (f ContextFormatter) Format(e *logrus.Entry) ([]byte, error) {
logData := newrelic.LogData{
Severity: e.Level.String(),
Message: e.Message,
}

logBytes, err := f.formatter.Format(e)
if err != nil {
return nil, err
}
logBytes = bytes.TrimRight(logBytes, "\n")
b := bytes.NewBuffer(logBytes)

ctx := e.Context
var txn *newrelic.Transaction
if ctx != nil {
txn = newrelic.FromContext(ctx)
}
if txn != nil {
txn.RecordLog(logData)
err := newrelic.EnrichLog(b, newrelic.FromTxn(txn))
if err != nil {
return nil, err
}
} else {
f.app.RecordLog(logData)
err := newrelic.EnrichLog(b, newrelic.FromApp(f.app))
if err != nil {
return nil, err
}
}
b.WriteString("\n")
return b.Bytes(), nil
}