Module: Oboe
Defined Under Namespace
Classes: Event, Reporter
Instance Attribute Summary
Attributes included from OboeBase
#loaded, #reporter, #sample_rate, #sample_source
Class Method Summary
collapse
Methods included from OboeBase
always?, forking_webserver?, heroku?, included, log, never?, passthrough?, sample?, set_sample_rate, set_tracing_mode, through?, tracing?
Class Method Details
.disconnect! ⇒ Object
Disconnect/Reconnect wrappers used for forking webservers such as Unicorn or Passenger
101
102
103
104
|
# File 'lib/heroku_metal.rb', line 101
def disconnect!
end
|
.reconnect! ⇒ Object
106
107
108
|
# File 'lib/heroku_metal.rb', line 106
def reconnect!
Oboe::Reporter.start
end
|
.sample?(opts = {}) ⇒ Boolean
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/heroku_metal.rb', line 49
def sample?(opts = {})
return false unless Oboe.always?
opts[:layer] ||= ''
opts[:xtrace] ||= ''
opts['X-TV-Meta'] ||= ''
rv = Oboe::Context.sampleRequest(opts[:layer], opts[:xtrace], opts['X-TV-Meta'])
return rv if [TrueClass, FalseClass].include?(rv.class) or (rv == 0)
Oboe.sample_rate = (rv & SAMPLE_RATE_MASK)
Oboe.sample_source = (rv & SAMPLE_SOURCE_MASK) >> 24
rv
end
|
.set_sample_rate(rate) ⇒ Object
91
92
93
94
95
96
|
# File 'lib/heroku_metal.rb', line 91
def set_sample_rate(rate)
if Oboe.loaded
Oboe::Context.setDefaultSampleRate(rate.to_i)
end
end
|
.set_tracing_mode(mode) ⇒ Object
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
# File 'lib/heroku_metal.rb', line 70
def set_tracing_mode(mode)
return unless Oboe.loaded
value = mode.to_sym
case value
when :never
Oboe::Context.setTracingMode(OBOE_TRACE_NEVER)
when :always
Oboe::Context.setTracingMode(OBOE_TRACE_ALWAYS)
when :through
Oboe::Context.setTracingMode(OBOE_TRACE_THROUGH)
else
Oboe.logger.fatal "[oboe/error] Invalid tracing mode set: #{mode}"
Oboe::Context.setTracingMode(OBOE_TRACE_THROUGH)
end
end
|