traceview 3.5.1-java → 3.6.0-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ab1cb712461df5f0c69196d17b1a42ded92bb3c2
4
- data.tar.gz: 3cc286a12bbe0c66a9331ac5b04c872aeaf00370
3
+ metadata.gz: d1e61e5e33b66511ae3508da13278fe5cf48f829
4
+ data.tar.gz: faa2bb9c780e240a2e86144e58c85528880453eb
5
5
  SHA512:
6
- metadata.gz: 6aa0ff18c467aabbd4065fd29b63fe686ec8208914001cf354683360f5ab7a642d7f48cabf0d7269fff4452b48cf5cea2475155a3416c31d7940814a3a3ab378
7
- data.tar.gz: 0d8562f04dd5842b6f6ec8f79b9b2750a4658f34d2439d963d4ae4fd5718c96dfa2bd4234207b8db99c800dbc9bc24eed62e7d6d19991db713b7a37a04a5b743
6
+ metadata.gz: 73f62ced2f8262d9a5a7422580eb90a3b7a8ab10e69d8a583d31b5200757b197341b32e3fa4f952ce44f02a74a390f068282bde7c2fd5157e89c4fe92d5c28c4
7
+ data.tar.gz: 890f681de8dbd1850bd1fde6cdcd3e19d9404431c9c1c3fa3b11459dd6e63e7270622ab87ec4eea3a2ad38ce6f64e6ead36e2850b49348a8fc53027c79859601
data/CHANGELOG.md CHANGED
@@ -4,6 +4,17 @@ https://github.com/appneta/oboe-ruby/releases
4
4
 
5
5
  Dates in this file are in the format MM/DD/YYYY.
6
6
 
