instana 1.209.6 → 1.209.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1376d020820248b2c9576de22adb744c54cb520aaedd7f64b60379c1651dbf39
4
- data.tar.gz: 2f35a9669a3ec3c14e2ce08d25e047f383238d4ad82703d9418907e7b13b9a51
3
+ metadata.gz: 7ad727e388d233521b7837cfc0157cd6b5af54f307529ad5e58207894d6863de
4
+ data.tar.gz: 9fb40e5a5769d996195f076475c2ef5d67182e245e549cf14970dcc0779d6014
5
5
  SHA512:
6
- metadata.gz: 5fa2dfa55a024dcdfdc44521ed0a6372a93b594a53abc7998e5986f6e0ca90fa04c628ce5d9e0acbf24d2bb5cf13b94b012a5fcaa7aa4348714168abf355f51a
7
- data.tar.gz: f398497b049918b750c388b1965c1ef5ff26f84514afdf9d1ab762ce98cf5c2cf011a94285add7577fea749392e2f5a565ee40296e21437568eec1c163aad734
6
+ metadata.gz: 0f9e58d31701ffd88af39ff5ac25e7c87a443153122a63b6e319e04c545d3926318d4c5862b8a628a215325f6f873d26852eb426440ceaa19746c4c80e9d19e6
7
+ data.tar.gz: d83ea081e9721634bcbf0aff97b1fc67f78fdcfabe52bfbeda95f20fc144c017e16d137f74d02a54f9a0adbb028916c5a62596b7af2a7cb51a80880d0fc79f99
data/.circleci/config.yml CHANGED
@@ -191,6 +191,7 @@ workflows:
191
191
  - "./gemfiles/excon_02.gemfile"
192
192
  - "./gemfiles/excon_079.gemfile"
193
193
  - "./gemfiles/graphql_10.gemfile"
194
+ - "./gemfiles/graphql_20.gemfile"
194
195
  - "./gemfiles/grpc_10.gemfile"
195
196
  - "./gemfiles/net_http_01.gemfile"
196
197
  - "./gemfiles/rack_16.gemfile"
@@ -0,0 +1,18 @@
1
+ # This file was generated by Appraisal
2
+
3
+ # (c) Copyright IBM Corp. 2021
4
+ # (c) Copyright Instana Inc. 2021
5
+
6
+ source "https://rubygems.org"
7
+
8
+ gem "rake"
9
+ gem "minitest", "5.9.1"
10
+ gem "minitest-reporters"
11
+ gem "webmock"
12
+ gem "puma"
13
+ gem "rubocop", "~> 1.9"
14
+ gem "rack-test"
15
+ gem "simplecov", "~> 0.21.2"
16
+ gem "graphql", ">= 2.0.21", "< 3.0"
17
+
18
+ gemspec path: "../"
@@ -5,7 +5,8 @@ module Instana
5
5
  module Activators
6
6
  class SidekiqClient < Activator
7
7
  def can_instrument?
8
- defined?(::Sidekiq) && ::Sidekiq.respond_to?(:configure_client) && ::Instana.config[:'sidekiq-client'][:enabled]
8
+ defined?(::Sidekiq) && ::Sidekiq.respond_to?(:configure_client) && ::Instana.config[:'sidekiq-client'][:enabled] &&
9
+ Gem::Specification.find_by_name('sidekiq').version < Gem::Version.new('5.3')
9
10
  end
10
11
 
11
12
  def instrument
@@ -5,7 +5,8 @@ module Instana
5
5
  module Activators
6
6
  class SidekiqWorker < Activator
7
7
  def can_instrument?
8
- defined?(::Sidekiq) && ::Sidekiq.respond_to?(:configure_server) && ::Instana.config[:'sidekiq-worker'][:enabled]
8
+ defined?(::Sidekiq) && ::Sidekiq.respond_to?(:configure_server) && ::Instana.config[:'sidekiq-worker'][:enabled] &&
9
+ Gem::Specification.find_by_name('sidekiq').version < Gem::Version.new('5.3')
9
10
  end
10
11
 
11
12
  def instrument
@@ -53,8 +53,8 @@ module Instana
53
53
  # ::Instana.config[:sanitize_sql] = false
54
54
  @config[:sanitize_sql] = true
55
55
 
