sentry-opentelemetry, the OpenTelemetry integration for Sentry's Ruby client
Documentation | Bug Tracker | Forum | IRC: irc.freenode.net, #sentry
The official Ruby-language client and integration layer for the Sentry error reporting API.
Getting Started
Install
gem "sentry-ruby"
gem "sentry-rails"
gem "sentry-opentelemetry"
gem "opentelemetry-sdk"
gem "opentelemetry-instrumentation-all"
Configuration
Initialize Sentry for tracing and set the instrumenter
to :otel
.
# config/initializers/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/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