instana 1.209.5 → 1.209.7

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: 9d6046b9ecf69be7ee6dbc4db6922d10cd731c10e6a9439cab442856fe169e5d
4
- data.tar.gz: f5a2a1c8a7d011bc9a1abc3da001f3f8adf91407bf54724728f85590aff77940
3
+ metadata.gz: 7ad727e388d233521b7837cfc0157cd6b5af54f307529ad5e58207894d6863de
4
+ data.tar.gz: 9fb40e5a5769d996195f076475c2ef5d67182e245e549cf14970dcc0779d6014
5
5
  SHA512:
6
- metadata.gz: 19d223cebc5f38a3dd552eb7c188c51f815c2e340d83c0e214a748c1a464e9ff6488967ae583a6efba1a1552dc5249872c3993b2fb56e175ae399993301051d6
7
- data.tar.gz: bc5dc0521fdc266c6e6f82559335a445f8c7e186b9405bfac93f5ceb028470405abad4a95391e3fea9864b413c3e1c6a16c43f06b3555a007bfe752893e67732
6
+ metadata.gz: 0f9e58d31701ffd88af39ff5ac25e7c87a443153122a63b6e319e04c545d3926318d4c5862b8a628a215325f6f873d26852eb426440ceaa19746c4c80e9d19e6
7
+ data.tar.gz: d83ea081e9721634bcbf0aff97b1fc67f78fdcfabe52bfbeda95f20fc144c017e16d137f74d02a54f9a0adbb028916c5a62596b7af2a7cb51a80880d0fc79f99
data/.circleci/config.yml CHANGED
@@ -186,10 +186,12 @@ workflows:
186
186
  gemfile:
187
187
  - "./gemfiles/aws_30.gemfile"
188
188
  - "./gemfiles/cuba_30.gemfile"
189
+ - "./gemfiles/cuba_40.gemfile"
189
190
  - "./gemfiles/dalli_20.gemfile"
190
191
  - "./gemfiles/excon_02.gemfile"
191
192
  - "./gemfiles/excon_079.gemfile"
192
193
  - "./gemfiles/graphql_10.gemfile"
194
+ - "./gemfiles/graphql_20.gemfile"
193
195
  - "./gemfiles/grpc_10.gemfile"
194
196
  - "./gemfiles/net_http_01.gemfile"
195
197
  - "./gemfiles/rack_16.gemfile"
data/README.md CHANGED
@@ -4,25 +4,15 @@
4
4
 
5
5
  # Instana
6
6
 
