Module: Oboe
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
123
124
125
126
|
# File 'lib/heroku_metal.rb', line 123
def disconnect!
end
|
.reconnect! ⇒ Object
128
129
130
|
# File 'lib/heroku_metal.rb', line 128
def reconnect!
Oboe::Reporter.start
end
|
.sample?(opts = {}) ⇒ Boolean
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
# File 'lib/heroku_metal.rb', line 73
def sample?(opts = {})
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
113
114
115
116
117
118
|
# File 'lib/heroku_metal.rb', line 113
def set_sample_rate(rate)
if Oboe.loaded
Oboe::Context.setDefaultSampleRate(rate.to_i)
end
end
|
.set_tracing_mode(mode) ⇒ Object
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
# File 'lib/heroku_metal.rb', line 92
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
|