• Log in

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 distributed 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 Ruby agent supports Excon version 0.19.0 or higher. Excon instrumentation 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 Ruby agent supports Typhoeus version 0.5.3 or higher.

Parallel requests made via the Hydra mechanism in Typhoeus only have partial distributed 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. Cross application tracing does not support requests made via the Hydra mechanism.

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 Ruby agent supports Curb version 0.8.1 or higher. Curb instrumentation on JRuby is not supported.

Requests made via the Curl::Multi API currently only have partial distributed 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 do not have cross application tracing support.

Copyright © 2022 New Relic Inc.

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