Sha256: 2b6a21da93761829f7b27d03ac8660962d8d340a172225356ae5d301341a4297

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

# Instrumenting Rails

Install the instrumentation library by adding it to your project's `Gemfile`:

``` ruby
gem "opentelemetry-instrumentation-rails", "~> 0.24"
```

or install the gem using `bundle`:

```shell
bundle add opentelemetry-instrumentation-rails --version "~> 0.24"
```

Configure OpenTelemetry to use all available instrumentation libraries by adding the
`Splunk::Otel` module from `splunk/otel` and `use_all()` method to a Rails initializer:

``` ruby
# config/initializers/opentelemetry.rb
require "splunk/otel"
...
Splunk::Otel.configure do |c|
  c.use_all()
end
```

You can disable individual components' instrumentation as options to
`use_all`. For example to disable Active Record instrumentation:

``` ruby
Splunk::Otel.configure do |c|
  c.use_all({ 'OpenTelemetry::Instrumentation::ActiveRecord' => { enabled: false } })
end
```

To enable only Rails, you can use an individual `c.use`:

```ruby
Splunk::Otel.configure do |c|
  c.use 'OpenTelemetry::Instrumentation::Rails'
end
```

## Example

See the [readme for Rails 7 barebones example](../examples/rails-7-barebones/README.md).

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
splunk-otel-1.1.0 docs/instrumenting-rails.md