Module: OboeBase

Included in:
Oboe
Defined in:
lib/base.rb

Overview

Copyright © 2013 AppNeta, Inc. All rights reserved.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#loadedObject

Returns the value of attribute loaded.



6
7
8
# File 'lib/base.rb', line 6

def loaded
  @loaded
end

#reporterObject

Returns the value of attribute reporter.



5
6
7
# File 'lib/base.rb', line 5

def reporter
  @reporter
end

Class Method Details

.included(cls) ⇒ Object



8
9
10
# File 'lib/base.rb', line 8

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

Instance Method Details

#always?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/base.rb', line 12

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

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



34
35
36
# File 'lib/base.rb', line 34

def log(layer, label, options = {})
  Context.log(layer, label, options = options)
end

#never?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/base.rb', line 16

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

#passthrough?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/base.rb', line 20

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)


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

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

#set_sample_rate(rate) ⇒ Object



54
55
56
# File 'lib/base.rb', line 54

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

#set_tracing_mode(mode) ⇒ Object



50
51
52
# File 'lib/base.rb', line 50

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

#through?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/base.rb', line 24

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

#tracing?Boolean

Returns:

  • (Boolean)


28
29
30
31
32
# File 'lib/base.rb', line 28

def tracing?
  return false unless Oboe.loaded

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