instana 1.9.0.daftrabbit → 1.9.0.sillyrabbit

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
- SHA256:
3
- metadata.gz: 8b11875e63a40db84acb015973cfcf38b0f7b5d86a3c92a6ca4178582d525a0a
4
- data.tar.gz: 78e31a128e0bed068b84a195e06f205a917b6ded8ac018e5493320dcbb202fa3
2
+ SHA1:
3
+ metadata.gz: 0ba941e65d061723cef0a542c2f65d80d4956a9b
4
+ data.tar.gz: defbff62c39a5e8dbc8e3fabceff42a43c29932e
5
5
  SHA512:
6
- metadata.gz: 645484fc592fc9578e4d7378b198ea867d61dabe25b51365a3545485e7f0a8b8454e4766104b0009178d2e009da64624f9fc8959fd73b6509162188a4ee55839
7
- data.tar.gz: c6d2c36eeea6be0b0b09107a10cc9af56a9d12ec4960efe28dc151ff7570fec3ea8638ba6dc4e40a4699d7caf5dc9d79aab2e039e2982809c9286b92aba6bbb3
6
+ metadata.gz: 349ec35ff3ed2efc30fa13c9257262ae8464c1ebca45fc5398d570cb2253e185a7a17f20211720ec36e0c975ccab1f5cc1f0f5c548ee0865347c08e9f23dfee4
7
+ data.tar.gz: 258a0b56f3af4d9e49f1ac53d3ba74d214ce8f9a7cfdb25cd41e1d2314177e0f65e06369ca2175dfc4e3c197da3cd06046de426c0cd4c1e9e72a2817ba3a6092
@@ -290,7 +290,7 @@ module Instana
290
290
  uri = URI.parse("http://#{@discovered[:agent_host]}:#{@discovered[:agent_port]}/#{path}")
291
291
  req = Net::HTTP::Post.new(uri)
292
292
 
293
- req.body = Oj.dump(spans, :omit_nil => true)
293
+ req.body = Oj.dump(spans)
294
294
  response = make_host_agent_request(req)
295
295
 
296
296
  if response
@@ -1,40 +1,26 @@
1
1
  require "instana/rack"
2
2
 
3
3
  if defined?(::Rails)
4
+ # In Rails, let's use the Rails logger
5
+ ::Instana.logger = ::Rails.logger if ::Rails.logger
4
6
 
5
7
  if ::Rails::VERSION::MAJOR < 3
6
8
  ::Rails.configuration.after_initialize do
7
- # In Rails, let's use the Rails logger
8
- ::Instana.logger = ::Rails.logger if ::Rails.logger
9
-
10
- if ::Instana.config[:tracing][:enabled]
11
- ::Instana.logger.info "Instrumenting Rack"
12
- ::Rails.configuration.middleware.insert 0, ::Instana::Rack
13
- else
14
- ::Instana.logger.info "Rack: Tracing disabled via config. Not enabling middleware."
15
- end
9
+ ::Instana.logger.info "Instrumenting Rack"
10
+ ::Rails.configuration.middleware.insert 0, ::Instana::Rack
16
11
  end
17
12
  else
18
13
  module ::Instana
19
14
  class Railtie < ::Rails::Railtie
20
15
  initializer 'instana.rack' do |app|
21
- # In Rails, let's use the Rails logger
22
- ::Instana.logger = ::Rails.logger if ::Rails.logger
23
-
24
- if ::Instana.config[:tracing][:enabled]
25
- ::Instana.logger.info "Instrumenting Rack"
26
- app.config.middleware.insert 0, ::Instana::Rack
27
- else
28
- ::Instana.logger.info "Rack: Tracing disabled via config. Not enabling middleware."
29
- end
16
+ ::Instana.logger.info "Instrumenting Rack"
17
+ app.config.middleware.insert 0, ::Instana::Rack
30
18
  end
31
19
 
