Module: OboeBase

Included in:
Oboe
Defined in:
lib/oboe-heroku/base.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#loadedObject

Returns the value of attribute loaded.



43
44
45
# File 'lib/oboe-heroku/base.rb', line 43

def loaded
  @loaded
end

#reporterObject

Returns the value of attribute reporter.



42
43
44
# File 'lib/oboe-heroku/base.rb', line 42

def reporter
  @reporter
end

#sample_rateObject

Returns the value of attribute sample_rate.



45
46
47
# File 'lib/oboe-heroku/base.rb', line 45

def sample_rate
  @sample_rate
end

#sample_sourceObject

Returns the value of attribute sample_source.



44
45
46
# File 'lib/oboe-heroku/base.rb', line 44

def sample_source
  @sample_source
end

Class Method Details

.included(cls) ⇒ Object



47
48
49
# File 'lib/oboe-heroku/base.rb', line 47

def self.included(cls)
  self.loaded = true
end

Instance Method Details

#always?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/oboe-heroku/base.rb', line 51

def always?
  Oboe::Config[:tracing_mode].to_s == "always"
end

#forking_webserver?Boolean

Returns:

  • (Boolean)


82
83
84
# File 'lib/oboe-heroku/base.rb', line 82

def forking_webserver?
  (defined?(::Unicorn) and ($0 =~ /unicorn/i)) ? true : false
end

#heroku?Boolean

Returns:

  • (Boolean)


78
79
80
# File 'lib/oboe-heroku/base.rb', line 78

def heroku?
  true
end

#log(layer, label, options = {}) ⇒ Object



73
74
75
76
# File 'lib/oboe-heroku/base.rb', line 73

def log(layer, label, options = {})
  # WARN: Oboe.log will be deprecated in a future release.  Please use Oboe::API.log instead.
  Oboe::API.log(layer, label, options)
end

#never?Boolean

Returns:

  • (Boolean)


55
56
57
# File 'lib/oboe-heroku/base.rb', line 55

def never?
  Oboe::Config[:tracing_mode].to_s == "never"
end

#passthrough?Boolean

Returns:

  • (Boolean)


59
60
61
# File 'lib/oboe-heroku/base.rb', line 59

def passthrough?
  ["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)

Returns:

  • (Boolean)


90
91
92
# File 'lib/oboe-heroku/base.rb', line 90

def sample?(opts = {})
  raise "sample? should be implemented by metal layer."
end

#set_sample_rate(rate) ⇒ Object



102
103
104
# File 'lib/oboe-heroku/base.rb', line 102

def set_sample_rate(rate)
  raise "set_sample_rate should be implemented by metal layer."
end

#set_tracing_mode(mode) ⇒ Object



98
99
100
# File 'lib/oboe-heroku/base.rb', line 98

def set_tracing_mode(mode)
  raise "set_tracing_mode should be implemented by metal layer."
end

#through?Boolean

Returns:

  • (Boolean)


63
64
65
# File 'lib/oboe-heroku/base.rb', line 63

def through?
  Oboe::Config[:tracing_mode] == "through"
end

#tracing?Boolean

Returns:

  • (Boolean)


67
68
69
70
71
# File 'lib/oboe-heroku/base.rb', line 67

def tracing?
  return false unless Oboe.loaded

  Oboe::Context.isValid and not Oboe.never?
end