Sha256: cdc90af83978b85a5d079039e13b4269e6ce66e6380dfc0cd08219330c4369f8

Contents?: true

Size: 1.19 KB

Versions: 2

Compression:

Stored size: 1.19 KB

Contents

# Copyright (c) 2013 AppNeta, Inc.
# All rights reserved.

module Oboe
  module API
    ##
    # Provides methods related to layer initialization and reporting
    module LayerInit
      # Internal: Report that instrumentation for the given layer has been
      # installed, as well as the version of instrumentation and version of
      # layer.
      #
      def report_init(layer = 'rack')
        # Don't send __Init in development or test
        return if %w(development test).include? ENV['RACK_ENV']

        # Don't send __Init if the c-extension hasn't loaded
        return unless Oboe.loaded

        platform_info = Oboe::Util.build_report
        start_trace(layer, nil, platform_info.merge('Force' => true)) {}
      end

      ##
      # force_trace has been deprecated and will be removed in a subsequent version.
      #
      def force_trace
        Oboe.logger.warn 'Oboe::API::LayerInit.force_trace has been deprecated and will be ' \
                         'removed in a subsequent version.'

        saved_mode = Oboe::Config[:tracing_mode]
        Oboe::Config[:tracing_mode] = 'always'
        yield
      ensure
        Oboe::Config[:tracing_mode] = saved_mode
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
oboe-2.7.2.fuchs2 lib/oboe/api/layerinit.rb
oboe-2.7.2.fuchs1 lib/oboe/api/layerinit.rb