class Object

Constants

OBOE_SAMPLE_RATE_SOURCE_DEFAULT
OBOE_SAMPLE_RATE_SOURCE_DEFAULT_MISCONFIGURED
OBOE_SAMPLE_RATE_SOURCE_FILE
OBOE_SAMPLE_RATE_SOURCE_LAST_OBOE
OBOE_SAMPLE_RATE_SOURCE_OBOE
OBOE_SAMPLE_RATE_SOURCE_OBOE_DEFAULT
OBOE_TRACE_ALWAYS
OBOE_TRACE_NEVER

Constants from liboboe

OBOE_TRACE_THROUGH
SAMPLE_RATE_MASK
SAMPLE_SOURCE_MASK
ZERO_MASK

Masks for bitwise ops

ZERO_SAMPLE_RATE_MASK
ZERO_SAMPLE_SOURCE_MASK

Public Instance Methods

perform_action(*arguments) click to toggle source
# File lib/oboe/frameworks/rails/inst/action_controller.rb, line 188
def perform_action(*arguments)
  report_kvs = {
    :Controller  => @_request.path_parameters['controller'],
    :Action      => @_request.path_parameters['action']
  }
  Oboe::API.log(nil, 'info', report_kvs)
  perform_action_without_oboe(*arguments)
end
Also aliased as: perform_action_without_oboe
perform_action_without_oboe(*arguments)
Alias for: perform_action
process(*args) click to toggle source
# File lib/oboe/frameworks/rails/inst/action_controller.rb, line 177
def process(*args)
  Oboe::API.log_entry('rails')
  process_without_oboe(*args)

rescue Exception => e
  Oboe::API.log_exception(nil, e) if log_rails_error?(e)
  raise
ensure
  Oboe::API.log_exit('rails')
end
Also aliased as: process_without_oboe
process_without_oboe(*args)
Alias for: process
render(options = nil, extra_options = {}, &block) click to toggle source
# File lib/oboe/frameworks/rails/inst/action_controller.rb, line 202
def render(options = nil, extra_options = {}, &block)
  Oboe::API.log_entry('actionview')
  render_without_oboe(options, extra_options, &block)

rescue Exception => e
  Oboe::API.log_exception(nil, e) if log_rails_error?(e)
  raise
ensure
  Oboe::API.log_exit('actionview')
end
Also aliased as: render_without_oboe
render_collection() click to toggle source
# File lib/oboe/frameworks/rails/inst/action_view.rb, line 35
def render_collection
  entry_kvs = {}
  begin
    name = Oboe::Util.prettify(@path)
    entry_kvs[:FunctionName] = :render_collection
    entry_kvs[:Class]        = :PartialRenderer
    entry_kvs[:Module]       = :ActionView
    entry_kvs[:File]         = __FILE__
    entry_kvs[:LineNumber]   = __LINE__
  rescue
  end

  Oboe::API.profile(name, entry_kvs, Oboe::Config[:action_view][:collect_backtraces]) do
    render_collection_without_oboe
  end
end
Also aliased as: render_collection_without_oboe, render_collection_without_oboe
render_collection_without_oboe()
Alias for: render_collection
render_partial() click to toggle source
# File lib/oboe/frameworks/rails/inst/action_view.rb, line 17
def render_partial
  entry_kvs = {}
  begin
    name = Oboe::Util.prettify(@options[:partial]) if @options.is_a?(Hash)
    entry_kvs[:FunctionName] = :render_partial
    entry_kvs[:Class]        = :PartialRenderer
    entry_kvs[:Module]       = :ActionView
    entry_kvs[:File]         = __FILE__
    entry_kvs[:LineNumber]   = __LINE__
  rescue
  end

  Oboe::API.profile(name, entry_kvs, Oboe::Config[:action_view][:collect_backtraces]) do
    render_partial_without_oboe
  end
