instana 1.209.1 → 1.209.3

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: ca275f47709b4255569b5186403965bed6293102b9c34dc30755f7d3cc7a33c9
4
- data.tar.gz: 56eb79fa0c68185f8a7f43ae9755ac9b1a61c1f25c7650ff2ddbe918db316557
3
+ metadata.gz: 1ba4c4719f68be4f2764f82f2880f37a9a121ced7957ea2660383e6eb37745a6
4
+ data.tar.gz: bbbc69a3de73ff922b33d67e5d11cb469518f7664636df4335b3ef7a903bc9af
5
5
  SHA512:
6
- metadata.gz: 4a6f08be4599024dd084e53cabf66f11199934a0fb45b7fdd7c6f1e0ba5c9557cd65317b3a16d20a32af5e4cb0824bc8f587aeaea8602b5bb3f18231996524e9
7
- data.tar.gz: 1f58b30352fa3e2587f7ea3d1da40bb6a52c162a0756fff2618dd6dabe7574f87def126d9c3cf413fcd65096c9fc9c5fb76174840cb7c10db95b2aa19e83c051
6
+ metadata.gz: 9facbe9690a6bb7ef461b8e56def7a74fa1b31d8349ecb7baf1d385d23213cc29800499126e71dc2090e0261874cf6de27aae3301bbebe36486259dd0b13a0f8
7
+ data.tar.gz: 4f962781ce7204792bddf1d9c8730c089511207dee880aecf68a17c7e3185f83a713639eade5b33e10d7bd99f7d52a151e95cc685143e0d50e262674d23670fa
data/.circleci/config.yml CHANGED
@@ -3,37 +3,37 @@ version: 2.1
3
3
  executors:
4
4
  ruby_26:
5
5
  docker:
6
- - image: circleci/ruby:2.6-node
6
+ - image: cimg/ruby:2.6-node
7
7
  environment:
8
8
  MEMCACHED_HOST: '127.0.0.1:11211'
9
9
  REDIS_URL: 'redis://127.0.0.1:6379'
10
10
  DATABASE_URL: 'sqlite3::memory:'
11
11
  - image: memcached
12
12
  - image: redis
13
- - image: circleci/dynamodb
13
+ - image: amazon/dynamodb-local
14
14
  - image: minio/minio:latest
15
15
  command: ["server", "/data"]
16
16
  - image: s12v/sns
17
17
  - image: softwaremill/elasticmq-native
18
- - image: circleci/mongo:5-focal-ram
18
+ - image: mongo:5-focal
19
19
  ruby_27:
20
20
  docker:
21
- - image: circleci/ruby:2.7-node
21
+ - image: cimg/ruby:2.7-node
22
22
  environment:
23
23
  MEMCACHED_HOST: '127.0.0.1:11211'
24
24
  REDIS_URL: 'redis://127.0.0.1:6379'
25
25
  DATABASE_URL: 'sqlite3::memory:'
26
26
  - image: memcached
27
27
  - image: redis
28
- - image: circleci/dynamodb
28
+ - image: amazon/dynamodb-local
29
29
  - image: minio/minio:latest
30
30
  command: ["server", "/data"]
31
31
  - image: s12v/sns
32
32
  - image: softwaremill/elasticmq-native
33
- - image: circleci/mongo:5-focal-ram
33
+ - image: mongo:5-focal
34
34
  ruby_26_mysql2:
35
35
  docker:
36
- - image: circleci/ruby:2.6-node
36
+ - image: cimg/ruby:2.6-node
37
37
  environment:
38
38
  DATABASE_URL: "mysql2://root@127.0.0.1:3306/ci_test"
39
39
  - image: mariadb
@@ -46,7 +46,7 @@ executors:
46
46
  MYSQL_ROOT_HOST: '%'
47
47
  ruby_27_mysql2:
48
48
  docker:
49
- - image: circleci/ruby:2.7-node
49
+ - image: cimg/ruby:2.7-node
50
50
  environment:
