Skip to content

v2.15.0

Compare
Choose a tag to compare
@purple4reina purple4reina released this 24 Oct 21:04
· 1763 commits to master since this release
  • 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.