end
Also aliased as: render_partial_without_oboe, render_partial_without_oboe, render_partial_without_oboe
render_partial_collection(options = {}) click to toggle source
# File lib/oboe/frameworks/rails/inst/action_view_2x.rb, line 34
def render_partial_collection(options = {})
  entry_kvs = {}
  begin
    name  = 'partial_collection'
    entry_kvs[:FunctionName] = :render_partial_collection
    entry_kvs[:Class]        = :Partials
    entry_kvs[:Module]       = :ActionView
    entry_kvs[:File]         = __FILE__
    entry_kvs[:LineNumber]   = __LINE__
  rescue
  end

  Oboe::API.profile(name, entry_kvs, Oboe::Config[:action_view][:collect_backtraces]) do
    render_partial_collection_without_oboe(options)
  end
end
render_partial_collection_without_oboe(options = {})
render_partial_without_oboe()
Alias for: render_partial
render_without_oboe(options = nil, extra_options = {}, &block)
Alias for: render
request(*args, &block)
Also aliased as: request_without_oboe
Alias for: request_with_oboe
request_with_oboe(*args, &block) click to toggle source
# File lib/oboe/inst/http.rb, line 9
def request_with_oboe(*args, &block)
  # If we're not tracing, just do a fast return. Since
  # net/http.request calls itself, only trace
  # once the http session has been started.
  if !Oboe.tracing? || !started?
    return request_without_oboe(*args, &block)
  end

  # Avoid cross host tracing for blacklisted domains
  blacklisted = Oboe::API.blacklisted?(addr_port)

  Oboe::API.trace('net-http') do
    opts = {}
    context = Oboe::Context.toString()
    task_id = Oboe::XTrace.task_id(context)

    # Collect KVs to report in the info event
    if args.length && args[0]
      req = args[0]

      opts['IsService'] = 1
      opts['RemoteProtocol'] = use_ssl? ? 'HTTPS' : 'HTTP'
      opts['RemoteHost'] = addr_port

      # Conditionally log query params
      if Oboe::Config[:nethttp][:log_args]
        opts['ServiceArg'] = req.path
      else
        opts['ServiceArg'] = req.path.split('?').first
      end

      opts['HTTPMethod'] = req.method
      opts['Blacklisted'] = true if blacklisted
      opts['Backtrace'] = Oboe::API.backtrace if Oboe::Config[:nethttp][:collect_backtraces]

      req['X-Trace'] = context unless blacklisted
    end

    begin
      # The actual net::http call
      resp = request_without_oboe(*args, &block)

      # Re-attach net::http edge unless blacklisted and is a valid X-Trace ID
      unless blacklisted
        xtrace = resp.get_fields('X-Trace')
        xtrace = xtrace[0] if xtrace && xtrace.is_a?(Array)

        if Oboe::XTrace.valid?(xtrace)

          # Assure that we received back a valid X-Trace with the same task_id
          if task_id == Oboe::XTrace.task_id(xtrace)
            Oboe::Context.fromString(xtrace)
          else
            Oboe.logger.debug "Mismatched returned X-Trace ID : #{xtrace}"
          end
        end
      end

      opts['HTTPStatus'] = resp.code

      # If we get a redirect, report the location header
      if ((300..308).to_a.include? resp.code.to_i) && resp.header["Location"]
        opts["Location"] = resp.header["Location"]
      end

      next resp
    ensure
      # Log the info event with the KVs in opts
      Oboe::API.log('net-http', 'info', opts)
    end
  end
end
Also aliased as: request
request_without_oboe(*args, &block)
Alias for: request
rescue_action(exn) click to toggle source
# File lib/oboe/frameworks/rails/inst/action_controller.rb, line 197
def rescue_action(exn)
  Oboe::API.log_exception(nil, exn) if log_rails_error?(exn)
  rescue_action_without_oboe(exn)
end
Also aliased as: rescue_action_without_oboe
rescue_action_without_oboe(exn)
Alias for: rescue_action