51
51
  DATABASE_URL: "mysql2://root@127.0.0.1:3306/ci_test"
52
52
  - image: mariadb
@@ -59,7 +59,7 @@ executors:
59
59
  MYSQL_ROOT_HOST: '%'
60
60
  ruby_26_postgres:
61
61
  docker:
62
- - image: circleci/ruby:2.6-node
62
+ - image: cimg/ruby:2.6-node
63
63
  environment:
64
64
  DATABASE_URL: "postgres://postgres:test@127.0.0.1:5432/ci_test"
65
65
  - image: postgres
@@ -68,7 +68,7 @@ executors:
68
68
  POSTGRES_DB: 'ci_test'
69
69
  ruby_27_postgres:
70
70
  docker:
71
- - image: circleci/ruby:2.7-node
71
+ - image: cimg/ruby:2.7-node
72
72
  environment:
73
73
  DATABASE_URL: "postgres://postgres:test@127.0.0.1:5432/ci_test"
74
74
  - image: postgres
@@ -3,3 +3,6 @@ contact_links:
3
3
  - name: Instana Support Portal
4
4
  url: https://support.instana.com
5
5
  about: Please ask questions related to your installation there.
6
+ - name: Feature Requests
7
+  url: https://automation-management.ideas.ibm.com/?project=INSTANA
8
+  about: Please file feature requests there (or search for existing requests and vote for them). Do not use Github issues for feature requests.
@@ -0,0 +1,16 @@
1
+ name: Find signed commits
2
+ on:
3
+ pull_request_target:
4
+ branches:
5
+ - master # or the name of your main branch
6
+ jobs:
7
+ check-sign-off:
8
+ name: Write comment if unsigned commits found
9
+ env:
10
+ FORCE_COLOR: 1
11
+ runs-on: ubuntu-latest
12
+
13
+ steps:
14
+ - uses: live627/check-pr-signoff-action@v1
15
+ with:
16
+ token: ${{ secrets.GITHUB_TOKEN }}
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,86 @@
1
+ ## Contributing In General
2
+ Our project welcomes external contributions. If you have an itch, please feel
3
+ free to scratch it.
4
+
5
+ To contribute code or documentation, please submit a [pull request](https://github.com/instana/ruby-sensor/pulls).
6
+
7
+ A good way to familiarize yourself with the codebase and contribution process is
8
+ to look for and tackle low-hanging fruit in the [issue tracker](https://github.com/instana/ruby-sensor/issues).
9
+ <!--Before embarking on a more ambitious contribution, please quickly [get in touch](#communication) with us.-->
10
+
11
+ **Note: We appreciate your effort, and want to avoid a situation where a contribution
12
+ requires extensive rework (by you or by us), sits in backlog for a long time, or
13
+ cannot be accepted at all!**
14
+
15
+ ### Proposing new features
16
+
17
+ If you would like to implement a new feature, please [raise an issue](https://github.com/instana/ruby-sensor/issues)
18
+ before sending a pull request so the feature can be discussed. This is to avoid
19
+ you wasting your valuable time working on a feature that the project developers
20
+ are not interested in accepting into the code base.
21
+
22
+ ### Fixing bugs
23
+
24
+ If you would like to fix a bug, please [raise an issue](https://github.com/instana/ruby-sensor/issues) before sending a
25
+ pull request so it can be tracked.
26
+
27
+ ### Merge approval
28
+
29
+ The project maintainers use LGTM (Looks Good To Me) in comments on the code
30
+ review to indicate acceptance. A change requires LGTMs from two of the
31
+ maintainers of each component affected.
32
+
33
+ For a list of the maintainers, see the [MAINTAINERS.md](MAINTAINERS.md) page.
34
+
35
+ ## Legal
36
+
37
+ Each source file must include a license header for the MIT
38
+ License. Using the SPDX format is the simplest approach.
39
+ e.g.
40
+
41
+ ```
42
+ /*
43
+ Copyright <holder> All Rights Reserved.
44
+
45
+ SPDX-License-Identifier: MIT
46
+ */
47
+ ```
48
+
49
+ We have tried to make it as easy as possible to make contributions. This
50
+ applies to how we handle the legal aspects of contribution. We use the
51
+ same approach - the [Developer's Certificate of Origin 1.1 (DCO)](https://github.com/hyperledger/fabric/blob/master/docs/source/DCO1.1.txt) - that the Linux® Kernel [community](https://elinux.org/Developer_Certificate_Of_Origin)
52
+ uses to manage code contributions.
53
+
54
+ We simply ask that when submitting a patch for review, the developer
55
+ must include a sign-off statement in the commit message.
56
+
57
+ Here is an example Signed-off-by line, which indicates that the
58
+ submitter accepts the DCO:
59
+
60
+ ```
61
+ Signed-off-by: John Doe <john.doe@example.com>
62
+ ```
63
+
64
+ You can include this automatically when you commit a change to your
65
+ local git repository using the following command:
66
+
67
+ ```
68
+ git commit -s
69
+ ```
70
+
71
+ <!--
72
+ ## Communication
73
+ **FIXME** Please feel free to connect with us on our [Slack channel](link).
74
+
75
+ ## Setup
76
+ **FIXME** Please add any special setup instructions for your project to help the developer
77
+ become productive quickly.
78
+
79
+ ## Testing
80
+ **FIXME** Please provide information that helps the developer test any changes they make
81
+ before submitting.
82
+
83
+ ## Coding style guidelines
84
+ **FIXME** Optional, but recommended: please share any specific style guidelines you might
85
+ have for your project.
86
+ -->
data/Gemfile CHANGED
@@ -13,7 +13,10 @@ gem 'rubocop', '~> 1.9'
13
13
 
14
14
  # Rack v2 dropped support for Ruby 2.2 and higher.
15
15
  if RUBY_VERSION < '2.2'
16
- gem 'rack', '~> 1.6'
16
+ gem 'rack', '<3.0.0', '~> 1.6'
17
+ else
18
+ gem 'rack', '<3.0.0'
19
+ # gem 'rackup'
17
20
  end
18
21
  gem 'rack-test'
19
22
 
data/MAINTAINERS.md ADDED
@@ -0,0 +1,3 @@
1
+ # MAINTAINERS
2
+
3
+ [instana/eng-ruby](https://github.com/orgs/instana/teams/eng-ruby) can be reached with @instana/eng-ruby
@@ -5,6 +5,7 @@
5
5
 
6
6
  source "https://rubygems.org"
7
7
 
8
+ gem "rack", "<3.0.0"
8
9
  gem "rake"
9
10
  gem "minitest", "5.9.1"
10
11
  gem "minitest-reporters"
@@ -5,6 +5,7 @@
5
5
 
6
6
  source "https://rubygems.org"
7
7
 
8
+ gem "rack", "<3.0.0"
8
9
  gem "rake"
9
10
  gem "minitest", "5.9.1"
10
11
  gem "minitest-reporters"
@@ -5,6 +5,7 @@
5
5
 
6
6
  source "https://rubygems.org"
7
7
 
8
+ gem "rack", "<3.0.0"
8
9
  gem "rake"
9
10
  gem "minitest", "5.9.1"
10
11
  gem "minitest-reporters"
@@ -5,6 +5,7 @@
5
5
 
6
6
  source "https://rubygems.org"
7
7
 
8
+ gem "rack", "<3.0.0"
8
9
  gem "rake"
9
10
  gem "minitest", "5.9.1"
10
11
  gem "minitest-reporters"
@@ -13,6 +13,7 @@ gem "puma"
13
13
  gem "rubocop", "~> 1.9"
14
14
  gem "rack-test"
15
15
  gem "simplecov", "~> 0.21.2"
16
+ gem "mail", "< 2.8.0"
16
17
  gem "rails", ">= 5.0", "< 5.1"
17
18
  gem "mysql2", "0.4.10"
18
19
  gem "pg"
@@ -13,6 +13,7 @@ gem "puma"
13
13
  gem "rubocop", "~> 1.9"
14
14
  gem "rack-test"
15
15
  gem "simplecov", "~> 0.21.2"
16
+ gem "mail", "< 2.8.0"
16
17
  gem "rails", ">= 5.2", "< 6.0"
17
18
  gem "mysql2", "0.4.10"
18
19
  gem "pg"
@@ -13,6 +13,7 @@ gem "puma"
13
13
  gem "rubocop", "~> 1.9"
14
14
  gem "rack-test"
15
15
  gem "simplecov", "~> 0.21.2"
16
+ gem "mail", "< 2.8.0"
16
17
  gem "rails", ">= 6.0", "< 6.1"
17
18
  gem "mysql2", "0.4.10"
18
19
  gem "pg"
@@ -5,6 +5,7 @@
5
5
 
6
6
  source "https://rubygems.org"
7
7
 
8
+ gem "redis", "< 5.0.0"
8
9
  gem "rake"
9
10
  gem "minitest", "5.9.1"
10
11
  gem "minitest-reporters"
@@ -13,6 +14,6 @@ gem "puma"
13
14
  gem "rubocop", "~> 1.9"
14
15
  gem "rack-test"
15
16
  gem "simplecov", "~> 0.21.2"
16
- gem "resque", ">= 2.0", "< 3.0"
17
+ gem "resque", ">= 2.0", "< 2.3.0"
17
18
 
18
19
  gemspec path: "../"
@@ -5,6 +5,7 @@
5
5
 
6
6
  source "https://rubygems.org"
7
7
 
8
+ gem "rack", "<3.0.0"
8
9
  gem "rake"
9
10
  gem "minitest", "5.9.1"
10
11
  gem "minitest-reporters"
@@ -5,6 +5,7 @@
5
5
 
6
6
  source "https://rubygems.org"
7
7
 
8
+ gem "rack", "<3.0.0"
8
9
  gem "rake"
9
10
  gem "minitest", "5.9.1"
10
11
  gem "minitest-reporters"
@@ -5,6 +5,7 @@
5
5
 
6
6
  source "https://rubygems.org"
7
7
 
8
+ gem "rack", "<3.0.0"
8
9
  gem "rake"
9
10
  gem "minitest", "5.9.1"
10
11
  gem "minitest-reporters"
@@ -5,6 +5,7 @@
5
5
 
6
6
  source "https://rubygems.org"
7
7
 
8
+ gem "rack", "<3.0.0"
8
9
  gem "rake"
9
10
  gem "minitest", "5.9.1"
10
11
  gem "minitest-reporters"
@@ -5,7 +5,7 @@ module Instana
5
5
  module Activators
6
6
  class Sinatra < Activator
7
7
  def can_instrument?
8
- defined?(::Instana::Rack) && defined?(::Sinatra) && defined?(::Sinatra::Base)
8
+ defined?(::Instana::Rack) && defined?(::Sinatra) && defined?(::Sinatra::Base) && !::Sinatra::Base.middleware.nil?
9
9
  end
10
10
 
11
11
  def instrument
@@ -52,9 +52,15 @@ module Instana
52
52
  }.reject { |_, v| v.nil? }
53
53
  end
54
54
 
55
- # @return [Array] extra headers to include in the trace
55
+ # @return [Array] extra headers to capture with HTTP spans
56
56
  def extra_headers
57
- discovery_value['extraHeaders']
57
+ if discovery_value['tracing']
58
+ # Starting with discovery version 1.6.4, this value is in tracing.extra-http-headers.
59
+ discovery_value['tracing']['extra-http-headers']
60
+ else
61
+ # Legacy fallback for discovery versions <= 1.6.3.
62
+ discovery_value['extraHeaders']
63
+ end
58
64
  end
59
65
 
60
66
  # @return [Hash] values which are removed from urls sent to the backend
@@ -13,8 +13,7 @@ module Instana
13
13
  def call(env)
14
14
  req = InstrumentedRequest.new(env)
15
15
  kvs = {
16
- http: req.request_tags,
17
- service: ENV['INSTANA_SERVICE_NAME']
16
+ http: req.request_tags
18
17
  }.reject { |_, v| v.nil? }
19
18
 
20
19
  current_span = ::Instana.tracer.log_start_or_continue(:rack, {}, req.incoming_context)
@@ -69,9 +69,6 @@ module Instana
69
69
  kvs[:'resque-worker'] = {}
70
70
 
71
71
  begin
72
- if ENV.key?('INSTANA_SERVICE_NAME')
73
- kvs[:service] = ENV['INSTANA_SERVICE_NAME']
74
- end
75
72
  kvs[:'resque-worker'][:job] = job.payload['class'].to_s
76
73
  kvs[:'resque-worker'][:queue] = job.queue
77
74
  rescue => e
@@ -21,9 +21,9 @@ module Instana
21
21
  private
22
22
 
23
23
  def incomming_context_from(attributes)
24
- trace_id = try(attributes, 'X_INSTANA_T', 'X_INSTANA_ST')
25
- span_id = try(attributes, 'X_INSTANA_S', 'X_INSTANA_SS')
26
- level = try(attributes, 'X_INSTANA_L', 'X_INSTANA_SL')
24
+ trace_id = read_message_header(attributes, 'X_INSTANA_T')
25
+ span_id = read_message_header(attributes, 'X_INSTANA_S')
26
+ level = read_message_header(attributes, 'X_INSTANA_L')
27
27
 
28
28
  {
29
29
  trace_id: trace_id,
@@ -32,12 +32,8 @@ module Instana
32
32
  }.reject { |_, v| v.nil? }
33
33
  end
34
34
 
35
- def try(attributes, *args)
36
- key = args.detect do |a|
37
- attributes && attributes[a] && attributes[a].respond_to?(:string_value)
38
- end
39
-
40
- attributes[key].string_value if attributes && key
35
+ def read_message_header(attributes, key)
36
+ attributes[key].string_value if attributes && attributes[key] && attributes[key].respond_to?(:string_value)
41
37
  end
42
38
  end
43
39
  end
@@ -18,10 +18,6 @@ module Instana
18
18
  kv_payload[:'sidekiq-worker'][:'redis-url'] = "#{opts[:host]}:#{opts[:port]}"
19
19
  end
20
20
 
21
- if ENV.key?('INSTANA_SERVICE_NAME')
22
- kv_payload[:service] = ENV['INSTANA_SERVICE_NAME']
23
- end
24
-
25
21
  context = {}
26
22
  if msg.key?('X-Instana-T')
27
23
  trace_id = msg.delete('X-Instana-T')
@@ -180,11 +180,7 @@ module Instana
180
180
  self.current_span.set_tags(kvs)
181
181
  self.current_span.close
182
182
 
183
- if self.current_span.parent
184
- self.current_span = self.current_span.parent
185
- else
186
- self.current_span = nil
187
- end
183
+ self.current_span = self.current_span.parent || nil
188
184
  end
189
185
 
190
186
  # Closes out the current span in the current trace
@@ -55,6 +55,10 @@ module Instana
55
55
 
56
56
  @data[:data] = {}
57
57
 
58
+ if ENV.key?('INSTANA_SERVICE_NAME')
59
+ @data[:data][:service] = ENV['INSTANA_SERVICE_NAME']
60
+ end
61
+
58
62
  # Entity Source
59
63
  @data[:f] = ::Instana.agent.source
60
64
  # Start time
@@ -2,6 +2,6 @@
2
2
  # (c) Copyright Instana Inc. 2016
3
3
 
4
4
  module Instana
5
- VERSION = "1.209.1"
5
+ VERSION = "1.209.3"
6
6
  VERSION_FULL = "instana-#{VERSION}"
7
7
  end
@@ -45,6 +45,24 @@ class HostAgentTest < Minitest::Test
45
45
  assert_equal 1, subject.source[:e]
46
46
  end
47
47
 
48
+ def test_extra_headers_from_tracing_config
49
+ discovery = Concurrent::Atom.new(
50
+ {
51
+ 'tracing' => {
52
+ 'extra-http-headers' => ["X-Header-1", "X-Header-2"]
53
+ }
54
+ }
55
+ )
56
+ subject = Instana::Backend::HostAgent.new(discovery: discovery)
57
+ assert_equal ["X-Header-1", "X-Header-2"], subject.extra_headers
58
+ end
59
+
60
+ def test_extra_headers_legacy
61
+ discovery = Concurrent::Atom.new({'extraHeaders' => ["X-Header-3", "X-Header-4"]})
62
+ subject = Instana::Backend::HostAgent.new(discovery: discovery)
63
+ assert_equal ["X-Header-3", "X-Header-4"], subject.extra_headers
64
+ end
65
+
48
66
  def test_start
49
67
  subject = Instana::Backend::HostAgent.new
50
68
  assert subject.respond_to? :start
@@ -3,7 +3,13 @@
3
3
 
4
4
  require 'test_helper'
5
5
  require 'rack/test'
6
- require 'rack/lobster'
6
+
7
+ if Rack.release >= '3.0.0'
8
+ require 'rackup/lobster'
9
+ else
10
+ require 'rack/lobster'
11
+ end
12
+
7
13
  require "opentracing"
8
14
 
9
15
  module Instana
@@ -45,7 +51,11 @@ class OpenTracerTest < Minitest::Test
45
51
  use Rack::ShowExceptions
46
52
  use Instana::OTRack2
47
53
  map "/mrlobster" do
48
- run Rack::Lobster.new
54
+ if Rack.release >= '3.0.0'
55
+ run Rackup::Lobster.new
56
+ else
57
+ run Rack::Lobster.new
58
+ end
49
59
  end
50
60
  }
51
61
  end
@@ -162,4 +162,18 @@ class SpanTest < Minitest::Test
162
162
  assert_equal 0, metrics[:opened]
163
163
  assert_equal 0, metrics[:closed]
164
164
  end
165
+
166
+ def test_custom_service_name_set
167
+ service_name = 'MyVeryCustomRubyServiceNameForInstanaTesting'
168
+ ENV['INSTANA_SERVICE_NAME'] = service_name
169
+ span = Instana::Span.new(:excon)
170
+ assert_equal(service_name, span[:data][:service])
171
+ ensure
172
+ ENV.delete('INSTANA_SERVICE_NAME')
173
+ end
174
+
175
+ def test_no_custom_service_name_set
176
+ span = Instana::Span.new(:excon)
177
+ assert_nil(span[:data][:service])
178
+ end
165
179
  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.209.1
4
+ version: 1.209.3
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: 2022-04-25 00:00:00.000000000 Z
11
+ date: 2023-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -137,12 +137,15 @@ files:
137
137
  - ".fasterer.yml"
138
138
  - ".github/ISSUE_TEMPLATE/bug.yml"
139
139
  - ".github/ISSUE_TEMPLATE/config.yml"
140
+ - ".github/workflows/pr_commits_signed_off.yml"
140
141
  - ".gitignore"
141
142
  - ".rubocop.yml"
142
143
  - ".rubocop_todo.yml"
143
144
  - Appraisals
145
+ - CONTRIBUTING.md
144
146
  - Gemfile
145
147
  - LICENSE
148
+ - MAINTAINERS.md
146
149
  - README.md
147
150
  - Rakefile
148
151
  - bin/console
@@ -379,7 +382,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
379
382
  - !ruby/object:Gem::Version
380
383
  version: '0'
381
384
  requirements: []
382
- rubygems_version: 3.1.6
385
+ rubygems_version: 3.3.26
383
386
  signing_key:
384
387
  specification_version: 4
385
388
  summary: Ruby Distributed Tracing & Metrics Sensor for Instana