Releases: newrelic/go-agent
Release v3.4.0
New Features
-
Attribute
http.statusCode
has been added to external span events
representing the status code on an http response. This attribute will be
included when added to an ExternalSegment in one of these three ways:- Using
NewRoundTripper
with your http.Client - Including the http.Response as a field on your
ExternalSegment
- Using the new
ExternalSegment.SetStatusCode
API to set the status code directly
To exclude the
http.statusCode
attribute from span events, update your
agent configuration like so, wherecfg
is yournewrelic.Config
object.cfg.SpanEvents.Attributes.Exclude = append(cfg.SpanEvents.Attributes.Exclude, newrelic.SpanAttributeHTTPStatusCode)
- Using
-
Error attributes
error.class
anderror.message
are now included on the
span event in which the error was noticed, or on the root span if an error
occurs in a transaction with no segments (no chid spans). Only the most recent error
information is added to the attributes; prior errors on the same span are
overwritten.To exclude the
error.class
and/orerror.message
attributes from span events, update your
agent configuration like so, wherecfg
is yournewrelic.Config
object.cfg.SpanEvents.Attributes.Exclude = append(cfg.SpanEvents.Attributes.Exclude, newrelic.newrelic.SpanAttributeErrorClass, newrelic.SpanAttributeErrorMessage)
Changes
-
Use
Context.FullPath()
for transaction names when using Gin version 1.5.0 or greater. Gin
transactions were formerly named after the
Context.HandlerName()
,
which uses reflection. This change improves transaction naming and reduces
overhead. Please note that because your transaction names will change, you
may have to update any related dashboards and alerts to match the new name.// Transactions previously named "GET main.handleGetUsers" // will be change to something like this match the full path "GET /user/:id"
Release 3.3.0
New Features
-
Added support for GraphQL in two new integrations:
-
Added database instrumentation support for snowflakedb/gosnowflake.
Changes
-
When using
newrelic.StartExternalSegment
ornewrelic.NewRoundTripper
, if existing cross application tracing or distributed tracing headers are present on the request, they will be replaced instead of added. -
The
FromContext
API which allows you to pull a Transaction from a context.Context will no longer panic if the provided context is nil. In this case, a nil is returned.
v3.2.0
New Features
- Added support for
v7
of go-redis/redis in the new v3/integrations/nrredis-v7 package.
Changes
-
Updated Gorilla instrumentation to include request time spent in middlewares. Added new
nrgorilla.Middleware
and deprecatednrgorilla.InstrumentRoutes
. Register the new middleware as your first middleware usingRouter.Use
. See the godocs examples for more details.r := mux.NewRouter() // Always register the nrgorilla.Middleware first. r.Use(nrgorilla.Middleware(app)) // All handlers and custom middlewares will be instrumented. The // transaction will be available in the Request's context. r.Use(MyCustomMiddleware) r.Handle("/", makeHandler("index")) // The NotFoundHandler and MethodNotAllowedHandler must be instrumented // separately using newrelic.WrapHandle. The second argument to // newrelic.WrapHandle is used as the transaction name; the string returned // from newrelic.WrapHandle should be ignored. _, r.NotFoundHandler = newrelic.WrapHandle(app, "NotFoundHandler", makeHandler("not found")) _, r.MethodNotAllowedHandler = newrelic.WrapHandle(app, "MethodNotAllowedHandler", makeHandler("method not allowed")) http.ListenAndServe(":8000", r)
v3.1.0
New Features
-
Support for W3C Trace Context, with easy upgrade from New Relic trace context.
Distributed Tracing now supports W3C Trace Context headers for HTTP and
gRPC protocols when distributed tracing is enabled. Our implementation can
accept and emit both W3C trace header format and New Relic trace header
format. This simplifies agent upgrades, allowing trace context to be
propagated between services with older and newer releases of New Relic
agents. W3C trace header format will always be accepted and emitted. New
Relic trace header format will be accepted, and you can optionally disable
emission of the New Relic trace header format.When distributed tracing is enabled with
Config.DistributedTracer.Enabled = true
, the Go agent will now accept
W3C'straceparent
andtracestate
headers when calling
Transaction.AcceptDistributedTraceHeaders
. When calling
Transaction.InsertDistributedTraceHeaders
, the Go agent will include the
W3C headers along with the New Relic distributed tracing header, unless
the New Relic trace header format is disabled using
Config.DistributedTracer.ExcludeNewRelicHeader = true
. -
Added support for elastic/go-elasticsearch
in the new v3/integrations/nrelasticsearch-v7
package. -
Event data is now sent to New Relic every five seconds, instead of every
minute. As a result, transaction, custom, and error events will appear in
near-realtime within APM and Insights.Note that the overall limits on how many events can be sent per minute have
not changed. Also, metric and trace data is unaffected, and will still be
sent every minute.
v3.0.0
3.0.0
We are pleased to announce the release of Go Agent v3.0.0! This is a major release
that includes some breaking changes that will simplify your future use of the Go
Agent.
Please pay close attention to the list of Changes.
Changes
- A full list of changes and a step by step checklist on how to upgrade can
be found in the v3 Migration Guide.
New Features
-
Support for Go Modules. Our Go agent integration packages support frameworks
and libraries which are changing over time. With support for Go Modules, we
are now able to release instrumentation packages for multiple versions of
frameworks and libraries with a single agent release; and support operation
of the Go agent in Go Modules environments. This affects naming of our
integration packages, as described in the v3 Migration Guide (see under
"Changes" above). -
Detect and set hostnames based on Heroku dyno names. When deploying an
application in Heroku, the hostnames collected will now match the dyno name.
This serves to greatly improve the usability of the servers list in APM since
dyno names are often sporadic or fleeting in nature. The feature is
controlled by two new configuration optionsConfig.Heroku.UseDynoNames
and
Config.Heroku.DynoNamePrefixesToShorten
.
v2.16.3
New Relic's Go agent v3.0 is currently available for review and beta testing. Your use of this pre-release is at your own risk. New Relic disclaims all warranties, express or implied, regarding the beta release.
If you do not manually take steps to use the new v3 folder you will not see any changes in your agent.
This is the third release of the pre-release of Go agent v3.0. It includes
changes due to user feedback during the pre-release. The existing agent in
"github.com/newrelic/go-agent"
is unchanged. The Go agent v3.0 code in the v3
folder has the following changes:
- A ConfigFromEnvironment
bug has been fixed.
v2.16.2
2.16.2
New Relic's Go agent v3.0 is currently available for review and beta testing. Your use of this pre-release is at your own risk. New Relic disclaims all warranties, express or implied, regarding the beta release.
If you do not manually take steps to use the new v3 folder, as described below, you will not see any changes in your agent.
This is the second release of the pre-release of Go agent v3.0. It includes changes due to user feedback during the pre-release. The existing agent in "github.com/newrelic/go-agent"
is unchanged. The Go agent v3.0 code in the v3 folder has the following changes:
-
Transaction names created by
WrapHandle
,
WrapHandleFunc
,
nrecho-v3,
nrecho-v4,
nrgorilla, and
nrgin now
include the HTTP method. For example, the following code:http.HandleFunc(newrelic.WrapHandleFunc(app, "/users", usersHandler))
now creates a metric called
WebTransaction/Go/GET /users
instead of
WebTransaction/Go/users
. As a result of this change, you may need to update
your alerts and dashboards. -
The ConfigFromEnvironment
config option is now strict. If one of the environment variables, such as
NEW_RELIC_DISTRIBUTED_TRACING_ENABLED
, cannot be parsed, thenConfig.Error
will be populated and NewApplication
will return an error. -
ConfigFromEnvironment
now processesNEW_RELIC_ATTRIBUTES_EXCLUDE
andNEW_RELIC_ATTRIBUTES_INCLUDE
.
v2.16.1
New Relic's Go agent v3.0 is currently available for review and beta testing. Your use of this pre-release is at your own risk. New Relic disclaims all warranties, express or implied, regarding the beta release.
If you do not manually take steps to use the new v3 folder, as described below, you will not see any changes in your agent.
This 2.16.1 release includes a new v3.0 folder which contains the pre-release of Go agent v3.0; Go agent v3.0 includes breaking changes. We are seeking feedback and hope that you will look this over and test out the changes prior to the official release.
This is not an official 3.0 release, it is just a vehicle to gather feedback on proposed changes. It is not tagged as 3.0 in Github and the 3.0 release is not yet available to update in your Go mod file. In order to test out these changes, you will need to clone this repo in your Go source directory, under [go-src-dir]/src/github.com/newrelic/go-agent
. Once you have the source checked out, you will need to follow the steps in the second section of v3/MIGRATION.md.
A list of changes and installation instructions is included in the v3 folder and can be found here
For this pre-release (beta) version of Go agent v3.0, please note:
- The changes in the v3 folder represent what we expect to release in ~2 weeks as our major 3.0 release. However, as we are soliciting feedback on the changes and there is the possibility of some breaking changes before the official release.
- This is not an official 3.0 release; it is not tagged as 3.0 in Github and the 3.0 release is not yet available to update in your Go mod file.
- If you test out these changes and encounter issues, questions, or have feedback that you would like to pass along, please open up an issue here and be sure to include the label
3.0
.- For normal (non-3.0) issues/questions we request that you report them via our support site or our community forum. Please only report questions related to the 3.0 pre-release directly via GitHub.
New Features
- V3 will add support for Go Modules. The go.mod files exist in the v3 folder, but they will not be usable until we have fully tagged the 3.0 release officially. Examples of version tags we plan to use for different modules
include:v3.0.0
v3/integrations/nrecho-v3/v1.0.0
v3/integrations/nrecho-v4/v1.0.0
Changes
- The changes are the ones that we have requested feedback previously in this issue.
- A full list of changes that are included, along with a checklist for upgrading, is available in v3/MIGRATION.md.
v2.15.0
-
Added support for monitoring MongoDB queries with the new
_integrations/nrmongo
package. -
Added new method
Transaction.IsSampled()
that returns a boolean that
indicates if the transaction is sampled. A sampled transaction records a
span event for each segment. Distributed tracing must be enabled for
transactions to be sampled.false
is returned if the transaction has
finished. This sampling flag is needed for B3 trace propagation and
future support of W3C Trace Context. -
Added support for adding B3
Headers to outgoing requests.
This is helpful if the service you are calling uses B3 for trace state
propagation (for example, it uses Zipkin instrumentation). You can use the
new
_integrations/nrb3
package's
nrb3.NewRoundTripper
like this:// When defining the client, set the Transport to the NewRoundTripper. This // will create ExternalSegments and add B3 headers for each request. client := &http.Client{ Transport: nrb3.NewRoundTripper(nil), } // Distributed Tracing must be enabled for this application. // (see https://docs.newrelic.com/docs/understand-dependencies/distributed-tracing/enable-configure/enable-distributed-tracing) txn := currentTxn() req, err := http.NewRequest("GET", "http://example.com", nil) if nil != err { log.Fatalln(err) } // Be sure to add the transaction to the request context. This step is // required. req = newrelic.RequestWithTransactionContext(req, txn) resp, err := client.Do(req) if nil != err { log.Fatalln(err) } defer resp.Body.Close() fmt.Println(resp.StatusCode)
Bug Fixes
- Fixed an issue where the
nrgin
integration was not capturing the correct response code in the case where no
response body was sent. This issue has now been fixed but requires Gin
greater than v1.4.0.