Ruby

Aspecto's SDK for ruby.

Aspecto::OpenTelemetry

This gem is a distribution of OpenTelemetry pre-configured to use all available instrumentations and export trace data to Aspecto.

Installation

Install the gem using:

$ gem install aspecto-opentelemetry

Or, if you use bundler, include aspecto-opentelemetry in your Gemfile.

Usage

Rails Applications

Add this code to a new file aspecto.rb under config/initializers/:

# config/initializers/aspecto.rb
require 'aspecto/opentelemetry'

Aspecto::OpenTelemetry::configure do |c|
  c.service_name = '<YOUR_SERVICE_NAME>'
  c.aspecto_auth = '<YOUR_ASPECTO_TOKEN>'
  # c.sampling_ratio = 1.0 # [optional]: defaults to 1.0, use aspecto app to configure remotely
end

Ruby Applications

Add this code after your require other gems:

require 'aspecto/opentelemetry'

Aspecto::OpenTelemetry::configure do |c|
  c.service_name = '<YOUR_SERVICE_NAME>'
  c.aspecto_auth = '<YOUR_ASPECTO_TOKEN>'
  # c.env = '<CURRENT_ENVIRONMENT>' # [optional]: automatically detected for rails and sinatra
  # c.sampling_ratio = 1.0 # [optional]: defaults to 1.0, use aspecto app to configure remotely
end

Shutdown

Call this function when your application shuts down

Aspecto::OpenTelemetry::shutdown

Configuration

You can set configuration via environment variables or via code. Values set in code takes precedence. The only required config options are aspecto_auth and service_name.

Configuration Options

Last updated