56
- # W3 Trace Context Support
57
- @config[:w3_trace_correlation] = ENV['INSTANA_DISABLE_W3C_TRACE_CORRELATION'].nil?
56
+ # W3C Trace Context Support
57
+ @config[:w3c_trace_correlation] = ENV['INSTANA_DISABLE_W3C_TRACE_CORRELATION'].nil?
58
58
 
59
59
  @config[:post_fork_proc] = proc { ::Instana.agent.spawn_background_thread }
60
60
 
@@ -9,7 +9,7 @@ require 'rack/request'
9
9
 
10
10
  module Instana
11
11
  class InstrumentedRequest < Rack::Request
12
- W3_TRACE_PARENT_FORMAT = /00-(?<trace>[0-9a-f]+)-(?<parent>[0-9a-f]+)-(?<flags>[0-9a-f]+)/.freeze
12
+ W3C_TRACE_PARENT_FORMAT = /[0-9a-f][0-9a-e]-(?<trace>[0-9a-f]{32})-(?<parent>[0-9a-f]{16})-(?<flags>[0-9a-f]{2})/.freeze
13
13
  INSTANA_TRACE_STATE = /in=(?<trace>[0-9a-f]+);(?<span>[0-9a-f]+)/.freeze
14
14
 
15
15
  def skip_trace?
@@ -32,16 +32,16 @@ module Instana
32
32
 
33
33
  context[:level] = @env['HTTP_X_INSTANA_L'][0] if @env['HTTP_X_INSTANA_L']
34
34
 
35
- unless ::Instana.config[:w3_trace_correlation]
35
+ unless ::Instana.config[:w3c_trace_correlation]
36
36
  trace_state = parse_trace_state
37
37
 
38
- if context[:from_w3] && trace_state.empty?
38
+ if context[:from_w3c] && trace_state.empty?
39
39
  context.delete(:span_id)
40
- context[:from_w3] = false
41
- elsif context[:from_w3] && !trace_state.empty?
40
+ context[:from_w3c] = false
41
+ elsif context[:from_w3c] && !trace_state.empty?
42
42
  context[:trace_id] = trace_state[:t]
43
43
  context[:span_id] = trace_state[:p]
44
- context[:from_w3] = false
44
+ context[:from_w3c] = false
45
45
  end
46
46
  end
47
47
 
@@ -86,7 +86,7 @@ module Instana
86
86
  end
87
87
 
88
88
  def continuing_from_trace_parent?
89
- incoming_context[:from_w3]
89
+ incoming_context[:from_w3c]
90
90
  end
91
91
 
92
92
  def synthetic?
@@ -122,13 +122,13 @@ module Instana
122
122
  long_instana_id: long_instana_id? ? sanitized_t : nil,
123
123
  external_trace_id: external_trace_id,
124
124
  external_state: @env['HTTP_TRACESTATE'],
125
- from_w3: false
125
+ from_w3c: false
126
126
  }.reject { |_, v| v.nil? }
127
127
  end
128
128
 
129
129
  def context_from_trace_parent
130
130
  return {} unless @env.has_key?('HTTP_TRACEPARENT')
131
- matches = @env['HTTP_TRACEPARENT'].match(W3_TRACE_PARENT_FORMAT)
131
+ matches = @env['HTTP_TRACEPARENT'].match(W3C_TRACE_PARENT_FORMAT)
132
132
  return {} unless matches
133
133
  return {} if matches_is_invalid(matches)
134
134
 
@@ -140,7 +140,7 @@ module Instana
140
140
  external_state: @env['HTTP_TRACESTATE'],
141
141
  trace_id: trace_id,
142
142
  span_id: span_id,
143
- from_w3: true
143
+ from_w3c: true
144
144
  }
145
145
  end
146
146
 
@@ -154,7 +154,7 @@ module Instana
154
154
  {
155
155
  trace_id: state[:t],
156
156
  span_id: state[:p],
157
- from_w3: false
157
+ from_w3c: false
158
158
  }.reject { |_, v| v.nil? }
159
159
  end
160
160
 
@@ -2,6 +2,6 @@
2
2
  # (c) Copyright Instana Inc. 2016
3
3
 
4
4
  module Instana
5
- VERSION = "1.209.6"
5
+ VERSION = "1.209.7"
6
6
  VERSION_FULL = "instana-#{VERSION}"
7
7
  end
@@ -4,7 +4,15 @@
4
4
  require 'test_helper'
