Sha256: f1f72cddc556722f199d416f3b5def22929af5e6f067f3ce475db10f52fb7f63

Contents?: true

Size: 1.08 KB

Versions: 9

Compression:

Stored size: 1.08 KB

Contents

# encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.

require 'new_relic/agent/instrumentation/rack'

class TestingApp

  attr_accessor :response, :headers

  def initialize
    reset_headers
  end

  def reset_headers
    @headers = {'Content-Type' => 'text/html'}
  end

  def call(env)
    request = Rack::Request.new(env)
    params = request.params
    if params['transaction_name']
      opts = {}
      if params['transaction_category']
        opts[:category] = params['transaction_category']
        NewRelic::Agent::Transaction.stubs(:transaction_category_is_web?).returns(true)
      end
      NewRelic::Agent.set_transaction_name(params['transaction_name'], opts)
    end
    if params['cross_app_caller']
      NewRelic::Agent::TransactionState.tl_get.is_cross_app_caller = true
    end
    stub_transaction_guid(params['guid']) if params['guid']
    sleep(params['sleep'].to_f) if params['sleep']
    [200, headers, [response]]
  end

  include NewRelic::Agent::Instrumentation::Rack
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
newrelic_rpm-3.9.9.275 test/multiverse/suites/agent_only/testing_app.rb
newrelic_rpm-3.9.8.273 test/multiverse/suites/agent_only/testing_app.rb
newrelic_rpm-3.9.7.266 test/multiverse/suites/agent_only/testing_app.rb
newrelic_rpm-3.9.6.257 test/multiverse/suites/agent_only/testing_app.rb
newrelic_rpm-3.9.5.251 test/multiverse/suites/agent_only/testing_app.rb
newrelic_rpm-3.9.4.245 test/multiverse/suites/agent_only/testing_app.rb
newrelic_rpm-3.9.3.241 test/multiverse/suites/agent_only/testing_app.rb
newrelic_rpm-3.9.2.239 test/multiverse/suites/agent_only/testing_app.rb
newrelic_rpm-3.9.1.236 test/multiverse/suites/agent_only/testing_app.rb