2.14.1
Bug Fixes
- Removed the hidden 
"NEW_RELIC_DEBUG_LOGGING"environment variable setting which was broken in release 2.14.0. 
2.14.0
New Features
Added support for a new segment type,
MessageProducerSegment, to be used to track time spent adding messages to message queuing systems like RabbitMQ or Kafka.seg := &newrelic.MessageProducerSegment{StartTime: newrelic.StartSegmentNow(txn),Library: "RabbitMQ",DestinationType: newrelic.MessageExchange,DestinationName: "myExchange",}// add message to queue hereseg.End()Added new attribute constants for use with message consumer transactions. These attributes can be used to add more detail to a transaction that tracks time spent consuming a message off a message queuing system like RabbitMQ or Kafka. They can be added using
txn.AddAttribute.// The routing key of the consumed message.txn.AddAttribute(newrelic.AttributeMessageRoutingKey, "myRoutingKey")// The name of the queue the message was consumed from.txn.AddAttribute(newrelic.AttributeMessageQueueName, "myQueueName")// The type of exchange used for the consumed message (direct, fanout,// topic, or headers).txn.AddAttribute(newrelic.AttributeMessageExchangeType, "myExchangeType")// The callback queue used in RPC configurations.txn.AddAttribute(newrelic.AttributeMessageReplyTo, "myReplyTo")// The application-generated identifier used in RPC configurations.txn.AddAttribute(newrelic.AttributeMessageCorrelationID, "myCorrelationID")It is recommended that at most one message is consumed per transaction.
Added support for Go 1.13's Error wrapping.
Transaction.NoticeErrornow uses Unwrap recursively to identify the error's cause (the deepest wrapped error) when generating the error's class field. This functionality will help group your errors usefully.For example, when using Go 1.13, the following code:
type socketError struct{}func (e socketError) Error() string { return "socket error" }func gamma() error { return socketError{} }func beta() error { return fmt.Errorf("problem in beta: %w", gamma()) }func alpha() error { return fmt.Errorf("problem in alpha: %w", beta()) }func execute(txn newrelic.Transaction) {err := alpha()txn.NoticeError(err)}captures an error with message
"problem in alpha: problem in beta: socket error"and class"main.socketError". Previously, the class was recorded as"*fmt.wrapError".A
Stackfield has been added to Error, which can be assigned using the new NewStackTrace function. This allows your error stack trace to show where the error happened, rather than the location of theNoticeErrorcall.Transaction.NoticeErrornot only checks for a stack trace (using StackTracer) in the error parameter, but in the error's cause as well. This means that you can create an Error where your error occurred, wrap it multiple times to add information, notice it withNoticeError, and still have a useful stack trace. Take a look!func gamma() error {return newrelic.Error{Message: "something went very wrong",Class: "socketError",Stack: newrelic.NewStackTrace(),}}func beta() error { return fmt.Errorf("problem in beta: %w", gamma()) }func alpha() error { return fmt.Errorf("problem in alpha: %w", beta()) }func execute(txn newrelic.Transaction) {err := alpha()txn.NoticeError(err)}In this example, the topmost stack trace frame recorded is
"gamma", rather than"execute".Added support for configuring a maximum number of transaction events per minute to be sent to New Relic. It can be configured as follows:
config := newrelic.NewConfig("Application Name", os.Getenv("NEW_RELIC_LICENSE_KEY"))config.TransactionEvents.MaxSamplesStored = 100- For additional configuration information, see our documentation
 
Miscellaneous
Updated the
nrmicropackage to use the new segment typeMessageProducerSegmentand the new attribute constants:nrmicro.ClientWrappernow usesnewrelic.MessageProducerSegments instead ofnewrelic.ExternalSegments for calls toClient.Publish.nrmicro.SubscriberWrapperupdates transaction names and adds the attributemessage.routingKey.
Updated the
nrnatsandnrstanpackages to use the new segment typeMessageProducerSegmentand the new attribute constants:nrnats.StartPublishSegmentnow starts and returns anewrelic.MessageProducerSegmenttype.nrnats.SubWrapperandnrstan.StreamingSubWrapperupdates transaction names and adds the attributesmessage.routingKey,message.queueName, andmessage.replyTo.
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.