5
5
 
6
6
  class RackInstrumentedRequestTest < Minitest::Test
7
- def test_skip_trace_with_header
7
+ def test_suppression_via_x_instana_l
8
+ req = Instana::InstrumentedRequest.new(
9
+ 'HTTP_X_INSTANA_L' => '0'
10
+ )
11
+
12
+ assert req.skip_trace?
13
+ end
14
+
15
+ def test_suppression_via_x_instana_l_with_trailing_content
8
16
  req = Instana::InstrumentedRequest.new(
9
17
  'HTTP_X_INSTANA_L' => '0;sample-data'
10
18
  )
@@ -12,6 +20,20 @@ class RackInstrumentedRequestTest < Minitest::Test
12
20
  assert req.skip_trace?
13
21
  end
14
22
 
23
+ def test_no_suppression_assume_level_1_as_default
24
+ req = Instana::InstrumentedRequest.new({})
25
+
26
+ assert !req.skip_trace?
27
+ end
28
+
29
+ def test_no_suppression_when_x_instana_l_is_provided_explicitly
30
+ req = Instana::InstrumentedRequest.new(
31
+ 'HTTP_X_INSTANA_L' => '1'
32
+ )
33
+
34
+ assert !req.skip_trace?
35
+ end
36
+
15
37
  def test_skip_trace_without_header
16
38
  req = Instana::InstrumentedRequest.new({})
17
39
 
@@ -29,7 +51,7 @@ class RackInstrumentedRequestTest < Minitest::Test
29
51
  expected = {
30
52
  trace_id: id,
31
53
  span_id: id,
32
- from_w3: false,
54
+ from_w3c: false,
33
55
  level: '1'
34
56
  }
35
57
 
@@ -37,9 +59,8 @@ class RackInstrumentedRequestTest < Minitest::Test
37
59
  refute req.continuing_from_trace_parent?
38
60
  end
39
61
 
40
- def test_incoming_w3_content
62
+ def test_incoming_w3c_context
41
63
  req = Instana::InstrumentedRequest.new(
42
- 'HTTP_X_INSTANA_L' => '1',
43
64
  'HTTP_TRACEPARENT' => '00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01'
44
65
  )
45
66
 
@@ -48,42 +69,81 @@ class RackInstrumentedRequestTest < Minitest::Test
48
69
  external_state: nil,
49
70
  trace_id: 'a3ce929d0e0e4736',
50
71
  span_id: '00f067aa0ba902b7',
51
- from_w3: true,
52
- level: '1'
72
+ from_w3c: true
53
73
  }
54
74
 
55
75
  assert_equal expected, req.incoming_context
56
76
  assert req.continuing_from_trace_parent?
57
77
  end
58
78
 
59
- def test_incoming_w3_content_invalid_id
79
+ def test_incoming_w3c_context_newer_version_additional_fields
60
80
  req = Instana::InstrumentedRequest.new(
61
- 'HTTP_X_INSTANA_L' => '1',
62
- 'HTTP_TRACEPARENT' => '00-00000000000000000000000000000000-0000000000000000-01'
81
+ 'HTTP_TRACEPARENT' => 'fe-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01-abcdefg'
63
82
  )
64
83
 
65
84
  expected = {
66
- level: '1'
85
+ external_trace_id: '4bf92f3577b34da6a3ce929d0e0e4736',
86
+ external_state: nil,
87
+ trace_id: 'a3ce929d0e0e4736',
88
+ span_id: '00f067aa0ba902b7',
89
+ from_w3c: true
67
90
  }
68
91
 
69
92
  assert_equal expected, req.incoming_context
70
- refute req.continuing_from_trace_parent?
93
+ assert req.continuing_from_trace_parent?
71
94
  end
72
95
 
73
- def test_incoming_invalid_w3_content
96
+ def test_incoming_w3c_context_unknown_flags
74
97
  req = Instana::InstrumentedRequest.new(
75
- 'HTTP_X_INSTANA_L' => '1',
76
- 'HTTP_TRACEPARENT' => '00-XXa3ce929d0e0e4736-00f67aa0ba902b7-01'
98
+ 'HTTP_TRACEPARENT' => '00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-ff'
77
99
  )
78
100
 