32
- if ::Instana.config[:tracing][:enabled]
33
- config.after_initialize do
34
- require "instana/frameworks/instrumentation/active_record"
35
- require "instana/frameworks/instrumentation/action_controller"
36
- require "instana/frameworks/instrumentation/action_view"
37
- end
20
+ config.after_initialize do
21
+ require "instana/frameworks/instrumentation/active_record"
22
+ require "instana/frameworks/instrumentation/action_controller"
23
+ require "instana/frameworks/instrumentation/action_view"
38
24
  end
39
25
  end
40
26
  end
@@ -20,7 +20,7 @@ module Instana
20
20
  Instana.logger.debug "#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}"
21
21
  end
22
22
 
23
- { :'resque-client' => kvs }
23
+ kvs
24
24
  end
25
25
 
26
26
  def enqueue_with_instana(klass, *args)
@@ -72,11 +72,12 @@ module Instana
72
72
  begin
73
73
  kvs[:job] = job.payload['class'].to_s
74
74
  kvs[:queue] = job.queue
75
+ kvs[:args] = job.payload['args'].to_json
75
76
  rescue => e
76
- ::Instana.logger.debug "#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" if Instana::Config[:verbose]
77
+ Instana.logger.debug "#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" if Instana::Config[:verbose]
77
78
  end
78
79
 
79
- Instana.tracer.start_or_continue_trace(:'resque-worker', { :'resque-worker' => kvs }) do
80
+ Instana.tracer.start_or_continue_trace(:'resque-worker', nil, kvs) do
80
81
  perform_without_instana(job)
81
82
  end
82
83
  end
@@ -89,12 +90,8 @@ module Instana
89
90
 
90
91
  def fail_with_instana(exception)
91
92
  if Instana.tracer.tracing?
92
- ::Instana.tracer.log_info(:'resque-worker' => { :error => "#{exception.class}: #{exception}"})
93
- ::Instana.tracer.log_error(exception)
93
+ Instana.tracer.log_error(:resque, exception)
94
94
  end
95
- rescue Exception => e
96
- ::Instana.logger.debug "#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" if Instana::Config[:verbose]
97
- ensure
98
95
  fail_without_instana(exception)
99
96
  end
100
97
  end
@@ -1,4 +1,4 @@
1
1
  module Instana
2
- VERSION = "1.9.0.daftrabbit"
2
+ VERSION = "1.9.0.sillyrabbit"
3
3
  VERSION_FULL = "instana-#{VERSION}"
4
4
  end
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
- require_relative "../jobs/resque_fast_job"
3
- require_relative "../jobs/resque_error_job"
2
+ require_relative "../jobs/resque_job_1"
3
+ require_relative "../jobs/resque_job_2"
4
4
  require 'resque'
5
5
 
6
6
  if ENV.key?('REDIS_URL')
@@ -12,9 +12,6 @@ end
12
12
  class ResqueClientTest < Minitest::Test
13
13
  def setup
14
14
  clear_all!
15
- ENV['FORK_PER_JOB'] = 'false'
16
- Resque.redis.redis.flushall
17
- @worker = Resque::Worker.new(:critical)
18
15
  end
19
16
 
20
17
  def teardown
@@ -22,7 +19,7 @@ class ResqueClientTest < Minitest::Test
22
19
 
23
20
  def test_enqueue
24
21
  ::Instana.tracer.start_or_continue_trace('resque-client_test') do
25
- ::Resque.enqueue(FastJob)
22
+ ::Resque.enqueue(ResqueWorkerJob1)
26
23
  end
27
24
 
28
25
  traces = Instana.processor.queued_traces
@@ -32,18 +29,13 @@ class ResqueClientTest < Minitest::Test
32
29
  assert_equal 3, spans.count
33
30
 
34
31
  assert_equal :'resque-client_test', spans[0][:data][:sdk][:name]
