Sha256: 4998121d26d66ccb956277901aed88ecba7549d2bbcb337d626b6a5aee3e1e18

Contents?: true

Size: 1.21 KB

Versions: 57

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'
require File.expand_path('lib/appsignal/instrumentations/net_http')

describe "Net::HTTP instrumentation" do
  let(:events) { [] }
  before do
    ActiveSupport::Notifications.subscribe(/^[^!]/) do |*args|
      events << ActiveSupport::Notifications::Event.new(*args)
    end
  end

  it "should generate an event for a http request" do
    stub_request(:any, 'http://www.google.com/')

    Net::HTTP.get_response(URI.parse('http://www.google.com'))

    event = events.last
    event.name.should == 'request.net_http'
    event.payload[:protocol].should == 'http'
    event.payload[:domain].should == 'www.google.com'
    event.payload[:path].should == '/'
    event.payload[:method].should == 'GET'
  end

  it "should generate an event for a https request" do
    stub_request(:any, 'https://www.google.com/')

    uri = URI.parse('https://www.google.com')
    http = Net::HTTP.new(uri.host, uri.port)
    http.use_ssl = true
    http.get(uri.request_uri)

    event = events.last
    event.name.should == 'request.net_http'
    event.payload[:protocol].should == 'https'
    event.payload[:domain].should == 'www.google.com'
    event.payload[:path].should == '/'
    event.payload[:method].should == 'GET'
  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
appsignal-0.12.rc.7 spec/lib/appsignal/instrumentations/net_http_spec.rb
appsignal-0.12.rc.6 spec/lib/appsignal/instrumentations/net_http_spec.rb
appsignal-0.12.rc.5 spec/lib/appsignal/instrumentations/net_http_spec.rb
appsignal-0.12.beta.54 spec/lib/appsignal/instrumentations/net_http_spec.rb
appsignal-0.12.beta.53 spec/lib/appsignal/instrumentations/net_http_spec.rb
appsignal-0.12.beta.52 spec/lib/appsignal/instrumentations/net_http_spec.rb
appsignal-0.12.beta.51 spec/lib/appsignal/instrumentations/net_http_spec.rb
appsignal-0.12.beta.50 spec/lib/appsignal/instrumentations/net_http_spec.rb
appsignal-0.12.beta.49 spec/lib/appsignal/instrumentations/net_http_spec.rb
appsignal-0.12.beta.48 spec/lib/appsignal/instrumentations/net_http_spec.rb
appsignal-0.12.beta.47 spec/lib/appsignal/instrumentations/net_http_spec.rb
appsignal-0.12.beta.46 spec/lib/appsignal/instrumentations/net_http_spec.rb
appsignal-0.12.beta.45 spec/lib/appsignal/instrumentations/net_http_spec.rb
appsignal-0.12.beta.44 spec/lib/appsignal/instrumentations/net_http_spec.rb
appsignal-0.12.beta.43 spec/lib/appsignal/instrumentations/net_http_spec.rb
appsignal-0.12.beta.42 spec/lib/appsignal/instrumentations/net_http_spec.rb
appsignal-0.12.beta.41 spec/lib/appsignal/instrumentations/net_http_spec.rb
appsignal-0.12.beta.40 spec/lib/appsignal/instrumentations/net_http_spec.rb
appsignal-0.12.beta.39 spec/lib/appsignal/instrumentations/net_http_spec.rb
appsignal-0.12.beta.38 spec/lib/appsignal/instrumentations/net_http_spec.rb