Monitoring Ruby

The instana gem provides automated code instrumentation for supported technologies, zero configuration health monitoring of Ruby instances, and end-to-end traces of requests across all systems.

Support

Supported Runtimes

Runtime Versions Limitations
MRI Ruby/CRuby >= 2.1

Supported Frameworks and Libraries

Note: Trace continuity is not applicable to database and logging libraries.

Supported Versions

Web Frameworks Versions Note
Cuba >= 3.0.0
Padrino >= 0.12.0
Roda >= 2.0.0
Ruby on Rails >= 3.2 ActionController & ActionView Partial rendering insights
Rack >= 1.4.5
Rails LTS >= 2.3
Rails API >= 0.4.0
Sinatra >= 1.1.4
HTTP Versions Note
Net::HTTP >= 2.1
Excon >= 0.21.0
Faraday >= 0.7.6 with supported Net::HTTP or Excon Adapters
GRPC >= 1.0.1
HTTParty via Net::HTTP
HTTP-Requestor > 1.0.0
RestClient >= 1.6.0
RPC Versions Note
GRPC >= 1.0.1
GraphQL >= 1.8.8
Database Driver Name
Memcached Dalli
Messaging & Background Job Processing Versions
Resque >= 1.22.0
Sidekiq >= 2.12.0

Runtime Metrics

  • Ruby Version
  • Runtime Arguments
  • Framework
  • Gem Bundle
  • Time Spent in GC
  • Memory Usage
  • Heap Slots
  • Threads

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

Tracer Logs

At require time, the library will output:

Stan is on the scene.  Starting Instana instrumentation version X.X.X.

Once the agent has made a connection to the host agent, it will output:

Host agent available. We're in business.

Other log messages may appear and indicate an error state. Refer to the Troubleshooting section for more details.

Platforms

Kubernetes

For Kubernetes (and other container based deployments), the Instana Ruby gem requires an ip binary available (such as from the iproute2 OS package). This requirement will be removed in a future version.

Cloud Foundry

The standard installation method methods also works on Cloud Foundry using the Cloud Foundry Ruby Buildpack. Additionally, since the Tile version 1.177.0, the instana_buildpack automates the setup of Ruby applications on Cloud Foundry. For more information, refer to the Instana Buildpack documentation.

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.

Software Development Kits

The Instana gem supports a native software development kit and the OpenTracing sdk.

Instana Native SDK

OpenTracing

Troubleshooting

Ruby sensor not installed

Monitoring issue type: ruby_sensor_not_installed

The Ruby process does not seem to include the instana Ruby gem, or the Ruby sensor cannot communicate with the Instana host agent.

To activate the Instana monitoring for Ruby, refer to the Installation section. If you are sure the Ruby gem is correctly installed, please refer to the more detailed Troubleshooting documentation for the Instana Ruby sensor.

Verify the process is instrumented

Make sure the instana gem is installed in your application and active. If the Ruby sensor is active, you will see the following entries in your application's logs:

Stan is on the scene.  Starting Instana instrumentation version #<version>

If you do not see this log, then the setup is not correct. Please refer to the Installation documentation.

If you do see the log message above, then it is very likely a network connectivity issue with the host agent, see the next section.

Verify the tracer can connect to the host agent

If the Ruby tracer is installed (refer to he previous section), verify that the Ruby process can connect to the host agent on the same host on port 42699. For more information on the required network visibility, refer to the Network requirements documentation for the Instana host agent.

What we see increasingly often, is that in containerized platforms either there are network visibility issues between the container with the application to be traced and the container of the Instana host agent; another issue of the same kind, due to some overlay network setup, the container of the application to be traced does not connect to the Instana agent container on the same host.

Often the problem is that the Ruby tracer is using the wrong ip address or DNS name to talk to the Instana agent. You can instruct the Ruby tracer to user a specific network address via the INSTANA_AGENT_HOST environment-variable.

In very few cases, we have seen customers that set up their networking so that the problem was not the network address, but the port the tracer uses. In case you need a port remapping, because the host agent does not listen on port 42699 but something else, you can instruct the tracer to use a different port via the INSTANA_AGENT_PORT environment variable.

In case none of the above helps you troubleshoot the issue, please open a Support Ticket.

Other issues

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

GitHub

Instana Ruby Github Repository