traceview 3.4.2-java → 3.5.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: 60acff05dba3ac97c12c212603c2055a1e866d5d
4
- data.tar.gz: c92f3b700e4f410feacd4835b9dbe9f26ed79ec2
3
+ metadata.gz: 77802e768eb34458ea448fc981134b53f0d21404
4
+ data.tar.gz: 8ff989b243a87e6a0f88d5dbc4fea44b68eaa316
5
5
  SHA512:
6
- metadata.gz: 7e10ef76df5b9cec31dc7b13f498da2748a0b4c97b5975cc5f780f0e964aa3715f6d319c7900fafe6ba6ab4b1f0bae663ee6d1dcdb79050fb57c123301938abc
7
- data.tar.gz: 5e99e735b24c55801d5dde15a45b0087a8a82161628e77eb75caeb34ae91e3498b6690805dbce46f14f6ad3ec2aed48d67a0c05fcb982047d6bbd32cd4335245
6
+ metadata.gz: c0dc967ebf9e9dc670cd918c6fb895ec046f2bcfc14b4ebdb2a6c8fe85fc97ae17360f1c10a685e960c430ae8b4215751967afac963a651b77c012193dfacdf3
7
+ data.tar.gz: 69a42bbbeace02a2a12a870787ce769d83b61c76e968c8e0296afa9bf1e683ff5eb3cda969448756cc8fe95f953297d03c85bde938f94879ce8bcfc2e657b356
data/.travis.yml CHANGED
@@ -65,3 +65,4 @@ services:
65
65
  - memcached
66
66
  - cassandra
67
67
  - redis
