module TraceView::Inst::CurlEasy

Instrumentation specific to ::Curl::Easy

Public Class Methods

included(klass) click to toggle source
# File lib/traceview/inst/curb.rb, line 108
def self.included(klass)
  ::TraceView::Util.method_alias(klass, :http, ::Curl::Easy)
  ::TraceView::Util.method_alias(klass, :perform, ::Curl::Easy)
  ::TraceView::Util.method_alias(klass, :http_put, ::Curl::Easy)
  ::TraceView::Util.method_alias(klass, :http_post, ::Curl::Easy)
end

Public Instance Methods

http_post_with_traceview(*args, &block) click to toggle source

http_post_with_traceview

::Curl::Easy.new.http_post wrapper

# File lib/traceview/inst/curb.rb, line 120
def http_post_with_traceview(*args, &block)
  # If we're not tracing, just do a fast return.
  if !TraceView.tracing? || TraceView.tracing_layer?(:curb)
    return http_post_without_traceview(*args)
  end

  kvs = {}
  if TraceView::Config[:curb][:cross_host]
    kvs[:HTTPMethod] = :POST
  end

  profile_curb_method(kvs, :http_post_without_traceview, args, &block)
end
http_put_with_traceview(*args, &block) click to toggle source

http_put_with_traceview

::Curl::Easy.new.http_put wrapper

# File lib/traceview/inst/curb.rb, line 139
def http_put_with_traceview(*args, &block)
  # If we're not tracing, just do a fast return.
  if !TraceView.tracing? || TraceView.tracing_layer?(:curb)
    return http_put_without_traceview(data)
  end

  kvs = {}
  if TraceView::Config[:curb][:cross_host]
    kvs[:HTTPMethod] = :PUT
  end

  profile_curb_method(kvs, :http_post_without_traceview, args, &block)
end
http_with_traceview(verb, &block) click to toggle source

http_with_traceview

::Curl::Easy.new.http wrapper

# File lib/traceview/inst/curb.rb, line 184
def http_with_traceview(verb, &block)
  # If we're not tracing, just do a fast return.
  return http_without_traceview(verb) if !TraceView.tracing?

  kvs = {}
  if TraceView::Config[:curb][:cross_host]
    kvs[:HTTPMethod] = verb
  end

  profile_curb_method(kvs, :http_without_traceview, [verb], &block)
end
perform_with_traceview(&block) click to toggle source

perform_with_traceview

::Curl::Easy.new.perform wrapper

# File lib/traceview/inst/curb.rb, line 158
def perform_with_traceview(&block)
  # If we're not tracing, just do a fast return.
  if !TraceView.tracing? || TraceView.tracing_layer?(:curb)
    return perform_without_traceview(&block)
  end

  kvs = {}
  # This perform gets called from two places, ::Curl::Easy.new.perform
  # and Curl::Easy.new.http_head. In the case of http_head we detect the
  # HTTP verb via get info.
  if TraceView::Config[:curb][:cross_host]
    if self.getinfo(self.sym2curl(:nobody))
      kvs[:HTTPMethod] = :HEAD
    else
      kvs[:HTTPMethod] = :GET
    end
  end

  return profile_curb_method(kvs, :perform_without_traceview, nil, &block)
end