traceview 3.3.3-java → 3.4.0-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/.travis.yml +18 -18
 - data/CHANGELOG.md +13 -0
 - data/README.md +3 -1
 - data/Rakefile +18 -9
 - data/gemfiles/delayed_job.gemfile +38 -0
 - data/gemfiles/frameworks.gemfile +1 -2
 - data/gemfiles/libraries.gemfile +1 -2
 - data/gemfiles/rails23.gemfile +1 -2
 - data/gemfiles/rails30.gemfile +4 -2
 - data/gemfiles/rails31.gemfile +4 -2
 - data/gemfiles/rails32.gemfile +4 -2
 - data/gemfiles/rails40.gemfile +4 -2
 - data/gemfiles/rails41.gemfile +4 -2
 - data/gemfiles/rails42.gemfile +4 -2
 - data/lib/traceview/api/layerinit.rb +3 -5
 - data/lib/traceview/api/logging.rb +63 -50
 - data/lib/traceview/api/memcache.rb +10 -9
 - data/lib/traceview/api/profiling.rb +6 -7
 - data/lib/traceview/api/util.rb +1 -1
 - data/lib/traceview/base.rb +21 -7
 - data/lib/traceview/config.rb +8 -4
 - data/lib/traceview/frameworks/padrino.rb +2 -2
 - data/lib/traceview/frameworks/rails/inst/action_controller.rb +3 -3
 - data/lib/traceview/frameworks/rails/inst/action_view.rb +4 -2
 - data/lib/traceview/frameworks/rails/inst/action_view_2x.rb +4 -2
 - data/lib/traceview/frameworks/rails/inst/action_view_30.rb +4 -2
 - data/lib/traceview/frameworks/rails/inst/connection_adapters/utils.rb +3 -3
 - data/lib/traceview/frameworks/rails.rb +26 -32
 - data/lib/traceview/frameworks/sinatra/templates.rb +1 -1
 - data/lib/traceview/frameworks/sinatra.rb +1 -1
 - data/lib/traceview/inst/dalli.rb +4 -5
 - data/lib/traceview/inst/delayed_job.rb +92 -0
 - data/lib/traceview/inst/em-http-request.rb +3 -0
 - data/lib/traceview/inst/excon.rb +3 -3
 - data/lib/traceview/inst/faraday.rb +4 -1
 - data/lib/traceview/inst/mongo.rb +10 -5
 - data/lib/traceview/inst/moped.rb +4 -4
 - data/lib/traceview/inst/redis.rb +5 -7
 - data/lib/traceview/inst/resque.rb +3 -3
 - data/lib/traceview/inst/rest-client.rb +2 -2
 - data/lib/traceview/inst/sidekiq-client.rb +3 -0
 - data/lib/traceview/inst/sidekiq-worker.rb +3 -0
 - data/lib/traceview/inst/twitter-cassandra.rb +8 -4
 - data/lib/traceview/test.rb +30 -1
 - data/lib/traceview/util.rb +7 -0
 - data/lib/traceview/version.rb +2 -2
 - data/test/frameworks/rails3x_test.rb +12 -2
 - data/test/frameworks/rails4x_test.rb +12 -2
 - data/test/instrumentation/curb_test.rb +2 -2
 - data/test/instrumentation/dalli_test.rb +121 -118
 - data/test/instrumentation/httpclient_test.rb +0 -1
 - data/test/jobs/delayed_job/db_worker_job.rb +29 -0
 - data/test/jobs/delayed_job/error_worker_job.rb +10 -0
 - data/test/jobs/delayed_job/remote_call_worker_job.rb +20 -0
 - data/test/minitest_helper.rb +8 -3
 - data/test/models/widget.rb +19 -0
 - data/test/queues/delayed_job-client_test.rb +95 -0
 - data/test/queues/delayed_job-worker_test.rb +91 -0
 - data/test/servers/delayed_job.rb +102 -0
 - data/test/servers/rails3x_8140.rb +17 -1
 - data/test/servers/rails4x_8140.rb +18 -1
 - data/test/support/auto_tracing.rb +40 -0
 - data/test/support/config_test.rb +5 -1
 - data/traceview.gemspec +1 -0
 - metadata +34 -6
 - data/test/instrumentation/delayed_job-client_test.rb +0 -128
 - data/test/instrumentation/delayed_job-worker_test.rb +0 -177
 
| 
         @@ -32,11 +32,10 @@ module TraceView 
     | 
|
| 
       32 
32 
     | 
    
         
             
                          report_kvs[:Args] = kv_args
         
     | 
| 
       33 
33 
     | 
    
         
             
                        end
         
     | 
| 
       34 
34 
     | 
    
         
             
                      end
         
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
35 
     | 
    
         
             
                      report_kvs[:Backtrace] = TraceView::API.backtrace if TraceView::Config[:resqueclient][:collect_backtraces]
         
     | 
| 
       37 
36 
     | 
    
         
             
                      report_kvs[:Queue] = klass.instance_variable_get(:@queue)
         
     | 
| 
       38 
37 
     | 
    
         
             
                    rescue => e
         
     | 
| 
       39 
     | 
    
         
            -
                      TraceView.logger.debug "[traceview/ 
     | 
| 
      
 38 
     | 
    
         
            +
                      TraceView.logger.debug "[traceview/debug] #{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" if TraceView::Config[:verbose]
         
     | 
| 
       40 
39 
     | 
    
         
             
                    end
         
     | 
| 
       41 
40 
     | 
    
         | 
| 
       42 
41 
     | 
    
         
             
                    report_kvs
         
     | 
| 
         @@ -114,7 +113,8 @@ module TraceView 
     | 
|
| 
       114 
113 
     | 
    
         
             
                      end
         
     | 
| 
       115 
114 
     | 
    
         | 
| 
       116 
115 
     | 
    
         
             
                      report_kvs[:Backtrace] = TraceView::API.backtrace if TraceView::Config[:resqueworker][:collect_backtraces]
         
     | 
| 
       117 
     | 
    
         
            -
                    rescue
         
     | 
| 
      
 116 
     | 
    
         
            +
                    rescue => e
         
     | 
| 
      
 117 
     | 
    
         
            +
                      TraceView.logger.debug "[traceview/debug] #{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" if TraceView::Config[:verbose]
         
     | 
| 
       118 
118 
     | 
    
         
             
                    end
         
     | 
| 
       119 
119 
     | 
    
         | 
| 
       120 
120 
     | 
    
         
             
                    TraceView::API.start_trace('resque-worker', nil, report_kvs) do
         
     | 
| 
         @@ -16,7 +16,7 @@ module TraceView 
     | 
|
| 
       16 
16 
     | 
    
         
             
                  def execute_with_traceview & block
         
     | 
| 
       17 
17 
     | 
    
         
             
                    kvs = {}
         
     | 
| 
       18 