7
- The Instana gem provides Ruby metrics and traces (request, queue & cross-host) for [Instana](https://www.instana.com/).
7
+ The `instana` gem provides Ruby metrics and traces (request, queue & cross-host) for [Instana](https://www.instana.com/).
8
8
 
9
- [![CircleCI](https://circleci.com/gh/instana/ruby-sensor.svg?style=svg)](https://circleci.com/gh/instana/ruby-sensor)
10
- [![Gem Version](https://badge.fury.io/rb/instana.svg)](https://badge.fury.io/rb/instana)
11
-
12
- ## Note
13
-
14
- This gem supports Ruby versions 2.0 or greater.
9
+ This gem supports Ruby versions 2.7 or greater.
15
10
 
16
11
  Any and all feedback is welcome. Happy Ruby visibility.
17
12
 
18
- [![rails](https://s3.amazonaws.com/instana/rails-logo.jpg?1)](http://rubyonrails.org/)
19
- [![roda](https://s3.amazonaws.com/instana/roda-logo.png?1)](http://roda.jeremyevans.net/)
20
- [![cuba](https://s3.amazonaws.com/instana/cuba-logo.png?1)](http://cuba.is/)
21
- [![mina logo 100px](https://cloud.githubusercontent.com/assets/395132/23832558/fcd5bdb2-0736-11e7-9809-3016e89698e2.png)](https://github.com/instana/mina-instana)
22
- [![sinatra](https://s3.amazonaws.com/instana/sinatra-logo.png?1)](http://www.sinatrarb.com/)
23
- [![padrino](https://s3.amazonaws.com/instana/padrino-logo.png?1)](http://padrinorb.com/)
24
- [![rack](https://s3.amazonaws.com/instana/rack-logo.png?1)](https://rack.github.io/)
25
- [![rack](https://user-images.githubusercontent.com/395132/27842764-27e0e452-610d-11e7-811f-8575f83b8944.png?1)](http://www.grpc.io/)
13
+ [![Gem Version](https://badge.fury.io/rb/instana.svg)](https://badge.fury.io/rb/instana)
14
+ [![CircleCI](https://circleci.com/gh/instana/ruby-sensor.svg?style=svg)](https://circleci.com/gh/instana/ruby-sensor)
15
+ [![OpenTracing Badge](https://img.shields.io/badge/OpenTracing-enabled-blue.svg)](http://opentracing.io)
26
16
 
27
17
  ## Installation
28
18
 
@@ -42,7 +32,17 @@ Or install it yourself as:
42
32
 
43
33
  ## Usage
44
34
 
45
- The instana gem is a zero configuration tool that will automatically collect key metrics and distributed traces from your Ruby processes. Just install and go.
35
+ The `instana` gem is a zero configuration tool that will automatically collect key metrics and distributed traces from your Ruby processes. Just install and go.
36
+
37
+ ### Supported Frameworks
38
+
39
+ * [Cuba](https://cuba.is/)
40
+ * [gRPC](https://grpc.io/)
41
+ * [Padrino](https://padrinorb.com/)
42
+ * [Roda](https://roda.jeremyevans.net/)
43
+ * [Ruby on Rails](https://rubyonrails.org/)
44
+ * [Rack](https://rack.github.io/)
45
+ * [Sinatra](https://sinatrarb.com/)
46
46
 
47
47
  ## Configuration
48
48
 
@@ -56,7 +56,7 @@ This Ruby gem provides a simple API for tracing and also supports [OpenTracing](
56
56
 
57
57
  You can find more documentation covering supported components and minimum versions in the Instana [documentation portal](https://docs.instana.io/ecosystem/ruby/).
58
58
 
59
- # Want End User Monitoring (EUM)?
59
+ ## Want End User Monitoring (EUM)?
60
60
 
61
61
  Instana provides deep end user monitoring that links server side traces with browser events to give you a complete view from server to browser.
62
62
 
@@ -0,0 +1,16 @@
1
+ # (c) Copyright IBM Corp. 2023
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rack", ">=3.0.0"
6
+ gem "rake"
7
+ gem "minitest", "5.9.1"
8
+ gem "minitest-reporters"
9
+ gem "webmock"
10
+ gem "puma"
11
+ gem "rubocop", "~> 1.9"
12
+ gem "rack-test"
13
+ gem "simplecov", "~> 0.21.2"
14
+ gem "cuba", ">= 4.0.1"
15
+
16
+ gemspec path: "../"
@@ -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
@@ -18,7 +18,7 @@ module Instana
18
18
  end
19
19
 
20
20
  def parent_pid
21
- if in_container? && sched_pid != pid
21
+ if in_container? && !sched_pid.nil?
22
22
  sched_pid
23
23
  else
24
24
  pid
@@ -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.5"
5
+ VERSION = "1.209.7"
6
6
  VERSION_FULL = "instana-#{VERSION}"
7
7
  end
@@ -6,7 +6,10 @@ require 'rack/test'
6
6
 
7
7
  class CubaTest < Minitest::Test
8
8
  include Rack::Test::Methods
9
- APP = Rack::Builder.parse_file('test/support/apps/cuba/config.ru').first
9
+
10
+ # rack < 3.0.0 returns a two long array `app, options`
11
+ # rack >= 3.0.0 returns only the app
12
+ APP, * = Rack::Builder.parse_file('test/support/apps/cuba/config.ru')
10
13
 
11
14
  def app
12
15
  APP
@@ -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.5
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-03-23 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
@@ -157,11 +157,13 @@ files:
157
157
  - gemfiles/.bundle/config
158
158
  - gemfiles/aws_30.gemfile
159
159
  - gemfiles/cuba_30.gemfile
160
+ - gemfiles/cuba_40.gemfile
160
161
  - gemfiles/dalli_20.gemfile
161
162
  - gemfiles/excon_02.gemfile
162
163
  - gemfiles/excon_021.gemfile
163
164
  - gemfiles/excon_079.gemfile
164
165
  - gemfiles/graphql_10.gemfile
166
+ - gemfiles/graphql_20.gemfile
165
167
  - gemfiles/grpc_10.gemfile
166
168
  - gemfiles/mongo_216.gemfile
167
169
  - gemfiles/net_http_01.gemfile
@@ -382,7 +384,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
382
384
  - !ruby/object:Gem::Version
383
385
  version: '0'
384
386
  requirements: []
385
- rubygems_version: 3.3.26
387
+ rubygems_version: 3.4.10
386
388
  signing_key:
387
389
  specification_version: 4
388
390
  summary: Ruby Distributed Tracing & Metrics Sensor for Instana