Module: Oboe

Extended by:
OboeBase
Includes:
Oboe_metal
Defined in:
lib/oboe/api.rb,
lib/oboe/ruby.rb,
lib/oboe/util.rb,
lib/oboe_metal.rb,
lib/oboe/config.rb,
lib/oboe/logger.rb,
lib/oboe/loading.rb,
lib/oboe/version.rb,
lib/oboe/api/util.rb,
lib/oboe/inst/rack.rb,
lib/oboe/inst/dalli.rb,
lib/oboe/inst/mongo.rb,
lib/oboe/inst/moped.rb,
lib/oboe/api/logging.rb,
lib/oboe/api/tracing.rb,
lib/oboe/inst/resque.rb,
lib/oboe/api/memcache.rb,
lib/oboe/api/layerinit.rb,
lib/oboe/api/profiling.rb,
lib/oboe/inst/memcache.rb,
lib/oboe/inst/cassandra.rb,
lib/oboe/inst/memcached.rb,
lib/oboe/instrumentation.rb,
lib/oboe/frameworks/rails.rb,
lib/oboe/frameworks/rails.rb,
lib/rails/generators/oboe/install_generator.rb,
lib/oboe/frameworks/rails/inst/action_controller.rb,
lib/oboe/frameworks/rails/inst/connection_adapters/mysql.rb,
lib/oboe/frameworks/rails/inst/connection_adapters/utils.rb,
lib/oboe/frameworks/rails/inst/connection_adapters/mysql2.rb,
lib/oboe/frameworks/rails/inst/connection_adapters/oracle.rb,
lib/oboe/frameworks/rails/inst/connection_adapters/postgresql.rb

Overview

Copyright © 2013 AppNeta, Inc. All rights reserved.

Defined Under Namespace

Modules: API, Config, Inst, Loading, Rails, Ruby, Util, Version Classes: InstallGenerator, Logger, Rack, Railtie

Class Attribute Summary collapse

Attributes included from OboeBase

#loaded, #reporter

Class Method Summary collapse

Methods included from OboeBase

always?, included, log, never?, passthrough?, sample?, set_sample_rate, set_tracing_mode, through?, tracing?

Class Attribute Details

.loggerObject

Returns the value of attribute logger.



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

def logger
  @logger
end

Class Method Details

.sample?(opts = {}) ⇒ Boolean

Returns:

  • (Boolean)


74
75
76
77
78
79
80
# File 'lib/oboe_metal.rb', line 74

def sample?(opts = {})
  # Assure defaults since SWIG enforces Strings
  opts[:layer]      ||= ''
  opts[:xtrace]     ||= ''
  opts['X-TV-Meta']   ||= ''
  Oboe::Context.sampleRequest(opts[:layer], opts[:xtrace], opts['X-TV-Meta'])
end

.set_sample_rate(rate) ⇒ Object



104
105
106
107
108
109
# File 'lib/oboe_metal.rb', line 104

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



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/oboe_metal.rb', line 82

def set_tracing_mode(mode)
  return unless Oboe.loaded

  value = mode.to_sym

  case value
  when :never
    # OBOE_TRACE_NEVER
    Oboe::Context.setTracingMode(0)
  when :always
    # OBOE_TRACE_ALWAYS
    Oboe::Context.setTracingMode(1)
  when :through
    # OBOE_TRACE_THROUGH
    Oboe::Context.setTracingMode(2)
  else
    Oboe.logger.fatal "[oboe/error] Invalid tracing mode set: #{mode}"
    # OBOE_TRACE_THROUGH
    Oboe::Context.setTracingMode(2)
  end
end