18 
     | 
    
         
             
                    kvs['Backtrace'] = TraceView::API.backtrace if TraceView::Config[:rest_client][:collect_backtraces]
         
     | 
| 
       19 
     | 
    
         
            -
                    TraceView::API.log_entry( 
     | 
| 
      
 19 
     | 
    
         
            +
                    TraceView::API.log_entry('rest-client', kvs)
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
21 
     | 
    
         
             
                    # The core rest-client call
         
     | 
| 
       22 
22 
     | 
    
         
             
                    execute_without_traceview(&block)
         
     | 
| 
         @@ -24,7 +24,7 @@ module TraceView 
     | 
|
| 
       24 
24 
     | 
    
         
             
                    TraceView::API.log_exception('rest-client', e)
         
     | 
| 
       25 
25 
     | 
    
         
             
                    raise e
         
     | 
| 
       26 
26 
     | 
    
         
             
                  ensure
         
     | 
| 
       27 
     | 
    
         
            -
                    TraceView::API.log_exit( 
     | 
| 
      
 27 
     | 
    
         
            +
                    TraceView::API.log_exit('rest-client')
         
     | 
| 
       28 
28 
     | 
    
         
             
                  end
         
     | 
| 
       29 
29 
     | 
    
         
             
                end
         
     | 
| 
       30 
30 
     | 
    
         
             
              end
         
     | 
| 
         @@ -36,7 +36,8 @@ module TraceView 
     | 
|
| 
       36 
36 
     | 
    
         
             
                          end
         
     | 
| 
       37 
37 
     | 
    
         
             
                        end
         
     | 
| 
       38 
38 
     | 
    
         
             
                      end
         
     | 
| 
       39 
     | 
    
         
            -
                    rescue
         
     | 
| 
      
 39 
     | 
    
         
            +
                    rescue => e
         
     | 
| 
      
 40 
     | 
    
         
            +
                      TraceView.logger.debug "[traceview/debug] #{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" if TraceView::Config[:verbose]
         
     | 
| 
       40 
41 
     | 
    
         
             
                    end
         
     | 
| 
       41 
42 
     | 
    
         | 
| 
       42 
43 
     | 
    
         
             
                    report_kvs
         
     | 
| 
         @@ -178,7 +179,8 @@ module TraceView 
     | 
|
| 
       178 
179 
     | 
    
         
             
                      report_kvs[:Keyspace] = keyspace.to_s
         
     | 
| 
       179 
180 
     | 
    
         
             
                      report_kvs[:Column_name] = column_name.to_s
         
     | 
| 
       180 
181 
     | 
    
         
             
                      report_kvs[:Validation_class] = validation_class.to_s
         
     | 
| 
       181 
     | 
    
         
            -
                    rescue
         
     | 
| 
      
 182 
     | 
    
         
            +
                    rescue => e
         
     | 
| 
      
 183 
     | 
    
         
            +
                      TraceView.logger.debug "[traceview/debug] #{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" if TraceView::Config[:verbose]
         
     | 
| 
       182 
184 
     | 
    
         
             
                    end
         
     | 
| 
       183 
185 
     | 
    
         | 
| 
       184 
186 
     | 
    
         
             
                    TraceView::API.trace('cassandra', report_kvs) do
         
     | 
| 
         @@ -193,7 +195,8 @@ module TraceView 
     | 
|
| 
       193 
195 
     | 
    
         
             
                    begin
         
     | 
| 
       194 
196 
     | 
    
         
             
                      report_kvs[:Keyspace] = keyspace.to_s
         
     | 
| 
       195 
197 
     | 
    
         
             
                      report_kvs[:Column_name] = column_name.to_s
         
     | 
| 
       196 
     | 
    
         
            -
                    rescue
         
     | 
| 
      
 198 
     | 
    
         
            +
                    rescue => e
         
     | 
| 
      
 199 
     | 
    
         
            +
                      TraceView.logger.debug "[traceview/debug] #{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" if TraceView::Config[:verbose]
         
     | 
| 
       197 
200 
     | 
    
         
             
                    end
         
     | 
| 
       198 
201 
     | 
    
         | 
| 
       199 
202 
     | 
    
         
             
                    TraceView::API.trace('cassandra', report_kvs) do
         
     | 
| 
         @@ -207,7 +210,8 @@ module TraceView 
     | 
|
| 
       207 
210 
     | 
    
         
             
                    report_kvs = extract_trace_details(:add_column_family, nil, nil, nil)
         
     | 
| 
       208 
211 
     | 
    
         
             
                    begin
         
     | 
| 
       209 
212 
     | 
    
         
             
                      report_kvs[:Cf] = cf_def[:name] if cf_def.is_a?(Hash) && cf_def.key?(:name)
         
     | 
| 
       210 
     | 
    
         
            -
                    rescue
         
     | 
| 
      
 213 
     | 
    
         
            +
                    rescue => e
         
     | 
| 
      
 214 
     | 
    
         
            +
                      TraceView.logger.debug "[traceview/debug] #{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" if TraceView::Config[:verbose]
         
     | 
| 
       211 
215 
     | 
    
         
             
                    end
         
     | 
| 
       212 
216 
     | 
    
         | 
| 
       213 
217 
     | 
    
         
             
                    TraceView::API.trace('cassandra', report_kvs) do
         
     | 
    
        data/lib/traceview/test.rb
    CHANGED
    
    | 
         @@ -4,9 +4,15 @@ 
     | 
|
| 
       4 
4 
     | 
    
         
             
            module TraceView
         
     | 
| 
       5 
5 
     | 
    
         
             
              module Test
         
     | 
| 
       6 
6 
     | 
    
         
             
                class << self
         
     | 
| 
      
 7 
     | 
    
         
            +
                  ##
         
     | 
| 
      
 8 
     | 
    
         
            +
                  # load_extras
         
     | 
| 
      
 9 
     | 
    
         
            +
                  #
         
     | 
| 
      
 10 
     | 
    
         
            +
                  # This method simply loads all the extras needed to run
         
     | 
| 
      
 11 
     | 
    
         
            +
                  # tests such as models, jobs etc...
         
     | 
| 
      
 12 
     | 
    
         
            +
                  #
         
     | 
| 
       7 
13 
     | 
    
         
             
                  def load_extras
         
     | 
| 
       8 
14 
     | 
    
         
             
                    # If we're using the libraries gemfile (with sidekiq and resque)
         
     | 
| 
       9 
     | 
    
         
            -
                    if  
     | 
| 
      
 15 
     | 
    
         
            +
                    if TV::Test.gemfile?(:libraries)
         
     | 
| 
       10 
16 
     | 
    
         
             
                      # Load all of the test workers
         
     | 
| 
       11 
17 
     | 
    
         
             
                      pattern = File.join(File.dirname(__FILE__), '../../test/jobs/**/', '*.rb')
         
     | 
| 
       12 
18 
     | 
    
         
             
                      Dir.glob(pattern) do |f|
         
     | 
| 
         @@ -15,6 +21,29 @@ module TraceView 
     | 
|
| 
       15 
21 
     | 
    
         
             
                      end
         
     | 
| 
       16 
22 
     | 
    
         
             
                    end
         
     | 
| 
       17 
23 
     | 
    
         
             
                  end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                  ##
         
     | 
| 
      
 26 
     | 
    
         
            +
                  # gemfile?
         
     | 
| 
      
 27 
     | 
    
         
            +
                  #
         
     | 
| 
      
 28 
     | 
    
         
            +
                  # Method used to determine under which gemfile we're running.
         
     | 
| 
      
 29 
     | 
    
         
            +
                  # Pass <tt>name</tt> as the gemfile name only (without the
         
     | 
| 
      
 30 
     | 
    
         
            +
                  # .gemfile extension)
         
     | 
| 
      
 31 
     | 
    
         
            +
                  #
         
     | 
| 
      
 32 
     | 
    
         
            +
                  # returns true or fase depending on result
         
     | 
| 
      
 33 
     | 
    
         
            +
                  #
         
     | 
| 
      
 34 
     | 
    
         
            +
                  def gemfile?(name)
         
     | 
| 
      
 35 
     | 
    
         
            +
                    File.basename(ENV['BUNDLE_GEMFILE']) == (name.to_s + '.gemfile')
         
     | 
| 
      
 36 
     | 
    
         
            +
                  end
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
                  ##
         
     | 
| 
      
 39 
     | 
    
         
            +
                  # gemfile
         
     | 
| 
      
 40 
     | 
    
         
            +
                  #
         
     | 
| 
      
 41 
     | 
    
         
            +
                  # Used to determine under which gemfile we are running.  This
         
     | 
| 
      
 42 
     | 
    
         
            +
                  # method will return the name of the active gemfile
         
     | 
| 
      
 43 
     | 
    
         
            +
                  #
         
     | 
| 
      
 44 
     | 
    
         
            +
                  def gemfile
         
     | 
| 
      
 45 
     | 
    
         
            +
                    File.basename(ENV['BUNDLE_GEMFILE']).split('.').first
         
     | 
| 
      
 46 
     | 
    
         
            +
                  end
         
     | 
| 
       18 
47 
     | 
    
         
             
                end
         
     | 
| 
       19 
48 
     | 
    
         
             
              end
         
     | 
| 
       20 
49 
     | 
    
         
             
            end
         
     | 
    
        data/lib/traceview/util.rb
    CHANGED
    
    | 
         @@ -218,6 +218,13 @@ module TraceView 
     | 
|
| 
       218 
218 
     | 
    
         
             
                      platform_info['Ruby.Sidekiq.Version']    = "Sidekiq-#{::Sidekiq::VERSION}"       if defined?(::Sidekiq::VERSION)
         
     | 
| 
       219 
219 
     | 
    
         
             
                      platform_info['Ruby.Typhoeus.Version']   = "Typhoeus-#{::Typhoeus::VERSION}"     if defined?(::Typhoeus::VERSION)
         
     | 
| 
       220 
220 
     | 
    
         | 
| 
      
 221 
     | 
    
         
            +
                      if Gem.loaded_specs.key?('delayed_job')
         
     | 
| 
      
 222 
     | 
    
         
            +
                        # Oddly, DelayedJob doesn't have an embedded version number so we get it from the loaded
         
     | 
| 
      
 223 
     | 
    
         
            +
                        # gem specs.
         
     | 
| 
      
 224 
     | 
    
         
            +
                        version = Gem.loaded_specs['delayed_job'].version.to_s
         
     | 
| 
      
 225 
     | 
    
         
            +
                        platform_info['Ruby.DelayedJob.Version']       = "DelayedJob-#{version}"
         
     | 
| 
      
 226 
     | 
    
         
            +
                      end
         
     | 
| 
      
 227 
     | 
    
         
            +
             
     | 
| 
       221 
228 
     | 
    
         
             
                      # Special case since the Mongo 1.x driver doesn't embed the version number in the gem directly
         
     | 
| 
       222 
229 
     | 
    
         
             
                      if ::Gem.loaded_specs.key?('mongo')
         
     | 
| 
       223 
230 
     | 
    
         
             
                        platform_info['Ruby.Mongo.Version']     = "Mongo-#{::Gem.loaded_specs['mongo'].version}"
         
     | 
    
        data/lib/traceview/version.rb
    CHANGED
    
    
| 
         @@ -18,7 +18,12 @@ if defined?(::Rails) 
     | 
|
| 
       18 
18 
     | 
    
         
             
                  traces = get_all_traces
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
20 
     | 
    
         
             
                  traces.count.must_equal 8
         
     | 
| 
       21 
     | 
    
         
            -
                   
     | 
| 
      
 21 
     | 
    
         
            +
                  unless defined?(JRUBY_VERSION)
         
     | 
| 
      
 22 
     | 
    
         
            +
                    # We don't test this under JRuby because the Java instrumentation
         
     | 
| 
      
 23 
     | 
    
         
            +
                    # for the DB drivers doesn't use our test reporter hence we won't
         
     | 
| 
      
 24 
     | 
    
         
            +
                    # see all trace events. :-(  To be improved.
         
     | 
| 
      
 25 
     | 
    
         
            +
                    valid_edges?(traces).must_equal true
         
     | 
| 
      
 26 
     | 
    
         
            +
                  end
         
     | 
| 
       22 
27 
     | 
    
         
             
                  validate_outer_layers(traces, 'rack')
         
     | 
| 
       23 
28 
     | 
    
         | 
| 
       24 
29 
     | 
    
         
             
                  traces[0]['Layer'].must_equal "rack"
         
     | 
| 
         @@ -60,7 +65,12 @@ if defined?(::Rails) 
     | 
|
| 
       60 
65 
     | 
    
         
             
                  traces = get_all_traces
         
     | 
| 
       61 
66 
     | 
    
         | 
| 
       62 
67 
     | 
    
         
             
                  traces.count.must_equal 5
         
     | 
| 
       63 
     | 
    
         
            -
                   
     | 
| 
      
 68 
     | 
    
         
            +
                  unless defined?(JRUBY_VERSION)
         
     | 
| 
      
 69 
     | 
    
         
            +
                    # We don't test this under JRuby because the Java instrumentation
         
     | 
| 
      
 70 
     | 
    
         
            +
                    # for the DB drivers doesn't use our test reporter hence we won't
         
     | 
| 
      
 71 
     | 
    
         
            +
                    # see all trace events. :-(  To be improved.
         
     | 
| 
      
 72 
     | 
    
         
            +
                    valid_edges?(traces).must_equal true
         
     | 
| 
      
 73 
     | 
    
         
            +
                  end
         
     | 
| 
       64 
74 
     | 
    
         
             
                  validate_outer_layers(traces, 'rack')
         
     | 
| 
       65 
75 
     | 
    
         | 
| 
       66 
76 
     | 
    
         
             
                  traces[0]['Layer'].must_equal "rack"
         
     | 
| 
         @@ -18,7 +18,12 @@ if defined?(::Rails) 
     | 
|
| 
       18 
18 
     | 
    
         
             
                  traces = get_all_traces
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
20 
     | 
    
         
             
                  traces.count.must_equal 7
         
     | 
| 
       21 
     | 
    
         
            -
                   
     | 
| 
      
 21 
     | 
    
         
            +
                  unless defined?(JRUBY_VERSION)
         
     | 
| 
      
 22 
     | 
    
         
            +
                    # We don't test this under JRuby because the Java instrumentation
         
     | 
| 
      
 23 
     | 
    
         
            +
                    # for the DB drivers doesn't use our test reporter hence we won't
         
     | 
| 
      
 24 
     | 
    
         
            +
                    # see all trace events. :-(  To be improved.
         
     | 
| 
      
 25 
     | 
    
         
            +
                    valid_edges?(traces).must_equal true
         
     | 
| 
      
 26 
     | 
    
         
            +
                  end
         
     | 
| 
       22 
27 
     | 
    
         
             
                  validate_outer_layers(traces, 'rack')
         
     | 
| 
       23 
28 
     | 
    
         | 
| 
       24 
29 
     | 
    
         
             
                  traces[0]['Layer'].must_equal "rack"
         
     | 
| 
         @@ -58,7 +63,12 @@ if defined?(::Rails) 
     | 
|
| 
       58 
63 
     | 
    
         
             
                  traces = get_all_traces
         
     | 
| 
       59 
64 
     | 
    
         | 
| 
       60 
65 
     | 
    
         
             
                  traces.count.must_equal 5
         
     | 
| 
       61 
     | 
    
         
            -
                   
     | 
| 
      
 66 
     | 
    
         
            +
                  unless defined?(JRUBY_VERSION)
         
     | 
| 
      
 67 
     | 
    
         
            +
                    # We don't test this under JRuby because the Java instrumentation
         
     | 
| 
      
 68 
     | 
    
         
            +
                    # for the DB drivers doesn't use our test reporter hence we won't
         
     | 
| 
      
 69 
     | 
    
         
            +
                    # see all trace events. :-(  To be improved.
         
     | 
| 
      
 70 
     | 
    
         
            +
                    valid_edges?(traces).must_equal true
         
     | 
| 
      
 71 
     | 
    
         
            +
                  end
         
     | 
| 
       62 
72 
     | 
    
         
             
                  validate_outer_layers(traces, 'rack')
         
     | 
| 
       63 
73 
     | 
    
         | 
| 
       64 
74 
     | 
    
         
             
                  traces[0]['Layer'].must_equal "rack"
         
     | 
| 
         @@ -283,7 +283,7 @@ if RUBY_VERSION > '1.8.7' && !defined?(JRUBY_VERSION) 
     | 
|
| 
       283 
283 
     | 
    
         
             
                  assert_equal 'entry',                   traces[1]['Label']
         
     | 
| 
       284 
284 
     | 
    
         
             
                  assert_equal 1,                         traces[1]['IsService']
         
     | 
| 
       285 
285 
     | 
    
         
             
                  assert_equal 'GET',                     traces[1]['HTTPMethod'], "HTTP Method"
         
     | 
| 
       286 
     | 
    
         
            -
                  assert_equal "http://127.0.0.1:8101/?curb_cross_host=1 
     | 
| 
      
 286 
     | 
    
         
            +
                  assert_equal "http://127.0.0.1:8101/?curb_cross_host=1",  traces[1]['RemoteURL']
         
     | 
| 
       287 
287 
     | 
    
         
             
                  assert       traces[1].key?('Backtrace')
         
     | 
| 
       288 
288 
     | 
    
         | 
| 
       289 
289 
     | 
    
         
             
                  assert_equal 'curb',                    traces[5]['Layer']
         
     | 
| 
         @@ -466,7 +466,7 @@ if RUBY_VERSION > '1.8.7' && !defined?(JRUBY_VERSION) 
     | 
|
| 
       466 
466 
     | 
    
         | 
| 
       467 
467 
     | 
    
         
             
                  traces = get_all_traces
         
     | 
| 
       468 
468 
     | 
    
         
             
                  assert_equal 7, traces.count, "Trace count"
         
     | 
| 
       469 
     | 
    
         
            -
                  assert_equal "http://127.0.0.1:8101/?blah=1 
     | 
| 
      
 469 
     | 
    
         
            +
                  assert_equal "http://127.0.0.1:8101/?blah=1", traces[1]['RemoteURL']
         
     | 
| 
       470 
470 
     | 
    
         
             
                end
         
     | 
| 
       471 
471 
     | 
    
         | 
| 
       472 
472 
     | 
    
         
             
                def test_without_tracing_class_get
         
     | 
| 
         @@ -1,174 +1,177 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # Copyright (c) 2015 AppNeta, Inc.
         
     | 
| 
       2 
2 
     | 
    
         
             
            # All rights reserved.
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
      
 4 
     | 
    
         
            +
            if RUBY_VERSION > '1.8.7'
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
              before do
         
     | 
| 
       8 
     | 
    
         
            -
                clear_all_traces
         
     | 
| 
       9 
     | 
    
         
            -
                @dc = Dalli::Client.new
         
     | 
| 
       10 
     | 
    
         
            -
                @collect_backtraces = TraceView::Config[:dalli][:collect_backtraces]
         
     | 
| 
       11 
     | 
    
         
            -
              end
         
     | 
| 
      
 6 
     | 
    
         
            +
              require 'minitest_helper'
         
     | 
| 
       12 
7 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
               
     | 
| 
       14 
     | 
    
         
            -
                 
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
      
 8 
     | 
    
         
            +
              describe "Dalli" do
         
     | 
| 
      
 9 
     | 
    
         
            +
                before do
         
     | 
| 
      
 10 
     | 
    
         
            +
                  clear_all_traces
         
     | 
| 
      
 11 
     | 
    
         
            +
                  @dc = Dalli::Client.new
         
     | 
| 
      
 12 
     | 
    
         
            +
                  @collect_backtraces = TraceView::Config[:dalli][:collect_backtraces]
         
     | 
| 
      
 13 
     | 
    
         
            +
                end
         
     | 
| 
       16 
14 
     | 
    
         | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
                 
     | 
| 
       20 
     | 
    
         
            -
              end
         
     | 
| 
      
 15 
     | 
    
         
            +
                after do
         
     | 
| 
      
 16 
     | 
    
         
            +
                  TraceView::Config[:dalli][:collect_backtraces] = @collect_backtraces
         
     | 
| 
      
 17 
     | 
    
         
            +
                end
         
     | 
| 
       21 
18 
     | 
    
         | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
                  ::Dalli::Client 
     | 
| 
      
 19 
     | 
    
         
            +
                it 'Stock Dalli should be loaded, defined and ready' do
         
     | 
| 
      
 20 
     | 
    
         
            +
                  defined?(::Dalli).wont_match nil
         
     | 
| 
      
 21 
     | 
    
         
            +
                  defined?(::Dalli::Client).wont_match nil
         
     | 
| 
       25 
22 
     | 
    
         
             
                end
         
     | 
| 
       26 
     | 
    
         
            -
              end
         
     | 
| 
       27 
23 
     | 
    
         | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
      
 24 
     | 
    
         
            +
                it 'should have traceview methods defined' do
         
     | 
| 
      
 25 
     | 
    
         
            +
                  [ :perform_with_traceview, :get_multi_with_traceview].each do |m|
         
     | 
| 
      
 26 
     | 
    
         
            +
                    ::Dalli::Client.method_defined?(m).must_equal true
         
     | 
| 
      
 27 
     | 
    
         
            +
                  end
         
     | 
| 
       31 
28 
     | 
    
         
             
                end
         
     | 
| 
       32 
29 
     | 
    
         | 
| 
       33 
     | 
    
         
            -
                 
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
      
 30 
     | 
    
         
            +
                it 'should trace set' do
         
     | 
| 
      
 31 
     | 
    
         
            +
                  TraceView::API.start_trace('dalli_test', '', {}) do
         
     | 
| 
      
 32 
     | 
    
         
            +
                    @dc.set('some_key', 1234)
         
     | 
| 
      
 33 
     | 
    
         
            +
                  end
         
     | 
| 
       35 
34 
     | 
    
         | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
      
 35 
     | 
    
         
            +
                  traces = get_all_traces
         
     | 
| 
      
 36 
     | 
    
         
            +
                  traces.count.must_equal 4
         
     | 
| 
       37 
37 
     | 
    
         | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
                traces[1].has_key?("KVKey").must_equal true
         
     | 
| 
       40 
     | 
    
         
            -
                traces[1]['Layer'].must_equal "memcache"
         
     | 
| 
       41 
     | 
    
         
            -
                traces[1]['KVKey'].must_equal "some_key"
         
     | 
| 
       42 
     | 
    
         
            -
                traces[1]['RemoteHost'].must_equal "127.0.0.1:11211"
         
     | 
| 
       43 
     | 
    
         
            -
              end
         
     | 
| 
      
 38 
     | 
    
         
            +
                  validate_outer_layers(traces, 'dalli_test')
         
     | 
| 
       44 
39 
     | 
    
         | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
                   
     | 
| 
      
 40 
     | 
    
         
            +
                  traces[1].has_key?("KVOp").must_equal true
         
     | 
| 
      
 41 
     | 
    
         
            +
                  traces[1].has_key?("KVKey").must_equal true
         
     | 
| 
      
 42 
     | 
    
         
            +
                  traces[1]['Layer'].must_equal "memcache"
         
     | 
| 
      
 43 
     | 
    
         
            +
                  traces[1]['KVKey'].must_equal "some_key"
         
     | 
| 
      
 44 
     | 
    
         
            +
                  traces[1]['RemoteHost'].must_equal "127.0.0.1:11211"
         
     | 
| 
       48 
45 
     | 
    
         
             
                end
         
     | 
| 
       49 
46 
     | 
    
         | 
| 
       50 
     | 
    
         
            -
                 
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
      
 47 
     | 
    
         
            +
                it 'should trace get' do
         
     | 
| 
      
 48 
     | 
    
         
            +
                  TraceView::API.start_trace('dalli_test', '', {}) do
         
     | 
| 
      
 49 
     | 
    
         
            +
                    @dc.get('some_key')
         
     | 
| 
      
 50 
     | 
    
         
            +
                  end
         
     | 
| 
       52 
51 
     | 
    
         | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
      
 52 
     | 
    
         
            +
                  traces = get_all_traces
         
     | 
| 
      
 53 
     | 
    
         
            +
                  traces.count.must_equal 5
         
     | 
| 
       54 
54 
     | 
    
         | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
                traces[1]['KVKey'].must_equal "some_key"
         
     | 
| 
       57 
     | 
    
         
            -
                traces[1]['RemoteHost'].must_equal "127.0.0.1:11211"
         
     | 
| 
       58 
     | 
    
         
            -
                traces[2]['Label'].must_equal "info"
         
     | 
| 
       59 
     | 
    
         
            -
                traces[2].has_key?('KVHit').must_equal true
         
     | 
| 
       60 
     | 
    
         
            -
                traces[3]['Label'].must_equal "exit"
         
     | 
| 
       61 
     | 
    
         
            -
              end
         
     | 
| 
      
 55 
     | 
    
         
            +
                  validate_outer_layers(traces, 'dalli_test')
         
     | 
| 
       62 
56 
     | 
    
         | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
                   
     | 
| 
      
 57 
     | 
    
         
            +
                  traces[1]['KVOp'].must_equal "get"
         
     | 
| 
      
 58 
     | 
    
         
            +
                  traces[1]['KVKey'].must_equal "some_key"
         
     | 
| 
      
 59 
     | 
    
         
            +
                  traces[1]['RemoteHost'].must_equal "127.0.0.1:11211"
         
     | 
| 
      
 60 
     | 
    
         
            +
                  traces[2]['Label'].must_equal "info"
         
     | 
| 
      
 61 
     | 
    
         
            +
                  traces[2].has_key?('KVHit').must_equal true
         
     | 
| 
      
 62 
     | 
    
         
            +
                  traces[3]['Label'].must_equal "exit"
         
     | 
| 
       66 
63 
     | 
    
         
             
                end
         
     | 
| 
       67 
64 
     | 
    
         | 
| 
       68 
     | 
    
         
            -
                 
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
      
 65 
     | 
    
         
            +
                it 'should trace get_multi' do
         
     | 
| 
      
 66 
     | 
    
         
            +
                  TraceView::API.start_trace('dalli_test', '', {}) do
         
     | 
| 
      
 67 
     | 
    
         
            +
                    @dc.get_multi([:one, :two, :three, :four, :five, :six])
         
     | 
| 
      
 68 
     | 
    
         
            +
                  end
         
     | 
| 
       72 
69 
     | 
    
         | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
       75 
     | 
    
         
            -
                traces[2]['RemoteHost'].must_equal "127.0.0.1:11211"
         
     | 
| 
       76 
     | 
    
         
            -
                traces[2].has_key?('KVKeyCount').must_equal true
         
     | 
| 
       77 
     | 
    
         
            -
                traces[2].has_key?('KVHitCount').must_equal true
         
     | 
| 
       78 
     | 
    
         
            -
                traces[3]['Label'].must_equal "exit"
         
     | 
| 
       79 
     | 
    
         
            -
              end
         
     | 
| 
      
 70 
     | 
    
         
            +
                  traces = get_all_traces
         
     | 
| 
      
 71 
     | 
    
         
            +
                  traces.count.must_equal 5
         
     | 
| 
       80 
72 
     | 
    
         | 
| 
       81 
     | 
    
         
            -
             
     | 
| 
       82 
     | 
    
         
            -
                @dc.incr("dalli_key_counter", 1, nil, 0)
         
     | 
| 
      
 73 
     | 
    
         
            +
                  validate_outer_layers(traces, 'dalli_test')
         
     | 
| 
       83 
74 
     | 
    
         | 
| 
       84 
     | 
    
         
            -
             
     | 
| 
       85 
     | 
    
         
            -
                   
     | 
| 
      
 75 
     | 
    
         
            +
                  traces[1]['KVOp'].must_equal "get_multi"
         
     | 
| 
      
 76 
     | 
    
         
            +
                  traces[2]['Label'].must_equal "info"
         
     | 
| 
      
 77 
     | 
    
         
            +
                  traces[2]['RemoteHost'].must_equal "127.0.0.1:11211"
         
     | 
| 
      
 78 
     | 
    
         
            +
                  traces[2].has_key?('KVKeyCount').must_equal true
         
     | 
| 
      
 79 
     | 
    
         
            +
                  traces[2].has_key?('KVHitCount').must_equal true
         
     | 
| 
      
 80 
     | 
    
         
            +
                  traces[3]['Label'].must_equal "exit"
         
     | 
| 
       86 
81 
     | 
    
         
             
                end
         
     | 
| 
       87 
82 
     | 
    
         | 
| 
       88 
     | 
    
         
            -
                 
     | 
| 
       89 
     | 
    
         
            -
             
     | 
| 
      
 83 
     | 
    
         
            +
                it "should trace increment" do
         
     | 
| 
      
 84 
     | 
    
         
            +
                  @dc.incr("dalli_key_counter", 1, nil, 0)
         
     | 
| 
       90 
85 
     | 
    
         | 
| 
       91 
     | 
    
         
            -
             
     | 
| 
      
 86 
     | 
    
         
            +
                  TraceView::API.start_trace('dalli_test', '', {}) do
         
     | 
| 
      
 87 
     | 
    
         
            +
                    @dc.incr("dalli_key_counter")
         
     | 
| 
      
 88 
     | 
    
         
            +
                  end
         
     | 
| 
       92 
89 
     | 
    
         | 
| 
       93 
     | 
    
         
            -
             
     | 
| 
       94 
     | 
    
         
            -
             
     | 
| 
       95 
     | 
    
         
            -
                traces[1]['RemoteHost'].must_equal "127.0.0.1:11211"
         
     | 
| 
       96 
     | 
    
         
            -
                traces[2]['Label'].must_equal "exit"
         
     | 
| 
       97 
     | 
    
         
            -
              end
         
     | 
| 
      
 90 
     | 
    
         
            +
                  traces = get_all_traces
         
     | 
| 
      
 91 
     | 
    
         
            +
                  traces.count.must_equal 4
         
     | 
| 
       98 
92 
     | 
    
         | 
| 
       99 
     | 
    
         
            -
             
     | 
| 
       100 
     | 
    
         
            -
                @dc.incr("dalli_key_counter", 1, nil, 0)
         
     | 
| 
      
 93 
     | 
    
         
            +
                  validate_outer_layers(traces, 'dalli_test')
         
     | 
| 
       101 
94 
     | 
    
         | 
| 
       102 
     | 
    
         
            -
             
     | 
| 
       103 
     | 
    
         
            -
                   
     | 
| 
      
 95 
     | 
    
         
            +
                  traces[1]['KVOp'].must_equal "incr"
         
     | 
| 
      
 96 
     | 
    
         
            +
                  traces[1]['KVKey'].must_equal "dalli_key_counter"
         
     | 
| 
      
 97 
     | 
    
         
            +
                  traces[1]['RemoteHost'].must_equal "127.0.0.1:11211"
         
     | 
| 
      
 98 
     | 
    
         
            +
                  traces[2]['Label'].must_equal "exit"
         
     | 
| 
       104 
99 
     | 
    
         
             
                end
         
     | 
| 
       105 
100 
     | 
    
         | 
| 
       106 
     | 
    
         
            -
                 
     | 
| 
       107 
     | 
    
         
            -
             
     | 
| 
      
 101 
     | 
    
         
            +
                it "should trace decrement" do
         
     | 
| 
      
 102 
     | 
    
         
            +
                  @dc.incr("dalli_key_counter", 1, nil, 0)
         
     | 
| 
       108 
103 
     | 
    
         | 
| 
       109 
     | 
    
         
            -
             
     | 
| 
      
 104 
     | 
    
         
            +
                  TraceView::API.start_trace('dalli_test', '', {}) do
         
     | 
| 
      
 105 
     | 
    
         
            +
                    @dc.decr("dalli_key_counter")
         
     | 
| 
      
 106 
     | 
    
         
            +
                  end
         
     | 
| 
       110 
107 
     | 
    
         | 
| 
       111 
     | 
    
         
            -
             
     | 
| 
       112 
     | 
    
         
            -
             
     | 
| 
       113 
     | 
    
         
            -
                traces[1]['RemoteHost'].must_equal "127.0.0.1:11211"
         
     | 
| 
       114 
     | 
    
         
            -
                traces[2]['Label'].must_equal "exit"
         
     | 
| 
       115 
     | 
    
         
            -
              end
         
     | 
| 
      
 108 
     | 
    
         
            +
                  traces = get_all_traces
         
     | 
| 
      
 109 
     | 
    
         
            +
                  traces.count.must_equal 4
         
     | 
| 
       116 
110 
     | 
    
         | 
| 
       117 
     | 
    
         
            -
             
     | 
| 
       118 
     | 
    
         
            -
                @dc.set('some_key', 1)
         
     | 
| 
      
 111 
     | 
    
         
            +
                  validate_outer_layers(traces, 'dalli_test')
         
     | 
| 
       119 
112 
     | 
    
         | 
| 
       120 
     | 
    
         
            -
             
     | 
| 
       121 
     | 
    
         
            -
                   
     | 
| 
      
 113 
     | 
    
         
            +
                  traces[1]['KVOp'].must_equal "decr"
         
     | 
| 
      
 114 
     | 
    
         
            +
                  traces[1]['KVKey'].must_equal "dalli_key_counter"
         
     | 
| 
      
 115 
     | 
    
         
            +
                  traces[1]['RemoteHost'].must_equal "127.0.0.1:11211"
         
     | 
| 
      
 116 
     | 
    
         
            +
                  traces[2]['Label'].must_equal "exit"
         
     | 
| 
       122 
117 
     | 
    
         
             
                end
         
     | 
| 
       123 
118 
     | 
    
         | 
| 
       124 
     | 
    
         
            -
                 
     | 
| 
       125 
     | 
    
         
            -
             
     | 
| 
      
 119 
     | 
    
         
            +
                it "should trace replace" do
         
     | 
| 
      
 120 
     | 
    
         
            +
                  @dc.set('some_key', 1)
         
     | 
| 
       126 
121 
     | 
    
         | 
| 
       127 
     | 
    
         
            -
             
     | 
| 
      
 122 
     | 
    
         
            +
                  TraceView::API.start_trace('dalli_test', '', {}) do
         
     | 
| 
      
 123 
     | 
    
         
            +
                    @dc.replace("some_key", "woop")
         
     | 
| 
      
 124 
     | 
    
         
            +
                  end
         
     | 
| 
       128 
125 
     | 
    
         | 
| 
       129 
     | 
    
         
            -
             
     | 
| 
       130 
     | 
    
         
            -
             
     | 
| 
       131 
     | 
    
         
            -
                traces[1]['RemoteHost'].must_equal "127.0.0.1:11211"
         
     | 
| 
       132 
     | 
    
         
            -
                traces[2]['Label'].must_equal "exit"
         
     | 
| 
       133 
     | 
    
         
            -
              end
         
     | 
| 
      
 126 
     | 
    
         
            +
                  traces = get_all_traces
         
     | 
| 
      
 127 
     | 
    
         
            +
                  traces.count.must_equal 4
         
     | 
| 
       134 
128 
     | 
    
         | 
| 
       135 
     | 
    
         
            -
             
     | 
| 
       136 
     | 
    
         
            -
                @dc.set('some_key', 1)
         
     | 
| 
      
 129 
     | 
    
         
            +
                  validate_outer_layers(traces, 'dalli_test')
         
     | 
| 
       137 
130 
     | 
    
         | 
| 
       138 
     | 
    
         
            -
             
     | 
| 
       139 
     | 
    
         
            -
                   
     | 
| 
      
 131 
     | 
    
         
            +
                  traces[1]['KVOp'].must_equal "replace"
         
     | 
| 
      
 132 
     | 
    
         
            +
                  traces[1]['KVKey'].must_equal "some_key"
         
     | 
| 
      
 133 
     | 
    
         
            +
                  traces[1]['RemoteHost'].must_equal "127.0.0.1:11211"
         
     | 
| 
      
 134 
     | 
    
         
            +
                  traces[2]['Label'].must_equal "exit"
         
     | 
| 
       140 
135 
     | 
    
         
             
                end
         
     | 
| 
       141 
136 
     | 
    
         | 
| 
       142 
     | 
    
         
            -
                 
     | 
| 
       143 
     | 
    
         
            -
             
     | 
| 
      
 137 
     | 
    
         
            +
                it "should trace delete" do
         
     | 
| 
      
 138 
     | 
    
         
            +
                  @dc.set('some_key', 1)
         
     | 
| 
       144 
139 
     | 
    
         | 
| 
       145 
     | 
    
         
            -
             
     | 
| 
      
 140 
     | 
    
         
            +
                  TraceView::API.start_trace('dalli_test', '', {}) do
         
     | 
| 
      
 141 
     | 
    
         
            +
                    @dc.delete("some_key")
         
     | 
| 
      
 142 
     | 
    
         
            +
                  end
         
     | 
| 
       146 
143 
     | 
    
         | 
| 
       147 
     | 
    
         
            -
             
     | 
| 
       148 
     | 
    
         
            -
             
     | 
| 
       149 
     | 
    
         
            -
                traces[1]['RemoteHost'].must_equal "127.0.0.1:11211"
         
     | 
| 
       150 
     | 
    
         
            -
              end
         
     | 
| 
      
 144 
     | 
    
         
            +
                  traces = get_all_traces
         
     | 
| 
      
 145 
     | 
    
         
            +
                  traces.count.must_equal 4
         
     | 
| 
       151 
146 
     | 
    
         | 
| 
       152 
     | 
    
         
            -
             
     | 
| 
       153 
     | 
    
         
            -
                @dc.set('some_key', 1)
         
     | 
| 
       154 
     | 
    
         
            -
                TraceView::Config[:dalli][:collect_backtraces] = true
         
     | 
| 
      
 147 
     | 
    
         
            +
                  validate_outer_layers(traces, 'dalli_test')
         
     | 
| 
       155 
148 
     | 
    
         | 
| 
       156 
     | 
    
         
            -
             
     | 
| 
       157 
     | 
    
         
            -
                   
     | 
| 
      
 149 
     | 
    
         
            +
                  traces[1]['KVOp'].must_equal "delete"
         
     | 
| 
      
 150 
     | 
    
         
            +
                  traces[1]['KVKey'].must_equal "some_key"
         
     | 
| 
      
 151 
     | 
    
         
            +
                  traces[1]['RemoteHost'].must_equal "127.0.0.1:11211"
         
     | 
| 
       158 
152 
     | 
    
         
             
                end
         
     | 
| 
       159 
153 
     | 
    
         | 
| 
       160 
     | 
    
         
            -
                 
     | 
| 
       161 
     | 
    
         
            -
             
     | 
| 
       162 
     | 
    
         
            -
             
     | 
| 
      
 154 
     | 
    
         
            +
                it "should obey :collect_backtraces setting when true" do
         
     | 
| 
      
 155 
     | 
    
         
            +
                  @dc.set('some_key', 1)
         
     | 
| 
      
 156 
     | 
    
         
            +
                  TraceView::Config[:dalli][:collect_backtraces] = true
         
     | 
| 
       163 
157 
     | 
    
         | 
| 
       164 
     | 
    
         
            -
             
     | 
| 
       165 
     | 
    
         
            -
             
     | 
| 
      
 158 
     | 
    
         
            +
                  TraceView::API.start_trace('dalli_test', '', {}) do
         
     | 
| 
      
 159 
     | 
    
         
            +
                    @dc.get('some_key')
         
     | 
| 
      
 160 
     | 
    
         
            +
                  end
         
     | 
| 
       166 
161 
     | 
    
         | 
| 
       167 
     | 
    
         
            -
             
     | 
| 
       168 
     | 
    
         
            -
                   
     | 
| 
      
 162 
     | 
    
         
            +
                  traces = get_all_traces
         
     | 
| 
      
 163 
     | 
    
         
            +
                  layer_has_key(traces, 'memcache', 'Backtrace')
         
     | 
| 
       169 
164 
     | 
    
         
             
                end
         
     | 
| 
       170 
165 
     | 
    
         | 
| 
       171 
     | 
    
         
            -
                 
     | 
| 
       172 
     | 
    
         
            -
             
     | 
| 
      
 166 
     | 
    
         
            +
                it "should obey :collect_backtraces setting when false" do
         
     | 
| 
      
 167 
     | 
    
         
            +
                  TraceView::Config[:dalli][:collect_backtraces] = false
         
     | 
| 
      
 168 
     | 
    
         
            +
             
     | 
| 
      
 169 
     | 
    
         
            +
                  TraceView::API.start_trace('dalli_test', '', {}) do
         
     | 
| 
      
 170 
     | 
    
         
            +
                    @dc.get('some_key')
         
     | 
| 
      
 171 
     | 
    
         
            +
                  end
         
     | 
| 
      
 172 
     | 
    
         
            +
             
     | 
| 
      
 173 
     | 
    
         
            +
                  traces = get_all_traces
         
     | 
| 
      
 174 
     | 
    
         
            +
                  layer_doesnt_have_key(traces, 'memcache', 'Backtrace')
         
     | 
| 
      
 175 
     | 
    
         
            +
                end
         
     | 
| 
       173 
176 
     | 
    
         
             
              end
         
     | 
| 
       174 
177 
     | 
    
         
             
            end
         
     | 
| 
         @@ -0,0 +1,29 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Copyright (c) 2015 AppNeta, Inc.
         
     | 
| 
      
 2 
     | 
    
         
            +
            # All rights reserved.
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            class DJDBWorkerJob
         
     | 
| 
      
 5 
     | 
    
         
            +
              @queue = :normal
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
              def self.perform(*args)
         
     | 
| 
      
 8 
     | 
    
         
            +
                return unless defined?(::Sequel) && !defined?(JRUBY_VERSION)
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                if ENV.key?('TRAVIS_MYSQL_PASS')
         
     | 
| 
      
 11 
     | 
    
         
            +
                  @db = Sequel.connect("mysql2://root:#{ENV['TRAVIS_MYSQL_PASS']}@127.0.0.1:3306/travis_ci_test")
         
     | 
| 
      
 12 
     | 
    
         
            +
                else
         
     | 
| 
      
 13 
     | 
    
         
            +
                  @db = Sequel.connect('mysql2://root@127.0.0.1:3306/travis_ci_test')
         
     | 
| 
      
 14 
     | 
    
         
            +
                end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                unless @db.table_exists?(:items)
         
     | 
| 
      
 17 
     | 
    
         
            +
                  @db.create_table :items do
         
     | 
| 
      
 18 
     | 
    
         
            +
                    primary_key :id
         
     | 
| 
      
 19 
     | 
    
         
            +
                    String :name
         
     | 
| 
      
 20 
     | 
    
         
            +
                    Float :price
         
     | 
| 
      
 21 
     | 
    
         
            +
                  end
         
     | 
| 
      
 22 
     | 
    
         
            +
                end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                @db.run('select 1')
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                items = @db[:items]
         
     | 
| 
      
 27 
     | 
    
         
            +
                items.count
         
     | 
| 
      
 28 
     | 
    
         
            +
              end
         
     | 
| 
      
 29 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,20 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Copyright (c) 2015 AppNeta, Inc.
         
     | 
| 
      
 2 
     | 
    
         
            +
            # All rights reserved.
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            class DJRemoteCallWorkerJob
         
     | 
| 
      
 5 
     | 
    
         
            +
              @queue = :critical
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
              def self.perform(*args)
         
     | 
| 
      
 8 
     | 
    
         
            +
                # Make some random Dalli (memcache) calls and top it
         
     | 
| 
      
 9 
     | 
    
         
            +
                # off with an excon call to the background rack webserver.
         
     | 
| 
      
 10 
     | 
    
         
            +
                @dc = Dalli::Client.new
         
     | 
| 
      
 11 
     | 
    
         
            +
                @dc.get(rand(10).to_s)
         
     | 
| 
      
 12 
     | 
    
         
            +
                uri = URI('http://gameface.in/gamers')
         
     | 
| 
      
 13 
     | 
    
         
            +
                http = Net::HTTP.new(uri.host, uri.port)
         
     | 
| 
      
 14 
     | 
    
         
            +
                request = Net::HTTP::Get.new(uri.request_uri)
         
     | 
| 
      
 15 
     | 
    
         
            +
                http.request(request)
         
     | 
| 
      
 16 
     | 
    
         
            +
                @dc.get(rand(10).to_s)
         
     | 
| 
      
 17 
     | 
    
         
            +
                @dc.get(rand(10).to_s)
         
     | 
| 
      
 18 
     | 
    
         
            +
                @dc.get_multi([:one, :two, :three, :four, :five, :six])
         
     | 
| 
      
 19 
     | 
    
         
            +
              end
         
     | 
| 
      
 20 
     | 
    
         
            +
            end
         
     | 
    
        data/test/minitest_helper.rb
    CHANGED
    
    | 
         @@ -49,16 +49,21 @@ TraceView.logger.level = Logger::DEBUG 
     | 
|
| 
       49 
49 
     | 
    
         
             
            # puts %x{psql -c 'create database travis_ci_test;' -U postgres}
         
     | 
| 
       50 
50 
     | 
    
         | 
| 
       51 
51 
     | 
    
         
             
            # Our background Rack-app for http client testing
         
     | 
| 
       52 
     | 
    
         
            -
            require  
     | 
| 
      
 52 
     | 
    
         
            +
            require './test/servers/rackapp_8101'
         
     | 
| 
       53 
53 
     | 
    
         | 
| 
       54 
54 
     | 
    
         
             
            # Conditionally load other background servers
         
     | 
| 
       55 
55 
     | 
    
         
             
            # depending on what we're testing
         
     | 
| 
       56 
56 
     | 
    
         
             
            #
         
     | 
| 
       57 
57 
     | 
    
         
             
            case File.basename(ENV['BUNDLE_GEMFILE'])
         
     | 
| 
      
 58 
     | 
    
         
            +
            when /delayed_job/
         
     | 
| 
      
 59 
     | 
    
         
            +
              require './test/servers/delayed_job'
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
       58 
61 
     | 
    
         
             
            when /rails4/
         
     | 
| 
       59 
     | 
    
         
            -
              require  
     | 
| 
      
 62 
     | 
    
         
            +
              require './test/servers/rails4x_8140'
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
       60 
64 
     | 
    
         
             
            when /rails3/
         
     | 
| 
       61 
     | 
    
         
            -
              require  
     | 
| 
      
 65 
     | 
    
         
            +
              require './test/servers/rails3x_8140'
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
       62 
67 
     | 
    
         
             
            when /frameworks/
         
     | 
| 
       63 
68 
     | 
    
         
             
            when /libraries/
         
     | 
| 
       64 
69 
     | 
    
         
             
              if RUBY_VERSION >= '2.0'
         
     |