35
-
36
32
  assert_equal :"resque-client", spans[1][:n]
37
- assert_equal "FastJob", spans[1][:data][:'resque-client'][:job]
38
- assert_equal :critical, spans[1][:data][:'resque-client'][:queue]
39
- assert_equal false, spans[1][:data][:'resque-client'].key?(:error)
40
-
41
33
  assert_equal :redis, spans[2][:n]
42
34
  end
43
35
 
44
36
  def test_enqueue_to
45
37
  ::Instana.tracer.start_or_continue_trace('resque-client_test') do
46
- ::Resque.enqueue_to(:critical, FastJob)
38
+ ::Resque.enqueue_to(:critical, ResqueWorkerJob1)
47
39
  end
48
40
 
49
41
  traces = Instana.processor.queued_traces
@@ -54,15 +46,12 @@ class ResqueClientTest < Minitest::Test
54
46
 
55
47
  assert_equal :'resque-client_test', spans[0][:data][:sdk][:name]
56
48
  assert_equal :"resque-client", spans[1][:n]
57
- assert_equal "FastJob", spans[1][:data][:'resque-client'][:job]
58
- assert_equal :critical, spans[1][:data][:'resque-client'][:queue]
59
- assert_equal false, spans[1][:data][:'resque-client'].key?(:error)
60
49
  assert_equal :redis, spans[2][:n]
61
50
  end
62
51
 
63
52
  def test_dequeue
64
53
  ::Instana.tracer.start_or_continue_trace('resque-client_test', '', {}) do
65
- ::Resque.dequeue(FastJob, { :generate => :farfalla })
54
+ ::Resque.dequeue(ResqueWorkerJob2, { :generate => :farfalla })
66
55
  end
67
56
 
68
57
  traces = Instana.processor.queued_traces
@@ -73,56 +62,6 @@ class ResqueClientTest < Minitest::Test
73
62
 
74
63
  assert_equal :'resque-client_test', spans[0][:data][:sdk][:name]
75
64
  assert_equal :"resque-client", spans[1][:n]
76
- assert_equal "FastJob", spans[1][:data][:'resque-client'][:job]
77
- assert_equal :critical, spans[1][:data][:'resque-client'][:queue]
78
- assert_equal false, spans[1][:data][:'resque-client'].key?(:error)
79
65
  assert_equal :redis, spans[2][:n]
80
66
  end
81
-
82
- def test_worker_job
83
- Resque::Job.create(:critical, FastJob)
84
- @worker.work(0)
85
-
86
- traces = Instana.processor.queued_traces
87
- assert_equal 1, traces.count
88
-
89
- spans = traces[0].spans.to_a
90
- assert_equal 3, spans.count
91
-
92
- resque_span = spans[0]
93
- redis1_span = spans[1]
94
- redis2_span = spans[2]
95
-
96
- assert_equal :'resque-worker', resque_span[:n]
97
- assert_equal false, resque_span.key?(:error)
98
- assert_equal false, resque_span.key?(:ec)
99
- assert_equal "FastJob", resque_span[:data][:'resque-worker'][:job]
100
- assert_equal "critical", resque_span[:data][:'resque-worker'][:queue]
101
- assert_equal false, resque_span[:data][:'resque-worker'].key?(:error)
102
-
103
- assert_equal :redis, redis1_span[:n]
104
- assert_equal "SET", redis1_span[:data][:redis][:command]
105
- assert_equal :redis, redis2_span[:n]
106
- assert_equal "SET", redis2_span[:data][:redis][:command]
107
- end
108
-
109
- def test_worker_error_job
110
- Resque::Job.create(:critical, ErrorJob)
111
- @worker.work(0)
112
-
113
- traces = Instana.processor.queued_traces
114
- assert_equal 1, traces.count
115
-
116
- spans = traces[0].spans.to_a
117
- resque_span = spans[0]
118
- assert_equal 5, spans.count
119
-
120
- assert_equal :'resque-worker', resque_span[:n]
121
- assert_equal true, resque_span.key?(:error)
122
- assert_equal 1, resque_span[:ec]
123
- assert_equal "ErrorJob", resque_span[:data][:'resque-worker'][:job]
124
- assert_equal "critical", resque_span[:data][:'resque-worker'][:queue]
125
- assert_equal "Exception: Silly Rabbit, Trix are for kids.", resque_span[:data][:'resque-worker'][:error]
126
- assert_equal Array, resque_span[:stack].class
127
- end
128
67
  end
