Module: OboeBase
Overview
This module is the base module for the various implementations of Oboe reporting. Current variations as of 2014-09-10 are a c-extension, JRuby (using TraceView Java instrumentation) and a Heroku c-extension (with embedded tracelyzer)
Instance Attribute Summary collapse
-
#collector ⇒ Object
Returns the value of attribute collector.
-
#loaded ⇒ Object
Returns the value of attribute loaded.
-
#reporter ⇒ Object
Returns the value of attribute reporter.
Class Method Summary collapse
Instance Method Summary collapse
-
#always? ⇒ Boolean
Returns true if the tracing_mode is set to always.
-
#forking_webserver? ⇒ Boolean
Determines if we are running under a forking webserver.
-
#framework? ⇒ Boolean
Indicates whether a supported framework is in use or not.
- #heroku? ⇒ Boolean
- #log(_layer, _label, _options = {}) ⇒ Object
-
#never? ⇒ Boolean
Returns true if the tracing_mode is set to never.
-
#passthrough? ⇒ Boolean
Returns true if the tracing_mode is set to always or through.
-
#sample?(_opts = {}) ⇒ Boolean
These methods should be implemented by the descendants (Oboe_metal, Oboe_metal (JRuby), Heroku_metal).
- #set_sample_rate(_rate) ⇒ Object
- #set_tracing_mode(_mode) ⇒ Object
-
#through? ⇒ Boolean
Returns true if the tracing_mode is set to through.
-
#tracing? ⇒ Boolean
Returns true if we are currently tracing a request False otherwise.
- #tracing_layer_op?(operation) ⇒ Boolean
Methods included from Oboe::ThreadLocal
Instance Attribute Details
#collector ⇒ Object
Returns the value of attribute collector.
33 34 35 |
# File 'lib/oboe-heroku/base.rb', line 33 def collector @collector end |
#loaded ⇒ Object
Returns the value of attribute loaded.
34 35 36 |
# File 'lib/oboe-heroku/base.rb', line 34 def loaded @loaded end |
#reporter ⇒ Object
Returns the value of attribute reporter.
32 33 34 |
# File 'lib/oboe-heroku/base.rb', line 32 def reporter @reporter end |
Class Method Details
.included(_) ⇒ Object
39 40 41 |
# File 'lib/oboe-heroku/base.rb', line 39 def self.included(_) self.loaded = true end |
Instance Method Details
#always? ⇒ Boolean
Returns true if the tracing_mode is set to always. False otherwise
55 56 57 |
# File 'lib/oboe-heroku/base.rb', line 55 def always? Oboe::Config[:tracing_mode].to_s == 'always' end |
#forking_webserver? ⇒ Boolean
Determines if we are running under a forking webserver
105 106 107 |
# File 'lib/oboe-heroku/base.rb', line 105 def forking_webserver? (defined?(::Unicorn) && ($PROGRAM_NAME =~ /unicorn/i)) ? true : false end |
#framework? ⇒ Boolean
Indicates whether a supported framework is in use or not
113 114 115 |
# File 'lib/oboe-heroku/base.rb', line 113 def framework? defined?(::Rails) or defined?(::Sinatra) or defined?(::Padrino) or defined?(::Grape) end |
#heroku? ⇒ Boolean
98 99 100 |
# File 'lib/oboe-heroku/base.rb', line 98 def heroku? ENV['TRACEVIEW_URL'] end |
#log(_layer, _label, _options = {}) ⇒ Object
93 94 95 96 |
# File 'lib/oboe-heroku/base.rb', line 93 def log(layer, label, = {}) # WARN: Oboe.log will be deprecated in a future release. Please use Oboe::API.log instead. Oboe::API.log(layer, label, ) end |
#never? ⇒ Boolean
Returns true if the tracing_mode is set to never. False otherwise
63 64 65 |
# File 'lib/oboe-heroku/base.rb', line 63 def never? Oboe::Config[:tracing_mode].to_s == 'never' end |
#passthrough? ⇒ Boolean
Returns true if the tracing_mode is set to always or through. False otherwise
71 72 73 |
# File 'lib/oboe-heroku/base.rb', line 71 def passthrough? %w(always through).include?(Oboe::Config[:tracing_mode]) end |
#sample?(_opts = {}) ⇒ Boolean
These methods should be implemented by the descendants (Oboe_metal, Oboe_metal (JRuby), Heroku_metal)
121 122 123 |
# File 'lib/oboe-heroku/base.rb', line 121 def sample?(_opts = {}) fail 'sample? should be implemented by metal layer.' end |
#set_sample_rate(_rate) ⇒ Object
133 134 135 |
# File 'lib/oboe-heroku/base.rb', line 133 def set_sample_rate(_rate) fail 'set_sample_rate should be implemented by metal layer.' end |
#set_tracing_mode(_mode) ⇒ Object
129 130 131 |
# File 'lib/oboe-heroku/base.rb', line 129 def set_tracing_mode(_mode) fail 'set_tracing_mode should be implemented by metal layer.' end |
#through? ⇒ Boolean
Returns true if the tracing_mode is set to through. False otherwise
79 80 81 |
# File 'lib/oboe-heroku/base.rb', line 79 def through? Oboe::Config[:tracing_mode] == 'through' end |