7
+ # traceview 3.6.0
8
+
9
+ This minor release includes the following new feature:
10
+
11
+ * New [bunny](https://github.com/ruby-amqp/bunny) (Rabbitmq) consumer instrumentation: #160
12
+
13
+ Pushed to Rubygems:
14
+
15
+ https://rubygems.org/gems/traceview/versions/3.6.0
16
+ https://rubygems.org/gems/traceview/versions/3.6.0-java
17
+
7
18
  # traceview 3.5.1
8
19
 
9
20
  This patch release includes the following fixes:
@@ -16,11 +16,12 @@ group :development, :test do
16
16
  gem 'minitest-reporters', '< 1.0.18'
17
17
  gem 'minitest-debugger', :require => false
18
18
  gem 'rack-test'
19
- gem 'puma'
20
19
  if RUBY_VERSION < '1.9.3'
21
20
  gem 'bson', '<= 1.12.3'
21
+ gem 'puma', '< 3.0'
22
22
  else
23
23
  gem 'bson', '< 4.0'
24
+ gem 'puma'
24
25
  end
25
26
  end
26
27
 
@@ -19,11 +19,12 @@ group :development, :test do
19
19
  gem 'minitest-reporters', '< 1.0.18'
20
20
  gem 'minitest-debugger', :require => false
21
21
  gem 'rack-test'
22
- gem 'puma'
23
22
  if RUBY_VERSION < '1.9.3'
24
23
  gem 'bson', '<= 1.12.3'
24
+ gem 'puma', '< 3.0'
25
25
  else
26
26
  gem 'bson', '< 4.0'
27
+ gem 'puma'
27
28
  end
28
29
  end
29
30
 
@@ -142,7 +142,7 @@ module TraceViewBase
142
142
  # DelayedJob or Sidekiq workers.
143
143
  #
144
144
  def entry_layer?(layer)
145
- %w(delayed_job-worker sidekiq-worker resque-worker).include?(layer.to_s)
145
+ %w(delayed_job-worker sidekiq-worker resque-worker rabbitmq-consumer).include?(layer.to_s)
146
146
  end
147
147
 
148
148
  ##
@@ -11,13 +11,14 @@ module TraceView
11
11
  module Config
12
12
  @@config = {}
13
13
 
14
- @@instrumentation = [:action_controller, :action_view, :active_record, :bunny,
15
- :cassandra, :curb, :dalli, :delayed_jobclient,
16
- :delayed_jobworker, :em_http_request, :excon,
17
- :faraday, :grape, :httpclient, :nethttp, :memcached,
18
- :memcache, :mongo, :moped, :rack, :redis, :resqueclient,
19
- :resqueworker, :rest_client, :sequel, :sidekiqclient,
20
- :sidekiqworker, :typhoeus]
14
+ @@instrumentation = [:action_controller, :action_view, :active_record,
15
+ :bunnyclient, :bunnyconsumer, :cassandra, :curb,
16
+ :dalli, :delayed_jobclient, :delayed_jobworker,
17
+ :em_http_request, :excon, :faraday, :grape,
18
+ :httpclient, :nethttp, :memcached,
19
+ :memcache, :mongo, :moped, :rack, :redis,
20
+ :resqueclient, :resqueworker, :rest_client,
21
+ :sequel, :sidekiqclient, :sidekiqworker, :typhoeus]
21
22
 
22
23
  # Subgrouping of instrumentation
23
24
  @@http_clients = [:curb, :excon, :em_http_request, :faraday, :httpclient, :nethttp, :rest_client, :typhoeus]
@@ -44,7 +45,8 @@ module TraceView
44
45
  # Set collect_backtraces defaults
45
46
  TraceView::Config[:action_controller][:collect_backtraces] = true
46
47
  TraceView::Config[:active_record][:collect_backtraces] = true
47
- TraceView::Config[:bunny][:collect_backtraces] = true
48
+ TraceView::Config[:bunnyclient][:collect_backtraces] = false
49
+ TraceView::Config[:bunnyconsumer][:collect_backtraces] = false
48
50
  TraceView::Config[:action_view][:collect_backtraces] = true
49
51
  TraceView::Config[:cassandra][:collect_backtraces] = true
50
52
  TraceView::Config[:curb][:collect_backtraces] = true
@@ -61,6 +63,7 @@ module TraceView
61
63
  TraceView::Config[:mongo][:collect_backtraces] = true
62
64
  TraceView::Config[:moped][:collect_backtraces] = true
63
65
  TraceView::Config[:nethttp][:collect_backtraces] = true
66
+ TraceView::Config[:rack][:collect_backtraces] = false
64
67
  TraceView::Config[:redis][:collect_backtraces] = false
65
68
  TraceView::Config[:resqueclient][:collect_backtraces] = true
66
69
  TraceView::Config[:resqueworker][:collect_backtraces] = false
@@ -147,6 +150,7 @@ module TraceView
147
150
  # <tt>rescue_from</tt> are not reported to the TraceView
148
151
  # dashboard by default. Setting this value to true will
149
152
  # report all raised exception regardless.
153
+ #
150
154
  @@config[:report_rescued_errors] = false
151
155
 
152
156
  # By default, the curb instrumentation will not link
@@ -163,8 +167,25 @@ module TraceView
163
167
  # Alternatively, if you would like to install the separate
164
168
  # libcurl instrumentation, see here:
165
169
  # http://docs.appneta.com/installing-libcurl-instrumentation
170
+ #
166
171
  @@config[:curb][:cross_host] = false
167
172
 
173
+ # The bunny (Rabbitmq) instrumentation can optionally report
174
+ # Controller and Action values to allow filtering of bunny
175
+ # message handling in # the UI. Use of Controller and Action
176
+ # for filters is temporary until the UI is updated with
177
+ # additional filters.
178
+ #
179
+ # These values identify which properties of
180
+ # Bunny::MessageProperties to report as Controller
181
+ # and Action. The defaults are to report :app_id (as
182
+ # Controller) and :type (as Action). If these values
183
+ # are not specified in the publish, then nothing
184
+ # will be reported here.
185
+ #
186
+ @@config[:bunnyconsumer][:controller] = :app_id
187
+ @@config[:bunnyconsumer][:action] = :type
188
+
168
189
  # Environment support for OpenShift.
169
190
  if ENV.key?('OPENSHIFT_TRACEVIEW_TLYZER_IP')
170
191
  # We're running on OpenShift
@@ -55,6 +55,7 @@ module TraceView
55
55
  kvs[:RemoteHost] = @connection.host
56
56
  kvs[:RemotePort] = @connection.port.to_i
57
57
  kvs[:VirtualHost] = @connection.vhost
58
+ kvs[:Backtrace] = TV::API.backtrace if TV::Config[:bunnyclient][:collect_backtraces]
58
59
  kvs
59
60
  rescue => e
60
61
  TraceView.logger.debug "[traceview/debug] #{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" if TraceView::Config[:verbose]
@@ -68,9 +69,7 @@ module TraceView
68
69
  return basic_publish_without_traceview(payload, exchange, routing_key, opts) if !TraceView.tracing?
69
70
 
70
71
  begin
71
- kvs = {}
72
- kvs[:Spec] = :pushq
73
- kvs[:Flavor] = :rabbitmq # broker name?
72
+ kvs = collect_channel_kvs
74
73
 
75
74
  if exchange.respond_to?(:name)
76
75
  kvs[:ExchangeName] = exchange.name
@@ -80,16 +79,16 @@ module TraceView
80
79
  kvs[:ExchangeName] = :default
81
80
  end
82
81
 
83
- kvs[:Queue] = opts[:queue] if opts.key?(:queue)
84
- kvs[:RoutingKey] = routing_key if routing_key
85
- kvs[:RemoteHost] = @connection.host
86
- kvs[:RemotePort] = @connection.port.to_i
87
-
88
- kvs[:Op] = :publish
89
- kvs[:VirtualHost] = @connection.vhost
82
+ kvs[:Queue] = opts[:queue] if opts.key?(:queue)
83
+ kvs[:RoutingKey] = routing_key if routing_key
84
+ kvs[:Op] = :publish
90
85
 
91
86
  TraceView::API.log_entry('rabbitmq-client')
92
87
 
88
+ # Pass the tracing context as a header
89
+ opts[:headers] ||= {}
90
+ opts[:headers][:SourceTrace] = TraceView::Context.toString if TraceView.tracing?
91
+
93
92
  basic_publish_without_traceview(payload, exchange, routing_key, opts)
94
93
  rescue => e
95
94
  TraceView::API.log_exception(nil, e)
@@ -142,8 +141,8 @@ module TraceView
142
141
  end
143
142
  end
144
143
 
145
- if TraceView::Config[:bunny][:enabled] && defined?(::Bunny)
146
- ::TraceView.logger.info '[traceview/loading] Instrumenting bunny' if TraceView::Config[:verbose]
144
+ if TraceView::Config[:bunnyclient][:enabled] && defined?(::Bunny)
145
+ ::TraceView.logger.info '[traceview/loading] Instrumenting bunny client' if TraceView::Config[:verbose]
147
146
  ::TraceView::Util.send_include(::Bunny::Exchange, ::TraceView::Inst::BunnyExchange)
148
147
  ::TraceView::Util.send_include(::Bunny::Channel, ::TraceView::Inst::BunnyChannel)
149
148
  end
@@ -0,0 +1,92 @@
1
+ # Copyright (c) 2016 AppNeta, Inc.
2
+ # All rights reserved.
3
+
4
+ module TraceView
5
+ module Inst
6
+ module BunnyConsumer
7
+ def self.included(klass)
8
+ ::TraceView::Util.method_alias(klass, :call, ::Bunny::Consumer)
9
+ end
10
+
11
+ def collect_consumer_kvs(args)
12
+ begin
13
+ kvs = {}
14
+ kvs[:Spec] = :job
15
+ kvs[:Flavor] = :rabbitmq
16
+ kvs[:RemoteHost] = @channel.connection.host
17
+ kvs[:RemotePort] = @channel.connection.port.to_i
18
+ kvs[:VirtualHost] = @channel.connection.vhost
19
+
20
+ mp = args[1]
21
+ kvs[:RoutingKey] = args[0].routing_key if args[0].routing_key
22
+ kvs[:MsgID] = args[1].message_id if mp.message_id
23
+ kvs[:AppID] = args[1].app_id if mp.app_id
24
+ kvs[:Priority] = args[1].priority if mp.priority
25
+
26
+ if @queue.respond_to?(:name)
27
+ kvs[:Queue] = @queue.name
28
+ else
29
+ kvs[:Queue] = @queue
30
+ end
31
+
32
+ # Report configurable Controller/Action KVs
33
+ # See TraceView::Config[:bunny] in lib/traceview/config.rb
34
+ # Used for dashboard trace filtering
35
+ controller_key = TV::Config[:bunnyconsumer][:controller]
36
+ if mp.respond_to?(controller_key)
37
+ value = mp.method(controller_key).call
38
+ kvs[:Controller] = value if value
39
+ end
40
+
41
+ action_key = TV::Config[:bunnyconsumer][:action]
42
+ if mp.respond_to?(action_key)
43
+ value = mp.method(action_key).call
44
+ kvs[:Action] = value if value
45
+ end
46
+
47
+ if kvs[:Queue]
48
+ kvs[:URL] = "/bunny/#{kvs[:Queue]}"
49
+ else
50
+ kvs[:URL] = "/bunny/consumer"
51
+ end
52
+
53
+ if TV::Config[:bunnyconsumer][:log_args] && @arguments
54
+ kvs[:Args] = @arguments.to_s
55
+ end
56
+
57
+ kvs[:Backtrace] = TV::API.backtrace if TV::Config[:bunnyconsumer][:collect_backtraces]
58
+
59
+ kvs
60
+ rescue => e
61
+ TraceView.logger.debug "[traceview/debug] #{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" if TraceView::Config[:verbose]
62
+ ensure
63
+ return kvs
64
+ end
65
+ end
66
+
67
+ def call_with_traceview(*args)
68
+ report_kvs = collect_consumer_kvs(args)
69
+
70
+ # If SourceTrace was passed, capture and report it
71
+ headers = args[1][:headers]
72
+
73
+ if headers && headers['SourceTrace']
74
+ report_kvs[:SourceTrace] = headers['SourceTrace']
75
+
76
+ # Remove SourceTrace
77
+ headers.delete('SourceTrace')
78
+ end
79
+
80
+ result = TraceView::API.start_trace('rabbitmq-consumer', nil, report_kvs) do
81
+ call_without_traceview(*args)
82
+ end
83
+ result[0]
84
+ end
85
+ end
86
+ end
87
+ end
88
+
89
+ if TraceView::Config[:bunnyconsumer][:enabled] && defined?(::Bunny)
90
+ ::TraceView.logger.info '[traceview/loading] Instrumenting bunny consumer' if TraceView::Config[:verbose]
91
+ ::TraceView::Util.send_include(::Bunny::Consumer, ::TraceView::Inst::BunnyConsumer)
92
+ end
@@ -7,8 +7,8 @@ module TraceView
7
7
  # traceview.gemspec during gem build process
8
8
  module Version
9
9
  MAJOR = 3
10
- MINOR = 5
11
- PATCH = 1
10
+ MINOR = 6
11
+ PATCH = 0
12
12
  BUILD = nil
13
13
 
14
14
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
@@ -4,7 +4,7 @@
4
4
  require 'minitest_helper'
5
5
 
6
6
  unless defined?(JRUBY_VERSION)
7
- class BunnyTest < Minitest::Test
7
+ class BunnyClientTest < Minitest::Test
8
8
  def setup
9
9
  # Support specific environment variables to support remote rabbitmq servers
10
10
  ENV['TV_RABBITMQ_SERVER'] = "127.0.0.1" unless ENV['TV_RABBITMQ_SERVER']
@@ -0,0 +1,204 @@
1
+ # Copyright (c) 2015 AppNeta, Inc.
2
+ # All rights reserved.
3
+
4
+ require 'minitest_helper'
5
+
6
+ unless defined?(JRUBY_VERSION)
7
+ class BunnyConsumerTest < Minitest::Test
8
+ def setup
9
+ # Support specific environment variables to support remote rabbitmq servers
10
+ ENV['TV_RABBITMQ_SERVER'] = "127.0.0.1" unless ENV['TV_RABBITMQ_SERVER']
11
+ ENV['TV_RABBITMQ_PORT'] = "5672" unless ENV['TV_RABBITMQ_PORT']
12
+ ENV['TV_RABBITMQ_USERNAME'] = "guest" unless ENV['TV_RABBITMQ_USERNAME']
13
+ ENV['TV_RABBITMQ_PASSWORD'] = "guest" unless ENV['TV_RABBITMQ_PASSWORD']
14
+ ENV['TV_RABBITMQ_VHOST'] = "/" unless ENV['TV_RABBITMQ_VHOST']
15
+
16
+ @connection_params = {}
17
+ @connection_params[:host] = ENV['TV_RABBITMQ_SERVER']
18
+ @connection_params[:port] = ENV['TV_RABBITMQ_PORT']
19
+ @connection_params[:vhost] = ENV['TV_RABBITMQ_VHOST']
20
+ @connection_params[:user] = ENV['TV_RABBITMQ_USERNAME']
21
+ @connection_params[:pass] = ENV['TV_RABBITMQ_PASSWORD']
22
+
23
+ clear_all_traces
24
+ end
25
+
26
+ def test_consume
27
+ @conn = Bunny.new(@connection_params)
28
+ @conn.start
29
+ @ch = @conn.create_channel
30
+ @queue = @ch.queue("tv.ruby.consumer.test", :exclusive => true)
31
+ @exchange = @ch.default_exchange
32
+
33
+ @queue.subscribe(:block => false, :manual_ack => true) do |delivery_info, properties, payload|
34
+ # Make an http call to spice things up
35
+ uri = URI('http://127.0.0.1:8101/')
36
+ http = Net::HTTP.new(uri.host, uri.port)
37
+ http.get('/?q=1').read_body
38
+ end
39
+
40
+ TraceView::API.start_trace('bunny_consume_test') do
41
+ @exchange.publish("The Tortoise and the Hare", :routing_key => @queue.name, :app_id => "msg_app", :type => :generic)
42
+ end
43
+
44
+ sleep 1
45
+
46
+ traces = get_all_traces
47
+
48
+ traces.count.must_equal 12
49
+ valid_edges?(traces)
50
+
51
+ traces[5]['Layer'].must_equal "net-http"
52
+ traces[5]['Label'].must_equal "entry"
53
+ traces[10]['Layer'].must_equal "net-http"
54
+ traces[10]['Label'].must_equal "exit"
55
+
56
+ traces[4]['Spec'].must_equal "job"
57
+ traces[4]['Flavor'].must_equal "rabbitmq"
58
+ traces[4]['Queue'].must_equal "tv.ruby.consumer.test"
59
+ traces[4]['RemoteHost'].must_equal @connection_params[:host]
60
+ traces[4]['RemotePort'].must_equal @connection_params[:port].to_i
61
+ traces[4]['VirtualHost'].must_equal @connection_params[:vhost]
62
+ traces[4]['RoutingKey'].must_equal "tv.ruby.consumer.test"
63
+ traces[4]['Controller'].must_equal "msg_app"
64
+ traces[4]['Action'].must_equal "generic"
65
+ traces[4]['URL'].must_equal "/bunny/tv.ruby.consumer.test"
66
+ traces[4].key?('SourceTrace').must_equal true
67
+ traces[4].key?('Backtrace').must_equal false
68
+
69
+ @conn.close
70
+ end
71
+
72
+ def test_blocking_consume
73
+ skip if RUBY_VERSION < '2.0'
74
+ @conn = Bunny.new(@connection_params)
75
+ @conn.start
76
+ @ch = @conn.create_channel
77
+ @queue = @ch.queue("tv.ruby.consumer.blocking.test", :exclusive => true)
78
+ @exchange = @ch.default_exchange
79
+
80
+ Thread.new {
81
+ @queue.subscribe(:block => true, :manual_ack => true) do |delivery_info, properties, payload|
82
+ # Make an http call to spice things up
83
+ uri = URI('http://127.0.0.1:8101/')
84
+ http = Net::HTTP.new(uri.host, uri.port)
85
+ http.get('/?q=1').read_body
86
+ end
87
+ }
88
+
89
+ @exchange.publish("The Tortoise and the Hare", :routing_key => @queue.name, :app_id => "msg_app", :type => :generic)
90
+
91
+ sleep 1
92
+
93
+ traces = get_all_traces
94
+ traces.count.must_equal 8
95
+
96
+ validate_outer_layers(traces, "rabbitmq-consumer")
97
+ valid_edges?(traces)
98
+
99
+ traces[1]['Layer'].must_equal "net-http"
100
+ traces[1]['Label'].must_equal "entry"
101
+ traces[6]['Layer'].must_equal "net-http"
102
+ traces[6]['Label'].must_equal "exit"
103
+
104
+ traces[0]['Spec'].must_equal "job"
105
+ traces[0]['Flavor'].must_equal "rabbitmq"
106
+ traces[0]['Queue'].must_equal "tv.ruby.consumer.blocking.test"
107
+ traces[0]['RemoteHost'].must_equal @connection_params[:host]
108
+ traces[0]['RemotePort'].must_equal @connection_params[:port].to_i
109
+ traces[0]['VirtualHost'].must_equal @connection_params[:vhost]
110
+ traces[0]['RoutingKey'].must_equal "tv.ruby.consumer.blocking.test"
111
+ traces[0]['Controller'].must_equal "msg_app"
112
+ traces[0]['Action'].must_equal "generic"
113
+ traces[0]['URL'].must_equal "/bunny/tv.ruby.consumer.blocking.test"
114
+ traces[0].key?('Backtrace').must_equal false
115
+
116
+ @conn.close
117
+ end
118
+
119
+ def test_consume_error_handling
120
+ @conn = Bunny.new(@connection_params)
121
+ @conn.start
122
+ @ch = @conn.create_channel
123
+ @queue = @ch.queue("tv.ruby.consumer.error.test", :exclusive => true)
124
+ @exchange = @ch.default_exchange
125
+
126
+ @queue.subscribe(:block => false, :manual_ack => true) do |delivery_info, properties, payload|
127
+ raise "blah"
128
+ end
129
+
130
+ @exchange.publish("The Tortoise and the Hare", :routing_key => @queue.name, :app_id => "msg_app", :type => :generic)
131
+
132
+ sleep 1
133
+
134
+ traces = get_all_traces
135
+ traces.count.must_equal 3
136
+
137
+ validate_outer_layers(traces, "rabbitmq-consumer")
138
+ valid_edges?(traces)
139
+
140
+ traces[0]['Spec'].must_equal "job"
141
+ traces[0]['Flavor'].must_equal "rabbitmq"
142
+ traces[0]['Queue'].must_equal "tv.ruby.consumer.error.test"
143
+ traces[0]['RemoteHost'].must_equal @connection_params[:host]
144
+ traces[0]['RemotePort'].must_equal @connection_params[:port].to_i
145
+ traces[0]['VirtualHost'].must_equal @connection_params[:vhost]
146
+ traces[0]['RoutingKey'].must_equal "tv.ruby.consumer.error.test"
147
+ traces[0]['Controller'].must_equal "msg_app"
148
+ traces[0]['Action'].must_equal "generic"
149
+ traces[0]['URL'].must_equal "/bunny/tv.ruby.consumer.error.test"
150
+ traces[0].key?('Backtrace').must_equal false
151
+
152
+ traces[1]['Layer'].must_equal "rabbitmq-consumer"
153
+ traces[1]['Label'].must_equal "error"
154
+ traces[1]['ErrorClass'].must_equal "RuntimeError"
155
+ traces[1]['ErrorMsg'].must_equal "blah"
156
+ traces[1].key?('Backtrace').must_equal true
157
+
158
+ traces[2]['Layer'].must_equal "rabbitmq-consumer"
159
+ traces[2]['Label'].must_equal "exit"
160
+ end
161
+
162
+ def test_message_id_capture
163
+ @conn = Bunny.new(@connection_params)
164
+ @conn.start
165
+ @ch = @conn.create_channel
166
+ @queue = @ch.queue("tv.ruby.consumer.msgid.test", :exclusive => true)
167
+ @exchange = @ch.default_exchange
168
+
169
+ @queue.subscribe(:block => false, :manual_ack => true) do |delivery_info, properties, payload|
170
+ # Make an http call to spice things up
171
+ uri = URI('http://127.0.0.1:8101/')
172
+ http = Net::HTTP.new(uri.host, uri.port)
173
+ http.get('/?q=1').read_body
174
+ end
175
+
176
+ TraceView::API.start_trace('bunny_consume_test') do
177
+ @exchange.publish("The Tortoise and the Hare", :message_id => "1234", :routing_key => @queue.name, :app_id => "msg_app", :type => :generic)
178
+ end
179
+
180
+ sleep 1
181
+
182
+ traces = get_all_traces
183
+
184
+ traces.count.must_equal 12
185
+ valid_edges?(traces)
186
+
187
+ traces[4]['Spec'].must_equal "job"
188
+ traces[4]['Flavor'].must_equal "rabbitmq"
189
+ traces[4]['Queue'].must_equal "tv.ruby.consumer.msgid.test"
190
+ traces[4]['RemoteHost'].must_equal @connection_params[:host]
191
+ traces[4]['RemotePort'].must_equal @connection_params[:port].to_i
192
+ traces[4]['VirtualHost'].must_equal @connection_params[:vhost]
193
+ traces[4]['RoutingKey'].must_equal "tv.ruby.consumer.msgid.test"
194
+ traces[4]['Controller'].must_equal "msg_app"
195
+ traces[4]['Action'].must_equal "generic"
196
+ traces[4]['URL'].must_equal "/bunny/tv.ruby.consumer.msgid.test"
197
+ traces[4]['MsgID'].must_equal "1234"
198
+ traces[4].key?('SourceTrace').must_equal true
199
+ traces[4].key?('Backtrace').must_equal false
200
+
201
+ @conn.close
202
+ end
203
+ end
204
+ end
@@ -16,12 +16,14 @@ class AutoTraceTest < Minitest::Test
16
16
  TraceView.entry_layer?('delayed_job-worker').must_equal true
17
17
  TraceView.entry_layer?('sidekiq-worker').must_equal true
18
18
  TraceView.entry_layer?('resque-worker').must_equal true
19
+ TraceView.entry_layer?('rabbitmq-consumer').must_equal true
19
20
  TraceView.entry_layer?('asdf-worker').must_equal false
20
21
  end
21
22
 
22
23
  def test_entry_layers_supports_symbols
23
24
  TraceView.entry_layer?(:'delayed_job-worker').must_equal true
24
25
  TraceView.entry_layer?(:'resque-worker').must_equal true
26
+ TraceView.entry_layer?(:'rabbitmq-consumer').must_equal true
25
27
  TraceView.entry_layer?(:asdfworker).must_equal false
26
28
  end
27
29
 
@@ -49,6 +51,14 @@ class AutoTraceTest < Minitest::Test
49
51
  end
50
52
  end
51
53
 
54
+ def test_trace_when_default_tm_rabbitmq
55
+ TraceView::Config[:tracing_mode] = :through
56
+
57
+ TV::API.start_trace('rabbitmq-consumer') do
58
+ TraceView.tracing?.must_equal true
59
+ end
60
+ end
61
+
52
62
  def test_dont_trace_when_never
53
63
  TraceView::Config[:tracing_mode] = :never
54
64
 
@@ -30,12 +30,13 @@ describe "TraceView::Config" do
30
30
  instrumentation = TraceView::Config.instrumentation
31
31
 
32
32
  # Verify the number of individual instrumentations
33
- instrumentation.count.must_equal 28
33
+ instrumentation.count.must_equal 29
34
34
 
35
35
  TraceView::Config[:action_controller][:enabled].must_equal true
36
36
  TraceView::Config[:action_view][:enabled].must_equal true
37
37
  TraceView::Config[:active_record][:enabled].must_equal true
38
- TraceView::Config[:bunny][:enabled].must_equal true
38
+ TraceView::Config[:bunnyclient][:enabled].must_equal true
39
+ TraceView::Config[:bunnyconsumer][:enabled].must_equal true
39
40
  TraceView::Config[:cassandra][:enabled].must_equal true
40
41
  TraceView::Config[:curb][:enabled].must_equal true
41
42
  TraceView::Config[:dalli][:enabled].must_equal true
@@ -64,7 +65,8 @@ describe "TraceView::Config" do
64
65
  TraceView::Config[:action_controller][:log_args].must_equal true
65
66
  TraceView::Config[:action_view][:log_args].must_equal true
66
67
  TraceView::Config[:active_record][:log_args].must_equal true
67
- TraceView::Config[:bunny][:log_args].must_equal true
68
+ TraceView::Config[:bunnyclient][:log_args].must_equal true
69
+ TraceView::Config[:bunnyconsumer][:log_args].must_equal true
68
70
  TraceView::Config[:cassandra][:log_args].must_equal true
69
71
  TraceView::Config[:curb][:log_args].must_equal true
70
72
  TraceView::Config[:dalli][:log_args].must_equal true
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: traceview
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.1
4
+ version: 3.6.0
5
5
  platform: java
6
6
  authors:
7
7
  - Peter Giacomo Lombardo
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-02-15 00:00:00.000000000 Z
12
+ date: 2016-03-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -134,7 +134,8 @@ files:
134
134
  - lib/traceview/frameworks/rails/inst/connection_adapters/utils.rb
135
135
  - lib/traceview/frameworks/sinatra.rb
136
136
  - lib/traceview/frameworks/sinatra/templates.rb
137
- - lib/traceview/inst/bunny.rb
137
+ - lib/traceview/inst/bunny-client.rb
138
+ - lib/traceview/inst/bunny-consumer.rb
138
139
  - lib/traceview/inst/curb.rb
139
140
  - lib/traceview/inst/dalli.rb
140
141
  - lib/traceview/inst/delayed_job.rb
@@ -177,7 +178,8 @@ files:
177
178
  - test/frameworks/rails3x_test.rb
178
179
  - test/frameworks/rails4x_test.rb
179
180
  - test/frameworks/sinatra_test.rb
180
- - test/instrumentation/bunny_exchange_test.rb
181
+ - test/instrumentation/bunny_client_test.rb
182
+ - test/instrumentation/bunny_consumer_test.rb
181
183
  - test/instrumentation/cassandra_test.rb
182
184
  - test/instrumentation/curb_test.rb
183
185
  - test/instrumentation/dalli_test.rb
@@ -275,6 +277,7 @@ test_files:
275
277
  - test/servers/rackapp_8101.rb
276
278
  - test/instrumentation/excon_test.rb
277
279
  - test/instrumentation/sequel_pg_test.rb
280
+ - test/instrumentation/bunny_client_test.rb
278
281
  - test/instrumentation/moped_test.rb
279
282
  - test/instrumentation/httpclient_test.rb
280
283
  - test/instrumentation/sequel_mysql_test.rb
@@ -285,9 +288,9 @@ test_files:
285
288
  - test/instrumentation/sidekiq-client_test.rb
286
289
  - test/instrumentation/cassandra_test.rb
287
290
  - test/instrumentation/redis_strings_test.rb
288
- - test/instrumentation/bunny_exchange_test.rb
289
291
  - test/instrumentation/typhoeus_test.rb
290
292
  - test/instrumentation/sequel_mysql2_test.rb
293
+ - test/instrumentation/bunny_consumer_test.rb
291
294
  - test/instrumentation/sidekiq-worker_test.rb
292
295
  - test/instrumentation/redis_misc_test.rb
293
296
  - test/instrumentation/faraday_test.rb