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
-
#loaded ⇒ Object
Returns the value of attribute loaded.
-
#reporter ⇒ Object
Returns the value of attribute reporter.
-
#sample_rate ⇒ Object
Returns the value of attribute sample_rate.
-
#sample_source ⇒ Object
Returns the value of attribute sample_source.
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
#loaded ⇒ Object
Returns the value of attribute loaded.
33 34 35 |
# File 'lib/oboe/base.rb', line 33 def loaded @loaded end |
#reporter ⇒ Object
Returns the value of attribute reporter.
32 33 34 |
# File 'lib/oboe/base.rb', line 32 def reporter @reporter end |
#sample_rate ⇒ Object
Returns the value of attribute sample_rate.
35 36 37 |
# File 'lib/oboe/base.rb', line 35 def sample_rate @sample_rate end |
#sample_source ⇒ Object
Returns the value of attribute sample_source.
34 35 36 |
# File 'lib/oboe/base.rb', line 34 def sample_source @sample_source end |
Class Method Details
.extended(cls) ⇒ Object
42 43 44 |
# File 'lib/oboe/base.rb', line 42 def self.extended(cls) cls.loaded = true end |
.included(cls) ⇒ Object
38 39 40 |
# File 'lib/oboe/base.rb', line 38 def self.included(cls) cls.loaded = true end |
Instance Method Details
#always? ⇒ Boolean
Returns true if the tracing_mode is set to always. False otherwise
58 59 60 |
# File 'lib/oboe/base.rb', line 58 def always? Oboe::Config[:tracing_mode].to_s == 'always' end |
#forking_webserver? ⇒ Boolean
Determines if we are running under a forking webserver
108 109 110 |
# File 'lib/oboe/base.rb', line 108 def forking_webserver? (defined?(::Unicorn) && ($PROGRAM_NAME =~ /unicorn/i)) ? true : false end |
#framework? ⇒ Boolean
Indicates whether a supported framework is in use or not
116 117 118 |
# File 'lib/oboe/base.rb', line 116 def framework? defined?(::Rails) or defined?(::Sinatra) or defined?(::Padrino) or defined?(::Grape) end |
#heroku? ⇒ Boolean
101 102 103 |
# File 'lib/oboe/base.rb', line 101 def heroku? ENV.key?('TRACEVIEW_URL') end |
#log(_layer, _label, _options = {}) ⇒ Object
96 97 98 99 |
# File 'lib/oboe/base.rb', line 96 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
66 67 68 |
# File 'lib/oboe/base.rb', line 66 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
74 75 76 |
# File 'lib/oboe/base.rb', line 74 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)
124 125 126 |
# File 'lib/oboe/base.rb', line 124 def sample?(_opts = {}) fail 'sample? should be implemented by metal layer.' end |
#set_sample_rate(_rate) ⇒ Object
136 137 138 |
# File 'lib/oboe/base.rb', line 136 def set_sample_rate(_rate) fail 'set_sample_rate should be implemented by metal layer.' end |
#set_tracing_mode(_mode) ⇒ Object
132 133 134 |
# File 'lib/oboe/base.rb', line 132 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
82 83 84 |
# File 'lib/oboe/base.rb', line 82 def through? Oboe::Config[:tracing_mode] == 'through' end |