instana 1.203.0 → 1.204.0.pre3

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
  SHA256:
3
- metadata.gz: e4a3e85003438c1690ddc13b6e475bcb1765155bf71b90c2799b8037033a9ce3
4
- data.tar.gz: d6fcc234fa717a23048e674ba76a4b7ad78cf81bf1c105ff5dce226d95cc7b82
3
+ metadata.gz: d6c2235234526a14bbb8818b104e9417f4683179b2166cb222fe136af32794d4
4
+ data.tar.gz: 16a190359fa7208ceeaf7170db5cfc732bcb464837f6acde9eb1c5be08b09eba
5
5
  SHA512:
6
- metadata.gz: a2d908c112040f6e833c23e6462e0b7c0696d72520767693b911aa6ddb0f8547a5c51518dd46826efddbb0747820014085ca9c3103dae61315821c99f5b49b34
7
- data.tar.gz: 47871736c4c8b3f2427e9647e2769209b952bec8534a78c0c9875d642549b44545d93d4ae213bde3c00566f7428a33955481473b489c7894fd7a47a87d6d9e42
6
+ metadata.gz: d1465d42aeee46d0db43c2563b6bea541efddb553bb30fec875cc1cc2b5de30303476258ad889ccc9c6b10c4e1164f12001c743c16de0dafebce8e0020fd850b
7
+ data.tar.gz: b87b819750e3901f524609b89c2c8a96ac54965d8c6db2f4100a9cc2586cfafd55be20b30516364fdbec1199da7db8c987b6fb8f4edfc82761624caf5ea5d94b
@@ -5,7 +5,7 @@ module Instana
5
5
  module Activators
6
6
  class ActionMailer < Activator
7
7
  def can_instrument?
8
- defined?(::ActionMailer::Base)
8
+ defined?(::ActionMailer::Base) && defined?(ActiveSupport::Executor)
9
9
  end
10
10
 
11
11
  def instrument
@@ -67,7 +67,7 @@ module Instana
67
67
  @config[:graphql] = { :enabled => true }
68
68
  @config[:nethttp] = { :enabled => true }
69
69
  @config[:redis] = { :enabled => true }
70
- @config[:'resque-client'] = { :enabled => true }
70
+ @config[:'resque-client'] = { :enabled => true, :propagate => true }
71
71
  @config[:'resque-worker'] = { :enabled => true, :'setup-fork' => true }
72
72
  @config[:'rest-client'] = { :enabled => true }
73
73
  @config[:'sidekiq-client'] = { :enabled => true }
@@ -28,7 +28,7 @@ module Instana
28
28
  kvs = collect_kvs(:enqueue, klass, args)
29
29
 
30
30
  Instana.tracer.trace(:'resque-client', kvs) do
31
- args.push(::Instana.tracer.context.to_hash)
31
+ args.push(::Instana.tracer.context.to_hash) if ::Instana.config[:'resque-client'][:propagate]
32
32
  super(klass, *args)
33
33
  end
34
34
  else
@@ -42,7 +42,7 @@ module Instana
42
42
  kvs[:Queue] = queue.to_s if queue
43
43
 
44
44
  Instana.tracer.trace(:'resque-client', kvs) do
45
- args.push(::Instana.tracer.context.to_hash)
45
+ args.push(::Instana.tracer.context.to_hash) if ::Instana.config[:'resque-client'][:propagate]
46
46
  super(queue, klass, *args)
47
47
  end
48
48
  else
@@ -78,7 +78,7 @@ module Instana
78
78
  ::Instana.logger.debug { "#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" } if Instana::Config[:verbose]
79
79
  end
80
80
 
81
- trace_context = if job.payload['args'][-1].is_a?(Hash) && job.payload['args'][-1].keys.include?('trace_id')
81
+ trace_context = if ::Instana.config[:'resque-client'][:propagate] && job.payload['args'][-1].is_a?(Hash) && job.payload['args'][-1].keys.include?('trace_id')
82
82
  context_from_wire = job.payload['args'].pop
