• /
  • EnglishEspañol日本語한국어Português
  • ログイン今すぐ開始

Go agent v2.8

June 11, 2019Download

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

go-sql-driver/mysql

_integrations/nrmysql

lib/pq

_integrations/nrpq

mattn/go-sqlite3

_integrations/nrsqlite3

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

Copyright © 2024 New Relic株式会社。

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.