2.3.0 Notes
Added support for Echo in the new
nrechopackage.Introduced
Transaction.SetWebResponse(http.ResponseWriter)method which sets the transaction's response writer. After calling this method, theTransactionmay be used in place of thehttp.ResponseWriterto intercept the response code. This method is useful when thehttp.ResponseWriteris 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.ReaderFromimplemented 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.ResponseWritermethods may now be called safely if ahttp.ResponseWriterhas 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.