2.3.0 Notes
Added support for Echo in the new
nrecho
package.Introduced
Transaction.SetWebResponse(http.ResponseWriter)
method which sets the transaction's response writer. After calling this method, theTransaction
may be used in place of thehttp.ResponseWriter
to intercept the response code. This method is useful when thehttp.ResponseWriter
is not available at the beginning of the transaction (if so, it can be given as a parameter toApplication.StartTransaction
). This method will return a reference to the transaction which implements the combination ofhttp.CloseNotifier
,http.Flusher
,http.Hijacker
, andio.ReaderFrom
implemented by the ResponseWriter. Example:
func setResponseDemo(txn newrelic.Transaction) { recorder := httptest.NewRecorder() txn = txn.SetWebResponse(recorder) txn.WriteHeader(200) fmt.Println("response code recorded:", recorder.Code)}
- The
Transaction
'shttp.ResponseWriter
methods may now be called safely if ahttp.ResponseWriter
has not been set. This allows you to add a response code to the transaction without using ahttp.ResponseWriter
. Example:
func transactionWithResponseCode(app newrelic.Application) { txn := app.StartTransaction("hasResponseCode", nil, nil) defer txn.End() txn.WriteHeader(200) // Safe!}
- The agent will now collect environment variables prefixed by
NEW_RELIC_METADATA_
andKUBERNETES_SERVICE_HOST
. These will be added to Transaction events to provide context between your Kubernetes cluster and your services. For details on the benefits (currently in beta) see this blog post - The agent now collects the fully qualified domain name of the host and local IP addresses for improved linking with our Infrastructure product.