83
83
  ::Instana::SpanContext.new(
84
84
  context_from_wire['trace_id'],
@@ -11,7 +11,7 @@ module Instana
11
11
  end
12
12
 
13
13
  def remove_from_query(str, secret_values = Instana.agent.secret_values)
14
- return str unless secret_values
14
+ return str unless secret_values && str
15
15
 
16
16
  begin
17
17
  url = URI(str)
@@ -2,6 +2,7 @@
2
2
  # (c) Copyright Instana Inc. 2016
3
3
 
4
4
  require 'thread'
5
+ require 'forwardable'
5
6
 
6
7
  module Instana
7
8
  class Processor
@@ -80,34 +80,16 @@ module Instana
80
80
  # @param limit [Integer] Limit the backtrace to the top <limit> frames
81
81
  #
82
82
  def add_stack(limit: 30, stack: Kernel.caller)
83
- frame_count = 0
84
- sanitized_stack = []
85
- @data[:stack] = []
86
- limit = 40 if limit > 40
87
-
88
- stack.each do |i|
89
- # If the stack has the full instana gem version in it's path
90
- # then don't include that frame. Also don't exclude the Rack module.
91
- if !i.match(/instana\/instrumentation\/rack.rb/).nil? ||
92
- (i.match(::Instana::VERSION_FULL).nil? && i.match('lib/instana/').nil?)
93
-
94
- x = i.split(':')
95
-
96
- sanitized_stack << {
97
- :c => x[0],
98
- :n => x[1],
99
- :m => x[2]
100
- }
101
- end
102
- end
103
-
104
- if sanitized_stack.length > limit
105
- # (limit * -1) gives us negative form of <limit> used for
106
- # slicing from the end of the list. e.g. stack[-30, 30]
107
- @data[:stack] = sanitized_stack[limit*-1, limit]
108
- else
109
- @data[:stack] = sanitized_stack
110
- end
83
+ @data[:stack] = stack
84
+ .map do |call|
85
+ file, line, *method = call.split(':')
86
+
87
+ {
88
+ c: file,
89
+ n: line,
90
+ m: method.join(' ')
91
+ }
92
+ end.take(limit > 40 ? 40 : limit)
111
93
  end
112
94
 
113
95
  # Log an error into the span
@@ -2,6 +2,6 @@
2
2
  # (c) Copyright Instana Inc. 2016
3
3
 
4
4
  module Instana
5
- VERSION = "1.203.0"
5
+ VERSION = "1.204.0.pre3"
6
6
  VERSION_FULL = "instana-#{VERSION}"
7
7
  end
@@ -29,6 +29,24 @@ class NetHTTPTest < Minitest::Test
29
29
  WebMock.disable_net_connect!
30
30
  end
31
31
 
32
+ def test_get_without_query
33
+ clear_all!
34
+ WebMock.allow_net_connect!
35
+
36
+ Instana.tracer.start_or_continue_trace(:"net-http-test") do
37
+ Net::HTTP.get(URI('http://127.0.0.1:6511/'))
38
+ end
39
+
40
+ spans = ::Instana.processor.queued_spans
41
+ assert_equal 3, spans.length
42
+
43
+ http_span = find_first_span_by_name(spans, :'net-http')
44
+ assert_equal "http://127.0.0.1:6511/", http_span[:data][:http][:url]
45
+ assert_equal "200", http_span[:data][:http][:status]
46
+
47
+ WebMock.disable_net_connect!
48
+ end
49
+
32
50
  def test_block_request
33
51
  clear_all!
34
52
  WebMock.allow_net_connect!
@@ -112,6 +112,41 @@ class ResqueClientTest < Minitest::Test
112
112
  assert_equal "SET", redis2_span[:data][:redis][:command]
113
113
  end
114
114
 
115
+ def test_worker_job_no_propagate
116
+ ::Instana.config[:'resque-client'][:propagate] = false
117
+ ::Instana.tracer.start_or_continue_trace(:'resque-client_test') do
118
+ ::Resque.enqueue_to(:critical, FastJob)
119
+ end
120
+
121
+ resque_job = Resque.reserve('critical')
122
+ @worker.work_one_job(resque_job)
123
+
124
+ spans = ::Instana.processor.queued_spans
125
+ assert_equal 5, spans.length
126
+
127
+ client_span = spans[0]
128
+ resque_span = spans[4]
129
+ redis1_span = spans[3]
130
+ redis2_span = spans[2]
131
+
132
+ assert_equal :'resque-client', client_span[:n]
133
+
134
+ assert_equal :'resque-worker', resque_span[:n]
135
+ refute_equal client_span[:s], resque_span[:p]
136
+ assert_equal false, resque_span.key?(:error)
137
+ assert_equal false, resque_span.key?(:ec)
138
+ assert_equal "FastJob", resque_span[:data][:'resque-worker'][:job]
139
+ assert_equal "critical", resque_span[:data][:'resque-worker'][:queue]
140
+ assert_equal false, resque_span[:data][:'resque-worker'].key?(:error)
141
+
142
+ assert_equal :redis, redis1_span[:n]
143
+ assert_equal "SET", redis1_span[:data][:redis][:command]
144
+ assert_equal :redis, redis2_span[:n]
145
+ assert_equal "SET", redis2_span[:data][:redis][:command]
146
+ ensure
147
+ ::Instana.config[:'resque-client'][:propagate] = true
148
+ end
149
+
115
150
  def test_worker_error_job
116
151
  Resque::Job.create(:critical, ErrorJob)
117
152
  @worker.work(0)
data/test/secrets_test.rb CHANGED
@@ -88,6 +88,15 @@ class SecretsTest < Minitest::Test
88
88
  assert_redacted @subject.remove_from_query(url, sample_config), %w(filter[instantiate]), raw_str: true
89
89
  end
90
90
 
91
+ def test_with_nil
92
+ sample_config = {
93
+ "matcher"=>"contains",
94
+ "list"=>["stan"]
95
+ }
96
+
97
+ assert_equal @subject.remove_from_query(nil, sample_config), nil
98
+ end
99
+
91
100
  private
92
101
 
93
102
  def url_for(keys)
@@ -7,7 +7,9 @@ require "net/http"
7
7
  class FastJob
8
8
  @queue = :critical
9
9
 
10
- def self.perform
10
+ def self.perform(*args)
11
+ raise 'Invalid Args' unless args.empty?
12
+
11
13
  if ENV.key?('REDIS_URL')
12
14
  redis = Redis.new(:url => ENV['REDIS_URL'])
13
15
  elsif ENV.key?('REDIS_URL')
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.203.0
4
+ version: 1.204.0.pre3
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: 2021-06-29 00:00:00.000000000 Z
11
+ date: 2021-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -370,9 +370,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
370
370
  version: '2.1'
371
371
  required_rubygems_version: !ruby/object:Gem::Requirement
372
372
  requirements:
373
- - - ">="
373
+ - - ">"
374
374
  - !ruby/object:Gem::Version
375
- version: '0'
375
+ version: 1.3.1
376
376
  requirements: []
377
377
  rubygems_version: 3.1.6
378
378
  signing_key: