Documentation | Bug Tracker | Forum | IRC: irc.freenode.net, #sentry
The official Ruby-language client and integration layer for the Sentry error reporting API.
gem "sentry-ruby"
gem "sentry-rails"
gem "sentry-opentelemetry"
gem "opentelemetry-sdk"
gem "opentelemetry-instrumentation-all"
First, make sure to initialize Sentry before OpenTelemetry by prefixing your initializers and set the instrumenter
to :otel
.
# config/initializers/01_sentry.rb
Sentry.init do |config|
config.dsn = "MY_DSN"
config.traces_sample_rate = 1.0
config.instrumenter = :otel
end
This will disable all Sentry instrumentation and rely on the chosen OpenTelemetry tracers for creating spans.
Next, configure OpenTelemetry as per your needs and hook in the Sentry span processor and propagator.
# config/initializers/02_otel.rb
OpenTelemetry::SDK.configure do |c|
c.use_all
c.add_span_processor(Sentry::OpenTelemetry::SpanProcessor.instance)
end
OpenTelemetry.propagation = Sentry::OpenTelemetry::Propagator.new