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.