Skip to content

Latest commit

 

History

History
65 lines (44 loc) · 2.3 KB

README.md

File metadata and controls

65 lines (44 loc) · 2.3 KB


sentry-opentelemetry, the OpenTelemetry integration for Sentry's Ruby client


Gem Version Build Status Coverage Status Gem SemVer

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

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