Ruby - The Instana Ruby gem

The Instana Ruby gem: Ruby Distributed Tracing & Metrics Sensor

Gem Version OpenTracing Badge

Ruby Supported Components

Usage

The instana gem is a zero configuration tool that will automatically collect key metrics and distributed traces from your Ruby processes. Just install and go.

Installation

The gem is available on Rubygems. To install, add this line to the end of your application’s Gemfile:

gem 'instana'

And then execute:

$ bundle

Or install it yourself as:

$ gem install instana

Configuration

Although the gem has no configuration required for out of the box metrics and distributed tracing, individual components can be configured as needed. See the Ruby configuration page for more information.

Want End User Monitoring?

Instana provides deep end user monitoring that links server side traces with browser events.

For Ruby templates and views, get your EUM API key from your Instana dashboard and you can call ::Instana::Helpers.eum_snippet('example_api_key_string') from within your layout file. This will output a small javascript snippet of code to instrument browser events. It’s based on Weasel. Check it out.

As an example for Haml, you could do the following:

%html{ :lang => "en", :xmlns => "http://www.w3.org/1999/xhtml" }
  %head
    - if user_signed_in?
      = raw ::Instana::Helpers.eum_snippet('example_api_key_string', :username => current_user.username)
    - else
      = raw ::Instana::Helpers.eum_snippet('example_api_key_string')
  %body

Make sure to use the raw helper so the javascript isn’t interpolated with escape strings.

The optional second argument to ::Instana::Helpers.eum_snippet is a hash of metadata key/values that will be reported along with the browser instrumentation.

Instana EUM example with metadata

See also the End User Monitoring in the Instana documentation portal.

Custom Tracing

If you wish to write your own instrumentation, this Ruby gem provides two options for custom tracing:

  1. Instana Ruby Tracing SDK
  2. OpenTracing

Troubleshooting

Seeing something unexpected or having trouble trying to configure something? See the Ruby Troubleshooting page for help.

Releases

To see the Instana Ruby gem release history, which also details the changes made in the Instana gem, please see the Github Releases page.

See Also