Sha256: a701cd850ac4c6d6d71639392f7ebd823f2eb5f339ba40822ee4d2d6c8e6bd95

Contents?: true

Size: 1.48 KB

Versions: 29

Compression:

Stored size: 1.48 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_init_report

        # If already tracing, save and clear the context.  Restore it after
        # the __Init is sent
        context = nil

        if Oboe.tracing?
          context = Oboe::Context.toString
          Oboe::Context.clear
        end

        start_trace(layer, nil, platform_info.merge('Force' => true)) {}

        Oboe::Context.fromString(context) if context
      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

29 entries across 29 versions & 1 rubygems

Version Path
oboe-2.7.19-java lib/oboe/api/layerinit.rb
oboe-2.7.19 lib/oboe/api/layerinit.rb
oboe-2.7.18-java lib/oboe/api/layerinit.rb
oboe-2.7.18 lib/oboe/api/layerinit.rb
oboe-2.7.17.1-java lib/oboe/api/layerinit.rb
oboe-2.7.17.1 lib/oboe/api/layerinit.rb
oboe-2.7.16.1 lib/oboe/api/layerinit.rb
oboe-2.7.16.1-java lib/oboe/api/layerinit.rb
oboe-2.7.15.1-java lib/oboe/api/layerinit.rb
oboe-2.7.15.1 lib/oboe/api/layerinit.rb
oboe-2.7.14.1-java lib/oboe/api/layerinit.rb
oboe-2.7.14.1 lib/oboe/api/layerinit.rb
oboe-2.7.13.3-java lib/oboe/api/layerinit.rb
oboe-2.7.13.3 lib/oboe/api/layerinit.rb
oboe-2.7.12.1-java lib/oboe/api/layerinit.rb
oboe-2.7.12.1 lib/oboe/api/layerinit.rb
oboe-2.7.11.1 lib/oboe/api/layerinit.rb
oboe-2.7.11.1-java lib/oboe/api/layerinit.rb
oboe-2.7.10.1-java lib/oboe/api/layerinit.rb
oboe-2.7.10.1 lib/oboe/api/layerinit.rb