Module: Oboe
- Extended by:
- OboeBase
- Includes:
- Oboe_metal
- Defined in:
- lib/heroku_metal.rb,
lib/oboe-heroku/base.rb,
lib/oboe-heroku/thread_local.rb
Overview
Copyright © 2014 AppNeta, Inc. All rights reserved.
Defined Under Namespace
Modules: ThreadLocal Classes: Event, Reporter
Instance Attribute Summary
Attributes included from OboeBase
#collector, #loaded, #reporter
Class Method Summary collapse
-
.disconnect! ⇒ Object
Disconnect/Reconnect wrappers used for forking webservers such as Unicorn or Passenger.
- .reconnect! ⇒ Object
- .sample?(opts = {}) ⇒ Boolean
- .set_sample_rate(rate) ⇒ Object
- .set_tracing_mode(mode) ⇒ Object
Methods included from OboeBase
always?, forking_webserver?, framework?, heroku?, included, log, never?, passthrough?, sample?, set_sample_rate, set_tracing_mode, through?, tracing?, tracing_layer_op?
Methods included from ThreadLocal
Class Method Details
.disconnect! ⇒ Object
Disconnect/Reconnect wrappers used for forking webservers such as Unicorn or Passenger
99 100 101 102 |
# File 'lib/heroku_metal.rb', line 99 def disconnect! # To avoid an issue with SSL reconnects, delay Reporter initialization # until after the fork is completed. Here, do nothing for now. end |
.reconnect! ⇒ Object
104 105 106 |
# File 'lib/heroku_metal.rb', line 104 def reconnect! Oboe::Reporter.start end |
.sample?(opts = {}) ⇒ Boolean
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/heroku_metal.rb', line 47 def sample?(opts = {}) return false unless Oboe.always? # Assure defaults since SWIG enforces Strings opts[:layer] ||= '' opts[:xtrace] ||= '' opts['X-TV-Meta'] ||= '' rv = Oboe::Context.sampleRequest(opts[:layer], opts[:xtrace], opts['X-TV-Meta']) # For older liboboe that returns true/false, just return that. return rv if [TrueClass, FalseClass].include?(rv.class) or (rv == 0) # liboboe version > 1.3.1 returning a bit masked integer with SampleRate and # source embedded Oboe.sample_rate = (rv & SAMPLE_RATE_MASK) Oboe.sample_source = (rv & SAMPLE_SOURCE_MASK) >> 24 rv end |
.set_sample_rate(rate) ⇒ Object
89 90 91 92 93 94 |
# File 'lib/heroku_metal.rb', line 89 def set_sample_rate(rate) if Oboe.loaded # Update liboboe with the new SampleRate value Oboe::Context.setDefaultSampleRate(rate.to_i) end end |
.set_tracing_mode(mode) ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/heroku_metal.rb', line 68 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 |