class Object

Public Instance Methods

_render_template(template, layout = nil, options = {}) click to toggle source
# File lib/app_perf_rpm/instruments/action_view/action_view_rails_3_0.rb, line 55
def _render_template(template, layout = nil, options = {})
  if ::AppPerfRpm::Tracer.tracing?
    span = AppPerfRpm.tracer.start_span("render_template")
    span.set_tag "view.template", template
    span.set_tag "view.layout", layout
    span.set_tag "component", "ActionView"
    span.set_tag "span.kind", "client"
    AppPerfRpm::Utils.log_source_and_backtrace(span, :action_view)
  end

  _render_template_without_trace(template, layout, options)
rescue Exception => e
  if span
    span.set_tag('error', true)
    span.log_error(e)
  end
  raise
ensure
  span.finish if span
end
_render_template_without_trace(template, layout = nil, options = {})
Alias for: _render_template
as_json(*args) click to toggle source
# File lib/app_perf_rpm/instruments/active_model_serializer.rb, line 15
def as_json(*args)
  if ::AppPerfRpm::Tracer.tracing?
    span = AppPerfRpm.tracer.start_span("ActiveModel::Serializer", tags: {
      "serializer" => self.class.to_s
    })
    AppPerfRpm::Utils.log_source_and_backtrace(span, :active_model_serializer)
  end

  as_json_without_trace(*args)
rescue Exception => e
  if span
    span.set_tag('error', true)
    span.log_error(e)
  end
  raise
ensure
  span.finish if span
end
Also aliased as: as_json_without_trace
as_json_without_trace(*args)
Alias for: as_json
render_collection() click to toggle source
# File lib/app_perf_rpm/instruments/action_view/action_view_rails_3_0.rb, line 26
def render_collection
  if ::AppPerfRpm::Tracer.tracing?
    span = AppPerfRpm.tracer.start_span("render_collection", tags: {
      "component" => "ActionView",
      "span.kind" => "client",
      "view.template" => @path
    })
    if @_request
      span.set_tag('view.controller', @_request.path_parameters['controller'])
      span.set_tag('view.action', @_request.path_parameters['action'])
    end
    AppPerfRpm::Utils.log_source_and_backtrace(span, :action_view)
  end

  render_collection_without_trace
rescue Exception => e
  if span
    span.set_tag('error', true)
    span.log_error(e)
  end
  raise
ensure
  span.finish if span
end
Also aliased as: render_collection_without_trace, render_collection_without_trace, render_collection_without_trace
render_collection_without_trace()
Alias for: render_collection
render_partial(options = {}) click to toggle source
# File lib/app_perf_rpm/instruments/action_view/action_view_rails_2.rb, line 4
def render_partial(options = {})
  if ::AppPerfRpm::Tracer.tracing? && options.key?(:partial) && options[:partial].is_a?(String)
    span = AppPerfRpm.tracer.start_span("render_partial", tags: {
      "component" => "ActionView",
      "span.kind" => "client",
      "view.controller" => @_request.path_parameters['controller'],
      "view.action" => @_request.path_parameters['action'],
      "view.template" => options[:partial]
    })
    AppPerfRpm::Utils.log_source_and_backtrace(span, :action_view)
  end

  render_partial_without_trace(options)
rescue Exception => e
  if span
    span.set_tag('error', true)
    span.log_error(e)
  end
  raise
ensure
  span.finish if span
end
Also aliased as: render_partial_without_trace, render_partial_without_trace, render_partial_without_trace, render_partial_without_trace
render_partial_collection(options = {}) click to toggle source
# File lib/app_perf_rpm/instruments/action_view/action_view_rails_2.rb, line 28
def render_partial_collection(options = {})
  if ::AppPerfRpm::Tracer.tracing?
    span = AppPerfRpm.tracer.start_span("render_partial_collection", tags: {
      "component" => "ActionView",
      "span.kind" => "client",
      "view.controller" => @_request.path_parameters['controller'],
      "view.action" => @_request.path_parameters['action'],
      "view.template" => @path
    })
    AppPerfRpm::Utils.log_source_and_backtrace(span, :action_view)
  end

  render_partial_collection_without_trace(options)
rescue Exception => e
  if span
    span.set_tag('error', true)
    span.log_error(e)
  end
  raise
ensure
  span.finish if span
end
render_partial_collection_without_trace(options = {})
render_partial_without_trace(options = {})
Alias for: render_partial
render_template(template, layout_name = nil, locals = {}) click to toggle source
# File lib/app_perf_rpm/instruments/action_view/action_view_rails_3_1_to_5.rb, line 55
def render_template(template, layout_name = nil, locals = {})
  if ::AppPerfRpm::Tracer.tracing?
    layout = if layout_name
               if layout_name.is_a?(String)
                 layout_name
               elsif layout_name.is_a?(Proc)
                 layout_name.call
               elsif method(:find_layout).arity == 3
                 find_layout(layout_name, locals, [formats.first])
               elsif locals
                 find_layout(layout_name, locals)
               end
             end
    span = AppPerfRpm.tracer.start_span("render_template")
    span.set_tag "view.layout", layout ? layout.inspect : ""
    span.set_tag "view.template", template.inspect
    span.set_tag "component", "ActionView"
    span.set_tag "span.kind", "client"
    AppPerfRpm::Utils.log_source_and_backtrace(span, :action_view)
  end

  render_template_without_trace(template, layout_name, locals)
rescue Exception => e
  if span
    span.set_tag('error', true)
    span.log_error(e)
  end
  raise
ensure
  span.finish if span
end
Also aliased as: render_template_without_trace, render_template_without_trace
render_template_without_trace(template, layout_name = nil, locals = {})
Alias for: render_template
request(*args, &block)
Also aliased as: request_without_trace
Alias for: request_with_trace
request_with_trace(*args, &block) click to toggle source
# File lib/app_perf_rpm/instruments/net_http.rb, line 7
def request_with_trace(*args, &block)
  if ::AppPerfRpm::Tracer.tracing?
    span = ::AppPerfRpm.tracer.start_span("net-http", tags: {
      "component" => "NetHttp",
      "span.kind" => "client"
    })

    if args.length && args[0]
      req = args[0]
      AppPerfRpm.tracer.inject(span.context, OpenTracing::FORMAT_RACK, req)
      span.set_tag "http.protocol", (use_ssl? ? "https" : "http")
      span.set_tag "http.url", req.path
      span.set_tag "http.method", req.method
      span.set_tag "peer.hostname", addr_port
      AppPerfRpm::Utils.log_source_and_backtrace(span, :net_http)
    end

    response = request_without_trace(*args, &block)

    span.exit
    span.set_tag "http.status_code", response.code

    if (response.code.to_i >= 300 || response.code.to_i <= 308) && response.header["Location"]
      span.set_tag "http.redirect", response.header["Location"]
    end

    span.finish
  else
    response = request_without_trace(*args, &block)
  end
  response
end
Also aliased as: request
request_without_trace(*args, &block)
Alias for: request