79
101
  expected = {
80
- level: '1'
102
+ external_trace_id: '4bf92f3577b34da6a3ce929d0e0e4736',
103
+ external_state: nil,
104
+ trace_id: 'a3ce929d0e0e4736',
105
+ span_id: '00f067aa0ba902b7',
106
+ from_w3c: true
81
107
  }
82
108
 
83
109
  assert_equal expected, req.incoming_context
110
+ assert req.continuing_from_trace_parent?
111
+ end
112
+
113
+ def test_incoming_w3c_context_invalid_version
114
+ req = Instana::InstrumentedRequest.new(
115
+ 'HTTP_TRACEPARENT' => 'ff-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01'
116
+ )
117
+
118
+ expected = {}
119
+
120
+ assert_equal expected, req.incoming_context
121
+ refute req.continuing_from_trace_parent?
122
+ end
123
+
124
+ def test_incoming_w3c_context_invalid_id
125
+ req = Instana::InstrumentedRequest.new(
126
+ 'HTTP_TRACEPARENT' => '00-00000000000000000000000000000000-0000000000000000-01'
127
+ )
128
+
129
+ expected = {}
130
+
131
+ assert_equal expected, req.incoming_context
132
+ refute req.continuing_from_trace_parent?
133
+ end
134
+
135
+ def test_incoming_invalid_w3c_context
136
+ req = Instana::InstrumentedRequest.new(
137
+ 'HTTP_TRACEPARENT' => '00-XXa3ce929d0e0e4736-00f67aa0ba902b7-01'
138
+ )
139
+
140
+ expected = {}
141
+
142
+ assert_equal expected, req.incoming_context
143
+ refute req.continuing_from_trace_parent?
84
144
  end
85
145
 
86
- def test_incoming_w3_state
146
+ def test_incoming_w3c_state
87
147
  req = Instana::InstrumentedRequest.new(
88
148
  'HTTP_TRACESTATE' => 'a=12345,in=123;abe,c=[+]'
89
149
  )
@@ -69,7 +69,7 @@ class RackTest < Minitest::Test
69
69
  assert last_response.headers.key?("Server-Timing")
70
70
  assert last_response.headers["Server-Timing"] == "intid;desc=#{::Instana::Util.id_to_header(rack_span[:t])}"
71
71
 
72
- # W3 Trace Context
72
+ # W3C Trace Context
73
73
  assert_equal "00-#{rack_span[:t].rjust(32, '0')}-#{rack_span[:s]}-01", last_response.headers["Traceparent"]
74
74
  assert_equal "in=#{rack_span[:t]};#{rack_span[:s]}", last_response.headers["Tracestate"]
75
75
 
@@ -301,7 +301,7 @@ class RackTest < Minitest::Test
301
301
  assert_equal true, first_span[:sy]
302
302
  end
303
303
 
304
- def test_basic_get_with_w3_trace
304
+ def test_basic_get_with_w3c_trace
305
305
  clear_all!
306
306
 
307
307
  header 'TRACEPARENT', '00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01'
@@ -321,9 +321,9 @@ class RackTest < Minitest::Test
321
321
  assert first_span[:tp]
322
322
  end
323
323
 
324
- def test_basic_get_with_w3_disabled
324
+ def test_basic_get_with_w3c_disabled
325
325
  clear_all!
326
- ::Instana.config[:w3_trace_correlation] = false
326
+ ::Instana.config[:w3c_trace_correlation] = false
327
327
 
328
328
  header 'TRACEPARENT', '00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01'
329
329
 
@@ -336,7 +336,7 @@ class RackTest < Minitest::Test
336
336
  first_span = spans.first
337
337
  assert_equal :rack, first_span[:n]
338
338
  refute first_span[:tp]
339
- ::Instana.config[:w3_trace_correlation] = true
339
+ ::Instana.config[:w3c_trace_correlation] = true
340
340
  end
341
341
 
342
342
  def test_skip_trace
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.209.6
4
+ version: 1.209.7
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: 2023-04-25 00:00:00.000000000 Z
11
+ date: 2023-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -163,6 +163,7 @@ files:
163
163
  - gemfiles/excon_021.gemfile
164
164
  - gemfiles/excon_079.gemfile
165
165
  - gemfiles/graphql_10.gemfile
166
+ - gemfiles/graphql_20.gemfile
166
167
  - gemfiles/grpc_10.gemfile
167
168
  - gemfiles/mongo_216.gemfile
168
169
  - gemfiles/net_http_01.gemfile