2.13.0
New Features
Added support for HttpRouter in the new _integrations/nrhttprouter package. This package allows you to easily instrument inbound requests through the HttpRouter framework.
Added support for github.com/uber-go/zap in the new _integrations/nrzap package. This package allows you to send agent log messages to
zap.
New Features
Added new methods to expose
Transactiondetails:Transaction.GetTraceMetadata()returns a TraceMetadata which contains distributed tracing identifiers.Transaction.GetLinkingMetadata()returns a LinkingMetadata which contains the fields needed to link data to a trace or entity.
Added a new plugin for the Logrus logging framework with the new _integrations/logcontext/nrlogrusplugin package. This plugin leverages the new
GetTraceMetadataandGetLinkingMetadataabove to decorate logs.To enable, set your log's formatter to the
nrlogrusplugin.ContextFormatter{}logger := logrus.New()logger.SetFormatter(nrlogrusplugin.ContextFormatter{})The logger will now look for a
newrelic.Transactioninside its context and decorate logs accordingly. Therefore, the Transaction must be added to the context and passed to the logger. For example, this logging calllogger.Info("Hello New Relic!")must be transformed to include the context, such as:
ctx := newrelic.NewContext(context.Background(), txn)logger.WithContext(ctx).Info("Hello New Relic!")Added support for NATS and NATS Streaming monitoring with the new _integrations/nrnats and _integrations/nrstan packages. These packages support instrumentation of publishers and subscribers.
Enables ability to migrate to Configurable Security Policies (CSP) on a per agent basis for accounts already using High-security mode (HSM).
- Previously, if CSP was configured for an account, New Relic would not allow an agent to connect without the
security_policies_token. This led to agents not being able to connect during the period between when CSP was enabled for an account and when each agent is configured with the correct token. - With this change, when both HSM and CSP are enabled for an account, an agent (this version or later) can successfully connect with either
high_security: trueor the appropriatesecurity_policies_tokenconfigured - allowing the agent to continue to connect after CSP is configured on the account but before the appropriatesecurity_policies_tokenis configured for each agent.
- Previously, if CSP was configured for an account, New Relic would not allow an agent to connect without the
New Features
Added support for Micro monitoring with the new _integrations/nrmicro package. This package supports instrumentation for servers, clients, publishers, and subscribers.
Added support for creating static
WebRequestinstances manually via theNewStaticWebRequestfunction. This can be useful when you want to create a web transaction but don't have anhttp.Requestobject. Here's an example of creating a staticWebRequestand using it to mark a transaction as a web transaction:hdrs := http.Headers{}u, _ := url.Parse("http://example.com")webReq := newrelic.NewStaticWebRequest(hdrs, u, "GET", newrelic.TransportHTTP)txn := app.StartTransaction("My-Transaction", nil, nil)txn.SetWebRequest(webReq)
2.10.0
New Features
Added support for custom events when using nrlambda. Example Lambda handler which creates custom event:
func handler(ctx context.Context) {if txn := newrelic.FromContext(ctx); nil != txn {txn.Application().RecordCustomEvent("myEvent", map[string]interface{}{"zip": "zap",})}fmt.Println("hello world!")}
2.9.0
New Features
Added support for gRPC monitoring with the new _integrations/nrgrpc package. This package supports instrumentation for servers and clients.
Added new ExternalSegment fields
Host,Procedure, andLibrary. These optional fields are automatically populated from the segment'sURLorRequestif unset. Use them if you don't have access to a request or URL but still want useful external metrics, transaction segment attributes, and span attributes.Hostis used for external metrics, transaction trace segment names, and span event names. The host of segment'sRequestorURLis the default.Procedureis used for transaction breakdown metrics. If set, it should be set to the remote procedure being called. The HTTP method of the segment'sRequestis the default.Libraryis used for external metrics and the"component"span attribute. If set, it should be set to the framework making the call."http"is the default.
With the addition of these new fields, external transaction breakdown metrics are changed:
External/myhost.com/allwill now report asExternal/myhost.com/http/GET(provided the HTTP method isGET).HTTP Response codes below
100, except0and5, are now recorded as errors. This is to supportgRPCstatus codes. If you start seeing new status code errors that you would like to ignore, add them toConfig.ErrorCollector.IgnoreStatusCodesor your server side configuration settings.Improve logrus support by introducing nrlogrus.Transform, a function which allows you to turn a logrus.Logger instance into a newrelic.Logger. Example use:
l := logrus.New()l.SetLevel(logrus.DebugLevel)cfg := newrelic.NewConfig("Your Application Name", "__YOUR_NEW_RELIC_LICENSE_KEY__")cfg.Logger = nrlogrus.Transform(l)As a result of this change, the nrlogrus package requires logrus version
v1.1.0and above.
2.8.1
Bug Fixes
- Removed
nrmysql.NewConnectorsince go-sql-driver/mysql has not yet releasedmysql.NewConnector.
2.8.0
New Features
Support for Real Time Streaming
- Event data is now sent to New Relic every five seconds, instead of every minute. As a result, transaction, error, and custom events will now be available in New Relic dashboards in near real time. For more information on how to view your events with a five-second refresh, see the real time streaming documentation.
- Note that the overall limits on how many events can be sent per minute have not changed. Also, span events, metrics, and trace data is unaffected, and will still be sent every minute.
Introduce support for databases using database/sql. This new functionality allows you to instrument MySQL, PostgreSQL, and SQLite calls without manually creating DatastoreSegments.
Database Library Supported | Integration Package |
|---|---|
Using these database integration packages is easy! First replace the driver with our integration version:
import ( // import our integration package _ "github.com/newrelic/go-agent/_integrations/nrmysql" )
func main() { // open "nrmysql" in place of "mysql" db, err := sql.Open("nrmysql", "user@unix(/path/to/socket)/dbname") }Second, use the ExecContext, QueryContext, and QueryRowContext methods of sql.DB, sql.Conn, sql.Tx, and sql.Stmt and provide a transaction-containing context. Calls to Exec, Query, and QueryRow do not get instrumented.
ctx := newrelic.NewContext(context.Background(), txn) row := db.QueryRowContext(ctx, "SELECT count(*) from tables")If you are using a database/sql database not listed above, you can write your own instrumentation for it using InstrumentSQLConnector, InstrumentSQLDriver, and SQLDriverSegmentBuilder. The integration packages act as examples of how to do this.
For more information, see the Go agent documentation on instrumenting datastore segments.
Bug Fixes
- The http.RoundTripper returned by NewRoundTripper no longer modifies the request. Our thanks to @jlordiales for the contribution.
2.7.0
New Features
Added support for server side configuration. Server side configuration allows you to set the following configuration settings in the New Relic APM UI:
Config.TransactionTracer.EnabledConfig.ErrorCollector.EnabledConfig.CrossApplicationTracer.EnabledConfig.TransactionTracer.ThresholdConfig.TransactionTracer.StackTraceThresholdConfig.ErrorCollector.IgnoreStatusCodes
For more information see the server side configuration documentation.
Added support for AWS Lambda functions in the new nrlambda package. Please email lambda_preview@newrelic.com if you are interested in learning more or previewing New Relic Lambda monitoring. This instrumentation package requires
aws-lambda-goversion v1.9.0 or higher.
2.6.0
New Features
Added support for async: the ability to instrument multiple concurrent goroutines, or goroutines that access or manipulate the same Transaction.
The new
Transaction.NewGoroutine() Transactionmethod allows transactions to create segments in multiple goroutines!NewGoroutinereturns a new reference to theTransaction. This must be called any time you are passing theTransactionto another goroutine which makes segments. Each segment-creating goroutine must have its ownTransactionreference. It does not matter if you call this before or after the other goroutine has started.All
Transactionmethods can be used in anyTransactionreference. TheTransactionwill end whenEnd()is called in any goroutine.Example passing a new
Transactionreference directly to another goroutine:go func(txn newrelic.Transaction) {defer newrelic.StartSegment(txn, "async").End()time.Sleep(100 * time.Millisecond)}(txn.NewGoroutine())Example passing a new
Transactionreference on a channel to another goroutine:ch := make(chan newrelic.Transaction)go func() {txn := <-chdefer newrelic.StartSegment(txn, "async").End()time.Sleep(100 * time.Millisecond)}()ch <- txn.NewGoroutine()Added integration support for
aws-sdk-goandaws-sdk-go-v2.When using these SDKs, a segment will be created for each out going request. For DynamoDB calls, these will be Datastore segments and for all others they will be External segments.
- v1 Documentation
- v2 Documentation
- Added span event and transaction trace segment attribute configuration. You may control which attributes are captured in span events and transaction trace segments using the
Config.SpanEvents.AttributesandConfig.TransactionTracer.Segments.Attributessettings. For example, if you want to disable the collection of"db.statement"in your span events, modify your config like this:
cfg.SpanEvents.Attributes.Exclude = append(cfg.SpanEvents.Attributes.Exclude,newrelic.SpanAttributeDBStatement)To disable the collection of all attributes from your transaction trace segments, modify your config like this:
cfg.TransactionTracer.Segments.Attributes.Enabled = false
Bug Fixes
- Fixed a bug that would prevent External Segments from being created under certain error conditions related to Cross Application Tracing.
Miscellaneous
Improved linking between Cross Application Transaction Traces in the APM UI. When
Config.CrossApplicationTracer.Enabled = true, External segments in the Transaction Traces details will now link to the downstream Transaction Trace if there is one. Additionally, the segment name will now include the name of the downstream application and the name of the downstream transaction.Update attribute names of Datastore and External segments on Transaction Traces to be in line with attribute names on Spans. Specifically:
"uri"=>"http.url""query"=>"db.statement""database_name"=>"db.instance""host"=>"peer.hostname""port_path_or_id"+"host"=>"peer.address"
2.5.0
- Added support for New Relic Browser using the new
BrowserTimingHeadermethod on theTransactionwhich returns a BrowserTimingHeader. The New Relic Browser JavaScript code measures page load timing, also known as real user monitoring. The Pro version of this feature measures AJAX requests, single-page applications, JavaScript errors, and much more! Example use:
func browser(w http.ResponseWriter, r *http.Request) { hdr, err := w.(newrelic.Transaction).BrowserTimingHeader() if nil != err { log.Printf("unable to create browser timing header: %v", err) } // BrowserTimingHeader() will always return a header whose methods can // be safely called. if js := hdr.WithTags(); js != nil { w.Write(js) } io.WriteString(w, "browser header page")}- The Go agent now collects an attribute named
request.urion Transaction Traces, Transaction Events, Error Traces, and Error Events.request.uriwill never contain user, password, query parameters, or fragment. To prevent the request's URL from being collected in any data, modify yourConfiglike this:
cfg.Attributes.Exclude = append(cfg.Attributes.Exclude, newrelic.AttributeRequestURI)