Method: Sentry.init

Defined in:
lib/sentry-ruby.rb

.init {|config| ... } ⇒ void

This method returns an undefined value.

Initializes the SDK with given configuration.

Yield Parameters:


238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
# File 'lib/sentry-ruby.rb', line 238

def init(&block)
  config = Configuration.new
  yield(config) if block_given?
  config.detect_release
  apply_patches(config)
  config.validate
  client = Client.new(config)
  scope = Scope.new(max_breadcrumbs: config.max_breadcrumbs)
  hub = Hub.new(client, scope)
  Thread.current.thread_variable_set(THREAD_LOCAL, hub)
  @main_hub = hub
  @background_worker = Sentry::BackgroundWorker.new(config)
  @session_flusher = config.session_tracking? ? Sentry::SessionFlusher.new(config, client) : nil
  @backpressure_monitor = config.enable_backpressure_handling ? Sentry::BackpressureMonitor.new(config, client) : nil
  @metrics_aggregator = config.metrics.enabled ? Sentry::Metrics::Aggregator.new(config, client) : nil
  exception_locals_tp.enable if config.include_local_variables
  at_exit { close }
end