lib/oboe-heroku/base.rb in oboe-heroku-0.9.14.4 vs lib/oboe-heroku/base.rb in oboe-heroku-0.9.15.6
- old
+ new
@@ -20,36 +20,31 @@
SAMPLE_SOURCE_MASK = 0b1111000000000000000000000000
ZERO_SAMPLE_RATE_MASK = 0b1111000000000000000000000000
ZERO_SAMPLE_SOURCE_MASK = 0b0000111111111111111111111111
-module Oboe_metal
- class Context
- class << self
- attr_accessor :layer_op
-
- def tracing_layer_op?(operation)
- if operation.is_a?(Array)
- return operation.include?(@layer_op)
- else
- return @layer_op == operation
- end
- end
- end
- end
-end
-
module OboeBase
+ extend ::Oboe::ThreadLocal
+
attr_accessor :reporter
attr_accessor :loaded
attr_accessor :sample_source
attr_accessor :sample_rate
+ thread_local :layer_op
def self.included(cls)
self.loaded = true
end
+ def tracing_layer_op?(operation)
+ if operation.is_a?(Array)
+ return operation.include?(Oboe.layer_op)
+ else
+ return Oboe.layer_op == operation
+ end
+ end
+
def always?
Oboe::Config[:tracing_mode].to_s == "always"
end
def never?
@@ -101,7 +96,11 @@
def set_sample_rate(rate)
raise "set_sample_rate should be implemented by metal layer."
end
+end
+
+module Oboe
+ extend OboeBase
end