Module: Oboe::API::LayerInit
- Defined in:
- lib/oboe/api/layerinit.rb
Instance Method Summary collapse
-
#force_trace ⇒ Object
force_trace has been deprecated and will be removed in a subsequent version.
-
#report_init(layer = 'rack') ⇒ Object
Internal: Report that instrumentation for the given layer has been installed, as well as the version of instrumentation and version of layer.
Instance Method Details
#force_trace ⇒ Object
force_trace has been deprecated and will be removed in a subsequent version.
88 89 90 91 92 93 94 95 96 |
# File 'lib/oboe/api/layerinit.rb', line 88 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 |
#report_init(layer = 'rack') ⇒ Object
Internal: Report that instrumentation for the given layer has been installed, as well as the version of instrumentation and version of layer.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/oboe/api/layerinit.rb', line 11 def report_init(layer = 'rack') # Don't send __Init in development or test return if ["development", "test"].include? ENV['RACK_ENV'] # Don't send __Init if the c-extension hasn't loaded return unless Oboe.loaded platform_info = { '__Init' => 1 } begin platform_info['Force'] = true platform_info['Ruby.Platform.Version'] = RUBY_PLATFORM platform_info['Ruby.Version'] = RUBY_VERSION platform_info['Ruby.Oboe.Version'] = ::Oboe::Version::STRING platform_info['RubyHeroku.Oboe.Version'] = ::OboeHeroku::Version::STRING if defined?(::OboeHeroku) # Report the framework in use platform_info['Ruby.Rails.Version'] = "Rails-#{::Rails.version}" if defined?(::Rails) platform_info['Ruby.Grape.Version'] = "Grape-#{::Grape::VERSION}" if defined?(::Grape) platform_info['Ruby.Cramp.Version'] = "Cramp-#{::Cramp::VERSION}" if defined?(::Cramp) if defined?(::Padrino) platform_info['Ruby.Padrino.Version'] = "Padrino-#{::Padrino::VERSION}" elsif defined?(::Sinatra) platform_info['Ruby.Sinatra.Version'] = "Sinatra-#{::Sinatra::VERSION}" end # Report the instrumented libraries platform_info['Ruby.Cassandra.Version'] = "Cassandra-#{::Cassandra.VERSION}" if defined?(::Cassandra) platform_info['Ruby.Dalli.Version'] = "Dalli-#{::Dalli::VERSION}" if defined?(::Dalli) platform_info['Ruby.MemCache.Version'] = "MemCache-#{::MemCache::VERSION}" if defined?(::MemCache) platform_info['Ruby.Moped.Version'] = "Moped-#{::Moped::VERSION}" if defined?(::Moped) platform_info['Ruby.Redis.Version'] = "Redis-#{::Redis::VERSION}" if defined?(::Redis) platform_info['Ruby.Resque.Version'] = "Resque-#{::Resque::VERSION}" if defined?(::Resque) # Special case since the Mongo 1.x driver doesn't embed the version number in the gem directly if ::Gem.loaded_specs.has_key?('mongo') platform_info['Ruby.Mongo.Version'] = "Mongo-#{::Gem.loaded_specs['mongo'].version.to_s}" end # Report the server in use (if possible) if defined?(::Unicorn) platform_info['Ruby.AppContainer.Version'] = "Unicorn-#{::Unicorn::Const::UNICORN_VERSION}" elsif defined?(::Puma) platform_info['Ruby.AppContainer.Version'] = "Puma-#{::Puma::Const::PUMA_VERSION} (#{::Puma::Const::CODE_NAME})" elsif defined?(::PhusionPassenger) platform_info['Ruby.AppContainer.Version'] = "#{::PhusionPassenger::PACKAGE_NAME}-#{::PhusionPassenger::VERSION_STRING}" elsif defined?(::Thin) platform_info['Ruby.AppContainer.Version'] = "Thin-#{::Thin::VERSION::STRING} (#{::Thin::VERSION::CODENAME})" elsif defined?(::Mongrel) platform_info['Ruby.AppContainer.Version'] = "Mongrel-#{::Mongrel::Const::MONGREL_VERSION}" elsif defined?(::Mongrel2) platform_info['Ruby.AppContainer.Version'] = "Mongrel2-#{::Mongrel2::VERSION}" elsif defined?(::Trinidad) platform_info['Ruby.AppContainer.Version'] = "Trinidad-#{::Trinidad::VERSION}" elsif defined?(::WEBrick) platform_info['Ruby.AppContainer.Version'] = "WEBrick-#{::WEBrick::VERSION}" else platform_info['Ruby.AppContainer.Version'] = "Unknown" end # If we couldn't load the c extension correctly, report the error to the dashboard. unless Oboe.loaded platform_info['Error'] = "Missing TraceView libraries. Tracing disabled." end rescue StandardError => e Oboe.logger.debug "Error in layerinit: #{e.}" Oboe.logger.debug e.backtrace end start_trace(layer, nil, platform_info) { } end |