68
+ - rabbitmq
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.5.0
8
+
9
+ This minor release includes the following new feature:
10
+
11
+ * New [bunny](https://github.com/ruby-amqp/bunny) (Rabbitmq) client instrumentation: #129
12
+
13
+ Pushed to Rubygems:
14
+
15
+ https://rubygems.org/gems/traceview/versions/3.5.0
16
+ https://rubygems.org/gems/traceview/versions/3.5.0-java
17
+
7
18
  # traceview 3.4.2
8
19
 
9
20
  This patch release includes the following fixes:
@@ -30,6 +30,12 @@ else
30
30
  gem 'sinatra'
31
31
  end
32
32
 
33
+ if RUBY_VERSION < '2.0.0'
34
+ gem 'bunny', '< 2.0.0'
35
+ else
36
+ gem 'bunny'
37
+ end
38
+
33
39
  gem 'cassandra'
34
40
  gem 'curb' unless defined?(JRUBY_VERSION)
35
41
  gem 'dalli' if RUBY_VERSION > '1.8.7'
@@ -36,7 +36,12 @@ else
36
36
  gem 'pg', '< 0.17'
37
37
  end
38
38
 
39
- gem "rails", "~> 3.2.22"
39
+ if RUBY_VERSION < '1.9'
40
+ # Newer Rails is incompatible with Ruby 1.8.7
41
+ gem "rails", "3.2.19"
42
+ else
43
+ gem "rails", "~> 3.2.22"
44
+ end
40
45
 
41
46
  gemspec :path => File.expand_path(File.dirname(__FILE__) + '/../')
42
47
  # vim:syntax=ruby
@@ -94,8 +94,9 @@ if defined?(TraceView::Config)
94
94
  # value to false:
95
95
  #
96
96
  # TraceView::Config[:action_controller][:enabled] = true
97
- # TraceView::Config[:active_record][:enabled] = true
98
97
  # TraceView::Config[:action_view][:enabled] = true
98
+ # TraceView::Config[:active_record][:enabled] = true
99
+ # TraceView::Config[:bunny][:enabled] = true
99
100
  # TraceView::Config[:cassandra][:enabled] = true
100
101
  # TraceView::Config[:curb][:enabled] = true
101
102
  # TraceView::Config[:dalli][:enabled] = true
@@ -124,8 +125,9 @@ if defined?(TraceView::Config)
124
125
  # a certain call or operation.
125
126
  #
126
127
  # TraceView::Config[:action_controller][:collect_backtraces] = true
127
- # TraceView::Config[:active_record][:collect_backtraces] = true
128
128
  # TraceView::Config[:action_view][:collect_backtraces] = true
129
+ # TraceView::Config[:active_record][:collect_backtraces] = true
130
+ # TraceView::Config[:bunny][:collect_backtraces] = true
129
131
  # TraceView::Config[:cassandra][:collect_backtraces] = true
130
132
  # TraceView::Config[:curb][:collect_backtraces] = true
131
133
  # TraceView::Config[:dalli][:collect_backtraces] = false
@@ -11,7 +11,7 @@ module TraceView
11
11
  module Config
12
12
  @@config = {}
13
13
 
14
- @@instrumentation = [:action_controller, :action_view, :active_record,
14
+ @@instrumentation = [:action_controller, :action_view, :active_record, :bunny,
15
15
  :cassandra, :curb, :dalli, :delayed_jobclient,
16
16
  :delayed_jobworker, :em_http_request, :excon,
17
17
  :faraday, :grape, :httpclient, :nethttp, :memcached,
@@ -44,6 +44,7 @@ module TraceView
44
44
  # Set collect_backtraces defaults
45
45
  TraceView::Config[:action_controller][:collect_backtraces] = true
46
46
  TraceView::Config[:active_record][:collect_backtraces] = true
47
+ TraceView::Config[:bunny][:collect_backtraces] = true
47
48
  TraceView::Config[:action_view][:collect_backtraces] = true
48
49
  TraceView::Config[:cassandra][:collect_backtraces] = true
49
50
  TraceView::Config[:curb][:collect_backtraces] = true
@@ -0,0 +1,147 @@
1
+ # Copyright (c) 2015 AppNeta, Inc.
2
+ # All rights reserved.
3
+
4
+ module TraceView
5
+ module Inst
6
+ module BunnyExchange
7
+ def self.included(klass)
8
+ ::TraceView::Util.method_alias(klass, :delete, ::Bunny::Exchange)
9
+ end
10
+
11
+ def delete_with_traceview(opts = {})
12
+ # If we're not tracing, just do a fast return.
13
+ return delete_without_traceview(opts) if !TraceView.tracing?
14
+
15
+ begin
16
+ kvs = {}
17
+ kvs[:Spec] = :pushq
18
+ kvs[:Flavor] = :rabbitmq
19
+ kvs[:Op] = :delete
20
+ kvs[:ExchangeType] = @type
21
+ kvs[:RemoteHost] = channel.connection.host
22
+ kvs[:RemotePort] = channel.connection.port.to_i
23
+ kvs[:VirtualHost] = channel.connection.vhost
24
+
25
+ if @name.is_a?(String) && !@name.empty?
26
+ kvs[:ExchangeName] = @name
27
+ else
28
+ kvs[:ExchangeName] = :default
29
+ end
30
+
31
+ TraceView::API.log_entry('rabbitmq-client')
32
+
33
+ delete_without_traceview(opts)
34
+ rescue => e
35
+ TraceView::API.log_exception(nil, e)
36
+ raise e
37
+ ensure
38
+ TraceView::API.log_exit('rabbitmq-client', kvs)
39
+ end
40
+ end
41
+ end
42
+
43
+ module BunnyChannel
44
+ def self.included(klass)
45
+ ::TraceView::Util.method_alias(klass, :basic_publish, ::Bunny::Channel)
46
+ ::TraceView::Util.method_alias(klass, :queue, ::Bunny::Channel)
47
+ ::TraceView::Util.method_alias(klass, :wait_for_confirms, ::Bunny::Channel)
48
+ end
49
+
50
+ def collect_channel_kvs
51
+ begin
52
+ kvs = {}
53
+ kvs[:Spec] = :pushq
54
+ kvs[:Flavor] = :rabbitmq
55
+ kvs[:RemoteHost] = @connection.host
56
+ kvs[:RemotePort] = @connection.port.to_i
57
+ kvs[:VirtualHost] = @connection.vhost
58
+ kvs
59
+ rescue => e
60
+ TraceView.logger.debug "[traceview/debug] #{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" if TraceView::Config[:verbose]
61
+ end
62
+ end
63
+
64
+ def basic_publish_with_traceview(payload, exchange, routing_key, opts = {})
65
+ # If we're not tracing, just do a fast return.
66
+ return basic_publish_without_traceview(payload, exchange, routing_key, opts) if !TraceView.tracing?
67
+
68
+ begin
69
+ kvs = {}
70
+ kvs[:Spec] = :pushq
71
+ kvs[:Flavor] = :rabbitmq # broker name?
72
+
73
+ if exchange.respond_to?(:name)
74
+ kvs[:ExchangeName] = exchange.name
75
+ elsif exchange.respond_to?(:empty?) && !exchange.empty?
76
+ kvs[:ExchangeName] = exchange
77
+ else
78
+ kvs[:ExchangeName] = :default
79
+ end
80
+
81
+ kvs[:Queue] = opts[:queue] if opts.key?(:queue)
82
+ kvs[:RoutingKey] = routing_key if routing_key
83
+ kvs[:RemoteHost] = @connection.host
84
+ kvs[:RemotePort] = @connection.port.to_i
85
+
86
+ kvs[:Op] = :publish
87
+ kvs[:VirtualHost] = @connection.vhost
88
+
89
+ TraceView::API.log_entry('rabbitmq-client')
90
+
91
+ basic_publish_without_traceview(payload, exchange, routing_key, opts)
92
+ rescue => e
93
+ TraceView::API.log_exception(nil, e)
94
+ raise e
95
+ ensure
96
+ TraceView::API.log_exit('rabbitmq-client', kvs)
97
+ end
98
+ end
99
+
100
+ def queue_with_traceview(name = AMQ::Protocol::EMPTY_STRING, opts = {})
101
+ # If we're not tracing, just do a fast return.
102
+ return queue_without_traceview(name, opts) if !TraceView.tracing?
103
+
104
+ begin
105
+ kvs = collect_channel_kvs
106
+ kvs[:Op] = :queue
107
+
108
+ TraceView::API.log_entry('rabbitmq-client')
109
+
110
+ result = queue_without_traceview(name, opts)
111
+ kvs[:Queue] = result.name
112
+ result
113
+ rescue => e
114
+ TraceView::API.log_exception(nil, e)
115
+ raise e
116
+ ensure
117
+ TraceView::API.log_exit('rabbitmq-client', kvs)
118
+ end
119
+ end
120
+
121
+ def wait_for_confirms_with_traceview
122
+ # If we're not tracing, just do a fast return.
123
+ return wait_for_confirms_without_traceview if !TraceView.tracing?
124
+
125
+ begin
126
+ kvs = collect_channel_kvs
127
+ kvs[:Op] = :wait_for_confirms
128
+
129
+ TraceView::API.log_entry('rabbitmq-client')
130
+
131
+ wait_for_confirms_without_traceview
132
+ rescue => e
133
+ TraceView::API.log_exception(nil, e)
134
+ raise e
135
+ ensure
136
+ TraceView::API.log_exit('rabbitmq-client', kvs)
137
+ end
138
+ end
139
+ end
140
+ end
141
+ end
142
+
143
+ if TraceView::Config[:bunny][:enabled] && defined?(::Bunny)
144
+ ::TraceView.logger.info '[traceview/loading] Instrumenting bunny' if TraceView::Config[:verbose]
145
+ ::TraceView::Util.send_include(::Bunny::Exchange, ::TraceView::Inst::BunnyExchange)
146
+ ::TraceView::Util.send_include(::Bunny::Channel, ::TraceView::Inst::BunnyChannel)
147
+ 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 = 4
11
- PATCH = 2
10
+ MINOR = 5
11
+ PATCH = 0
12
12
  BUILD = nil
13
13
 
14
14
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
@@ -0,0 +1,276 @@
1
+ # Copyright (c) 2015 AppNeta, Inc.
2
+ # All rights reserved.
3
+
4
+ require 'minitest_helper'
5
+
6
+ unless defined?(JRUBY_VERSION)
7
+ class BunnyTest < 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_publish_default_exchange
27
+ @conn = Bunny.new(@connection_params)
28
+ @conn.start
29
+ @ch = @conn.create_channel
30
+ @queue = @ch.queue("tv.ruby.test")
31
+ @exchange = @ch.default_exchange
32
+
33
+ TraceView::API.start_trace('bunny_tests') do
34
+ @exchange.publish("The Tortoise and the Hare", :routing_key => @queue.name)
35
+ end
36
+
37
+ traces = get_all_traces
38
+ traces.count.must_equal 4
39
+
40
+ validate_outer_layers(traces, "bunny_tests")
41
+ valid_edges?(traces)
42
+
43
+ traces[1]['Layer'].must_equal "rabbitmq-client"
44
+ traces[1]['Label'].must_equal "entry"
45
+ traces[2]['Layer'].must_equal "rabbitmq-client"
46
+ traces[2]['Label'].must_equal "exit"
47
+ traces[2]['Spec'].must_equal "pushq"
48
+ traces[2]['Flavor'].must_equal "rabbitmq"
49
+ traces[2]['ExchangeName'].must_equal "default"
50
+ traces[2]['RoutingKey'].must_equal "tv.ruby.test"
51
+ traces[2]['Op'].must_equal "publish"
52
+ traces[2]['RemoteHost'].must_equal ENV['TV_RABBITMQ_SERVER']
53
+ traces[2]['RemotePort'].must_equal ENV['TV_RABBITMQ_PORT'].to_i
54
+ traces[2]['VirtualHost'].must_equal ENV['TV_RABBITMQ_VHOST']
55
+
56
+ @conn.close
57
+ end
58
+
59
+ def test_publish_fanout_exchange
60
+ @conn = Bunny.new(@connection_params)
61
+ @conn.start
62
+ @ch = @conn.create_channel
63
+ @exchange = @ch.fanout("tv.ruby.fanout.tests")
64
+
65
+ TraceView::API.start_trace('bunny_tests') do
66
+ @exchange.publish("The Tortoise and the Hare in the fanout exchange.", :routing_key => 'tv.ruby.test').publish("And another...")
67
+ end
68
+
69
+ traces = get_all_traces
70
+ traces.count.must_equal 6
71
+
72
+ validate_outer_layers(traces, "bunny_tests")
73
+ valid_edges?(traces)
74
+
75
+ traces[1]['Layer'].must_equal "rabbitmq-client"
76
+ traces[1]['Label'].must_equal "entry"
77
+ traces[2]['Layer'].must_equal "rabbitmq-client"
78
+ traces[2]['Label'].must_equal "exit"
79
+ traces[2]['Spec'].must_equal "pushq"
80
+ traces[2]['Flavor'].must_equal "rabbitmq"
81
+ traces[2]['ExchangeName'].must_equal "tv.ruby.fanout.tests"
82
+ traces[2]['RoutingKey'].must_equal "tv.ruby.test"
83
+ traces[2]['Op'].must_equal "publish"
84
+ traces[2]['RemoteHost'].must_equal ENV['TV_RABBITMQ_SERVER']
85
+ traces[2]['RemotePort'].must_equal ENV['TV_RABBITMQ_PORT'].to_i
86
+ traces[2]['VirtualHost'].must_equal ENV['TV_RABBITMQ_VHOST']
87
+
88
+ traces[3]['Layer'].must_equal "rabbitmq-client"
89
+ traces[3]['Label'].must_equal "entry"
90
+ traces[4]['Layer'].must_equal "rabbitmq-client"
91
+ traces[4]['Label'].must_equal "exit"
92
+ traces[4]['Spec'].must_equal "pushq"
93
+ traces[4]['Flavor'].must_equal "rabbitmq"
94
+ traces[4]['ExchangeName'].must_equal "tv.ruby.fanout.tests"
95
+ traces[4].key?('RoutingKey').must_equal false
96
+ traces[4]['Op'].must_equal "publish"
97
+ traces[4]['RemoteHost'].must_equal ENV['TV_RABBITMQ_SERVER']
98
+ traces[4]['RemotePort'].must_equal ENV['TV_RABBITMQ_PORT'].to_i
99
+ traces[4]['VirtualHost'].must_equal ENV['TV_RABBITMQ_VHOST']
100
+
101
+ @conn.close
102
+ end
103
+
104
+ def test_publish_topic_exchange
105
+ @conn = Bunny.new(@connection_params)
106
+ @conn.start
107
+ @ch = @conn.create_channel
108
+ @exchange = @ch.topic("tv.ruby.topic.tests", :auto_delete => true)
109
+
110
+ TraceView::API.start_trace('bunny_tests') do
111
+ @exchange.publish("The Tortoise and the Hare in the topic exchange.", :routing_key => 'tv.ruby.test.1').publish("And another...", :routing_key => 'tv.ruby.test.2' )
112
+ end
113
+
114
+ traces = get_all_traces
115
+ traces.count.must_equal 6
116
+
117
+ validate_outer_layers(traces, "bunny_tests")
118
+ valid_edges?(traces)
119
+
120
+ traces[1]['Layer'].must_equal "rabbitmq-client"
121
+ traces[1]['Label'].must_equal "entry"
122
+ traces[2]['Layer'].must_equal "rabbitmq-client"
123
+ traces[2]['Label'].must_equal "exit"
124
+ traces[2]['Spec'].must_equal "pushq"
125
+ traces[2]['Flavor'].must_equal "rabbitmq"
126
+ traces[2]['ExchangeName'].must_equal "tv.ruby.topic.tests"
127
+ traces[2]['RoutingKey'].must_equal "tv.ruby.test.1"
128
+ traces[2]['Op'].must_equal "publish"
129
+ traces[2]['RemoteHost'].must_equal ENV['TV_RABBITMQ_SERVER']
130
+ traces[2]['RemotePort'].must_equal ENV['TV_RABBITMQ_PORT'].to_i
131
+ traces[2]['VirtualHost'].must_equal ENV['TV_RABBITMQ_VHOST']
132
+
133
+ traces[3]['Layer'].must_equal "rabbitmq-client"
134
+ traces[3]['Label'].must_equal "entry"
135
+ traces[4]['Layer'].must_equal "rabbitmq-client"
136
+ traces[4]['Label'].must_equal "exit"
137
+ traces[4]['Spec'].must_equal "pushq"
138
+ traces[4]['Flavor'].must_equal "rabbitmq"
139
+ traces[4]['ExchangeName'].must_equal "tv.ruby.topic.tests"
140
+ traces[4]['RoutingKey'].must_equal "tv.ruby.test.2"
141
+ traces[4]['Op'].must_equal "publish"
142
+ traces[4]['RemoteHost'].must_equal ENV['TV_RABBITMQ_SERVER']
143
+ traces[4]['RemotePort'].must_equal ENV['TV_RABBITMQ_PORT'].to_i
144
+ traces[4]['VirtualHost'].must_equal ENV['TV_RABBITMQ_VHOST']
145
+
146
+ @conn.close
147
+ end
148
+
149
+ def test_publish_error_handling
150
+ @conn = Bunny.new(@connection_params)
151
+ @conn.start
152
+ @ch = @conn.create_channel
153
+
154
+ begin
155
+ TraceView::API.start_trace('bunny_tests') do
156
+ @exchange = @ch.topic("tv.ruby.error.1", :auto_delete => true)
157
+ @exchange = @ch.fanout("tv.ruby.error.1", :auto_delete => true)
158
+ @exchange.publish("The Tortoise and the Hare in the topic exchange.", :routing_key => 'tv.ruby.test.1').publish("And another...", :routing_key => 'tv.ruby.test.2' )
159
+ end
160
+ rescue
161
+ # Capture intentional redeclaration error
162
+ end
163
+
164
+ traces = get_all_traces
165
+ assert_equal traces.count, 3
166
+
167
+ validate_outer_layers(traces, "bunny_tests")
168
+ valid_edges?(traces)
169
+
170
+ traces[1]['Label'].must_equal "error"
171
+ traces[1]['ErrorClass'].must_equal "Bunny::PreconditionFailed"
172
+ traces[1]['ErrorMsg'].must_match(/PRECONDITION_FAILED/)
173
+ traces[1].key?('Backtrace').must_equal true
174
+
175
+ @conn.close
176
+ end
177
+
178
+ def test_delete_exchange
179
+ @conn = Bunny.new(@connection_params)
180
+ @conn.start
181
+ @ch = @conn.create_channel
182
+ @exchange = @ch.fanout("tv.delete_exchange.test")
183
+ @queue = @ch.queue("", :exclusive => true).bind(@exchange)
184
+
185
+ @ch.confirm_select
186
+ @exchange.publish("", :routing_key => 'tv.ruby.test')
187
+
188
+ TraceView::API.start_trace('bunny_tests') do
189
+ @exchange.delete
190
+ end
191
+
192
+ traces = get_all_traces
193
+ traces.count.must_equal 4
194
+
195
+ validate_outer_layers(traces, "bunny_tests")
196
+
197
+ traces[2]['Spec'].must_equal "pushq"
198
+ traces[2]['Flavor'].must_equal "rabbitmq"
199
+ traces[2]['ExchangeName'].must_equal "tv.delete_exchange.test"
200
+ traces[2]['ExchangeType'].must_equal "fanout"
201
+ traces[2]['Op'].must_equal "delete"
202
+ traces[2]['RemoteHost'].must_equal ENV['TV_RABBITMQ_SERVER']
203
+ traces[2]['RemotePort'].must_equal ENV['TV_RABBITMQ_PORT'].to_i
204
+ traces[2]['VirtualHost'].must_equal ENV['TV_RABBITMQ_VHOST']
205
+ end
206
+
207
+ def test_wait_for_confirms
208
+ @conn = Bunny.new(@connection_params)
209
+ @conn.start
210
+ @ch = @conn.create_channel
211
+ @exchange = @ch.fanout("tv.ruby.wait_for_confirm.tests")
212
+ @queue = @ch.queue("", :exclusive => true).bind(@exchange)
213
+
214
+ @ch.confirm_select
215
+
216
+ TraceView::API.start_trace('bunny_tests') do
217
+ 1000.times do
218
+ @exchange.publish("", :routing_key => 'tv.ruby.test')
219
+ end
220
+
221
+ @ch.wait_for_confirms
222
+ end
223
+
224
+ traces = get_all_traces
225
+ assert_equal traces.count, 2004
226
+
227
+ validate_outer_layers(traces, "bunny_tests")
228
+
229
+ traces[2000]['Spec'].must_equal "pushq"
230
+ traces[2000]['Flavor'].must_equal "rabbitmq"
231
+ traces[2000]['ExchangeName'].must_equal "tv.ruby.wait_for_confirm.tests"
232
+ traces[2000]['RoutingKey'].must_equal "tv.ruby.test"
233
+ traces[2000]['Op'].must_equal "publish"
234
+ traces[2000]['RemoteHost'].must_equal ENV['TV_RABBITMQ_SERVER']
235
+ traces[2000]['RemotePort'].must_equal ENV['TV_RABBITMQ_PORT'].to_i
236
+ traces[2000]['VirtualHost'].must_equal ENV['TV_RABBITMQ_VHOST']
237
+
238
+ traces[2001]['Layer'].must_equal "rabbitmq-client"
239
+ traces[2001]['Label'].must_equal "entry"
240
+ traces[2002]['Layer'].must_equal "rabbitmq-client"
241
+ traces[2002]['Label'].must_equal "exit"
242
+ traces[2002]['Spec'].must_equal "pushq"
243
+ traces[2002]['Flavor'].must_equal "rabbitmq"
244
+ traces[2002]['Op'].must_equal "wait_for_confirms"
245
+ traces[2002]['RemoteHost'].must_equal ENV['TV_RABBITMQ_SERVER']
246
+ traces[2002]['RemotePort'].must_equal ENV['TV_RABBITMQ_PORT'].to_i
247
+ traces[2002]['VirtualHost'].must_equal ENV['TV_RABBITMQ_VHOST']
248
+
249
+ @conn.close
250
+ end
251
+
252
+ def test_channel_queue
253
+ @conn = Bunny.new(@connection_params)
254
+ @conn.start
255
+ @ch = @conn.create_channel
256
+ @exchange = @ch.fanout("tv.queue.test")
257
+
258
+ TraceView::API.start_trace('bunny_tests') do
259
+ @queue = @ch.queue("blah", :exclusive => true).bind(@exchange)
260
+ end
261
+
262
+ traces = get_all_traces
263
+ traces.count.must_equal 4
264
+
265
+ validate_outer_layers(traces, "bunny_tests")
266
+
267
+ traces[2]['Spec'].must_equal "pushq"
268
+ traces[2]['Flavor'].must_equal "rabbitmq"
269
+ traces[2]['Op'].must_equal "queue"
270
+ traces[2]['Queue'].must_equal "blah"
271
+ traces[2]['RemoteHost'].must_equal ENV['TV_RABBITMQ_SERVER']
272
+ traces[2]['RemotePort'].must_equal ENV['TV_RABBITMQ_PORT'].to_i
273
+ traces[2]['VirtualHost'].must_equal ENV['TV_RABBITMQ_VHOST']
274
+ end
275
+ end
276
+ end
@@ -30,11 +30,12 @@ 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 27
33
+ instrumentation.count.must_equal 28
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
39
  TraceView::Config[:cassandra][:enabled].must_equal true
39
40
  TraceView::Config[:curb][:enabled].must_equal true
40
41
  TraceView::Config[:dalli][:enabled].must_equal true
@@ -63,6 +64,7 @@ describe "TraceView::Config" do
63
64
  TraceView::Config[:action_controller][:log_args].must_equal true
64
65
  TraceView::Config[:action_view][:log_args].must_equal true
65
66
  TraceView::Config[:active_record][:log_args].must_equal true
67
+ TraceView::Config[:bunny][:log_args].must_equal true
66
68
  TraceView::Config[:cassandra][:log_args].must_equal true
67
69
  TraceView::Config[:curb][:log_args].must_equal true
68
70
  TraceView::Config[:dalli][:log_args].must_equal true
data/traceview.gemspec CHANGED
@@ -26,17 +26,21 @@ Gem::Specification.new do |s|
26
26
  # Development dependencies used in gem development & testing
27
27
  s.add_development_dependency('rake', '>= 0.9.0')
28
28
 
29
- case RUBY_VERSION
30
- when /^1\.8/
31
- s.add_development_dependency('ruby-debug', '>= 0.10.1')
32
- s.add_development_dependency('pry', '>= 0.9.12.4')
33
- when /^1\.9/
34
- s.add_development_dependency('debugger', '>= 1.6.7')
29
+ unless defined?(JRUBY_VERSION)
30
+ case RUBY_VERSION
31
+ when /^1\.8/
32
+ s.add_development_dependency('ruby-debug', '>= 0.10.1')
33
+ s.add_development_dependency('pry', '>= 0.9.12.4')
34
+ when /^1\.9/
35
+ s.add_development_dependency('debugger', '>= 1.6.7')
36
+ s.add_development_dependency('pry', '>= 0.10.0')
37
+ when /^2\./
38
+ s.add_development_dependency('byebug', '>= 8.0.0')
39
+ s.add_development_dependency('pry', '>= 0.10.0')
40
+ s.add_development_dependency('pry-byebug', '>= 3.0.0')
41
+ end
42
+ else
35
43
  s.add_development_dependency('pry', '>= 0.10.0')
36
- when /^2\./
37
- s.add_development_dependency('byebug', '>= 8.0.0')
38
- s.add_development_dependency('pry', '>= 0.10.0')
39
- s.add_development_dependency('pry-byebug', '>= 3.0.0')
40
44
  end
41
45
 
42
46
  s.required_ruby_version = '>= 1.8.6'
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.4.2
4
+ version: 3.5.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-01-25 00:00:00.000000000 Z
12
+ date: 2016-01-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -39,20 +39,6 @@ dependencies:
39
39
  version: 0.9.0
40
40
  prerelease: false
41
41
  type: :development
42
- - !ruby/object:Gem::Dependency
43
- name: byebug
44
- version_requirements: !ruby/object:Gem::Requirement
45
- requirements:
46
- - - ">="
47
- - !ruby/object:Gem::Version
48
- version: 8.0.0
49
- requirement: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - ">="
52
- - !ruby/object:Gem::Version
53
- version: 8.0.0
54
- prerelease: false
55
- type: :development
56
42
  - !ruby/object:Gem::Dependency
57
43
  name: pry
58
44
  version_requirements: !ruby/object:Gem::Requirement
@@ -67,20 +53,6 @@ dependencies:
67
53
  version: 0.10.0
68
54
  prerelease: false
69
55
  type: :development
70
- - !ruby/object:Gem::Dependency
71
- name: pry-byebug
72
- version_requirements: !ruby/object:Gem::Requirement
73
- requirements:
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- version: 3.0.0
77
- requirement: !ruby/object:Gem::Requirement
78
- requirements:
79
- - - ">="
80
- - !ruby/object:Gem::Version
81
- version: 3.0.0
82
- prerelease: false
83
- type: :development
84
56
  description: The TraceView gem provides performance instrumentation for MRI Ruby, JRuby and related frameworks.
85
57
  email: traceviewsupport@appneta.com
86
58
  executables: []
@@ -162,6 +134,7 @@ files:
162
134
  - lib/traceview/frameworks/rails/inst/connection_adapters/utils.rb
163
135
  - lib/traceview/frameworks/sinatra.rb
164
136
  - lib/traceview/frameworks/sinatra/templates.rb
137
+ - lib/traceview/inst/bunny.rb
165
138
  - lib/traceview/inst/curb.rb
166
139
  - lib/traceview/inst/dalli.rb
167
140
  - lib/traceview/inst/delayed_job.rb
@@ -204,6 +177,7 @@ files:
204
177
  - test/frameworks/rails3x_test.rb
205
178
  - test/frameworks/rails4x_test.rb
206
179
  - test/frameworks/sinatra_test.rb
180
+ - test/instrumentation/bunny_exchange_test.rb
207
181
  - test/instrumentation/cassandra_test.rb
208
182
  - test/instrumentation/curb_test.rb
209
183
  - test/instrumentation/dalli_test.rb
@@ -310,6 +284,7 @@ test_files:
310
284
  - test/instrumentation/sidekiq-client_test.rb
311
285
  - test/instrumentation/cassandra_test.rb
312
286
  - test/instrumentation/redis_strings_test.rb
287
+ - test/instrumentation/bunny_exchange_test.rb
313
288
  - test/instrumentation/typhoeus_test.rb
314
289
  - test/instrumentation/sequel_mysql2_test.rb
315
290
  - test/instrumentation/sidekiq-worker_test.rb