@@ -0,0 +1,11 @@
1
+ class ResqueWorkerJob1
2
+ @queue = :normal
3
+
4
+ def self.perform(*args)
5
+ rc = Redis.new(url: ENV['REDIS_URL'])
6
+
7
+ rc.set('hello', 'world')
8
+ rc.set('hello', 'paramount')
9
+ rc.set('other', 'hello')
10
+ end
11
+ end
@@ -0,0 +1,7 @@
1
+ class ResqueWorkerJob2
2
+ @queue = :normal
3
+
4
+ def self.perform(*args)
5
+ raise "Fake exception"
6
+ end
7
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: instana
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0.daftrabbit
4
+ version: 1.9.0.sillyrabbit
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Giacomo Lombardo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-24 00:00:00.000000000 Z
11
+ date: 2018-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -280,8 +280,8 @@ files:
280
280
  - test/instrumentation/rest-client_test.rb
281
281
  - test/instrumentation/sidekiq-client_test.rb
282
282
  - test/instrumentation/sidekiq-worker_test.rb
283
- - test/jobs/resque_error_job.rb
284
- - test/jobs/resque_fast_job.rb
283
+ - test/jobs/resque_job_1.rb
284
+ - test/jobs/resque_job_2.rb
285
285
  - test/jobs/sidekiq_job_1.rb
286
286
  - test/jobs/sidekiq_job_2.rb
287
287
  - test/models/block.rb
@@ -317,7 +317,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
317
317
  version: 1.3.1
318
318
  requirements: []
319
319
  rubyforge_project:
320
- rubygems_version: 2.7.6
320
+ rubygems_version: 2.6.12
321
321
  signing_key:
322
322
  specification_version: 4
323
323
  summary: Ruby Distributed Tracing & Metrics Sensor for Instana
@@ -351,8 +351,8 @@ test_files:
351
351
  - test/instrumentation/rest-client_test.rb
352
352
  - test/instrumentation/sidekiq-client_test.rb
353
353
  - test/instrumentation/sidekiq-worker_test.rb
354
- - test/jobs/resque_error_job.rb
355
- - test/jobs/resque_fast_job.rb
354
+ - test/jobs/resque_job_1.rb
355
+ - test/jobs/resque_job_2.rb
356
356
  - test/jobs/sidekiq_job_1.rb
357
357
  - test/jobs/sidekiq_job_2.rb
358
358
  - test/models/block.rb
@@ -1,16 +0,0 @@
1
- require "redis"
2
- require "net/http"
3
-
4
- class ErrorJob
5
- @queue = :critical
6
-
7
- def self.perform
8
- redis = Redis.new(url: ENV['REDIS_URL'])
9
-
10
- dt = Time.now
11
- redis.set('ts', dt)
12
-
13
- raise Exception.new("Silly Rabbit, Trix are for kids.")
14
- redis.set(:nb_id, 2)
15
- end
16
- end
@@ -1,14 +0,0 @@
1
- require "redis"
2
- require "net/http"
3
-
4
- class FastJob
5
- @queue = :critical
6
-
7
- def self.perform
8
- redis = Redis.new(url: ENV['REDIS_URL'])
9
-
10
- dt = Time.now
11
- redis.set('ts', dt)
12
- redis.set(:nb_id, 2)
13
- end
14
- end