HTTP client tracing in Ruby

The Ruby agent can trace outgoing HTTP requests made by your application or script in order to:

  • Record metrics about how long your HTTP requests are taking and which hosts they're hitting.
  • Annotate transaction traces with nodes for each HTTP request.
  • Provide cross application tracing for requests between applications instrumented with New Relic.

Supported HTTP client libraries

The following HTTP client libraries are currently supported by the Ruby agent:

Name Minimum supported version Notes
Net::HTTP N/A (part of the Ruby standard library) Also includes libraries built upon Net::HTTP, such as httparty.
Excon 0.10.1 See Excon notes.
Typhoeus 0.5.3 Hydra requests get partial instrumentation, 1.8.7 stability. See Typhoeus notes.
HTTPClient 2.2.0 Instrumentation of asynchronous requests is not supported.
Curb 0.8.1 Curl::Multi requests get partial instrumentation. See Curb notes.
http.rb 0.9.9

Excon notes

The New Relic Ruby agent supports Excon versions 0.10.1 or higher.

Excon instrumentation for Excon versions 0.19.0 and up relies on the ability to add an Excon middleware to the :middlewares key of Excon.defaults, so if your application modifies Excon.defaults, you should ensure that you preserve the value of the :middlewares key.

Typhoeus notes

The New Relic Ruby agent supports Typhoeus versions 0.5.3 or higher.

Parallel requests made via the Hydra mechanism in Typhoeus currently only have partial tracing support. For such requests, the Ruby agent will record a single transaction trace node representing the entire batch, but you will not be able to see the details about each individual request in the batch. Requests made via the Hydra mechanism will also not get cross application tracing support.

Testing has shown significant issues with segfaults when running Typhoeus on MRI 1.8.7. Recommendation: Use Ruby Enterprise Edition or MRI 1.9.3 or higher to avoid these problems.

Curb notes

The New Relic Ruby agent supports Curb versions 0.8.1 or higher. Curb instrumentation on JRuby is not supported.

Requests made via the Curl::Multi API currently only have partial tracing support (equivalent to what is offered for requests made via the Typhoeus Hydra API). For such requests, the Ruby agent will record a single transaction trace node representing the entire batch, but you will not be able to see the details about each individual request in the batch. Requests made via the Curl::Multi mechanism will also not get cross application tracing support.

For more help

Additional documentation resources include:

Join the discussion about Ruby in the New Relic Online Technical Community! The Technical Community is a public platform to discuss and troubleshoot your New Relic toolset.

If you need additional help, get support at support.newrelic.com.