instana 1.11.3 → 1.11.8

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: 964de6b7e7cf62695558794bb80a056a87427f0fc67d6428eaaa1b3bd1e4d7f8
4
- data.tar.gz: d9f7d98a110ef3a73024f26050af10f1fde12dda500ec665dfe28062579577dd
3
+ metadata.gz: 03473a7a2f7e8a5306869674ff671f1d5b66804e41bd1f687c512a33c0b07f3c
4
+ data.tar.gz: aaf1ada0116589a5d33e1f74558a6c32801971e5f5f4e512be56ff6524ab447b
5
5
  SHA512:
6
- metadata.gz: bdb19c8b417c5d22918d3275a1bbfbe956ebd72b2672083b7045e941ea58dccf8d6fea00e5ec17ebf14a95de0e90ce68bbd936119d87f5632a824135f5afc722
7
- data.tar.gz: 145abd6cfb3c1c267a3099fe715db07fe8e6d64dd6a0c47a29d7923d90ddfac2b7b7770b229034ef3e5d8c2a8e3b873dacf6ec47e6795690b9dee9625d37c17a
6
+ metadata.gz: 6993a2dcb47b648445c97fea1017bcc9392f889270613078fd32fb2881365d88260ae0082e23eed6f32f9d111f67021dc9f2485f5cb4777b6317b7541352d40d
7
+ data.tar.gz: 5c8c34a422def00edda43e613899a59b99bae6c1cf1323d79c135703b1c6ab5d565ece30f8b8f0497e0ea79a7cf1585912c17ddf5e8c363cb33f792e6f7a6903
@@ -0,0 +1,168 @@
1
+ version: 2.1
2
+
3
+ # More about orbs: https://circleci.com/docs/2.0/using-orbs/
4
+ orbs:
5
+ ruby: circleci/ruby@1.1.2
6
+
7
+ commands:
8
+ prelim-deps:
9
+ steps:
10
+ - run:
11
+ name: Preliminary Dependencies
12
+ command: |
13
+ gem update --system
14
+ gem --version
15
+ gem install bundler
16
+ bundler --version
17
+ bundle config set path './vendor/bundle'
18
+
19
+ run-tests:
20
+ steps:
21
+ - run:
22
+ name: Run the Tests
23
+ command: |
24
+ bundle exec rake test
25
+
26
+ save-stan-cache:
27
+ parameters:
28
+ gemfile:
29
+ default: "Gemfile"
30
+ type: string
31
+ steps:
32
+ - save_cache:
33
+ key: gem-cache-v1-{{ arch }}-{{ .Branch }}-{{ checksum "<<parameters.gemfile>>" }}
34
+ paths:
35
+ - vendor/bundle
36
+
37
+ restore-stan-cache:
38
+ parameters:
39
+ gemfile:
40
+ default: "Gemfile"
41
+ type: string
42
+ steps:
43
+ - restore_cache:
44
+ keys:
45
+ - gem-cache-v1-{{ arch }}-{{ .Branch }}-{{ checksum "<<parameters.gemfile>>" }}
46
+ - gem-cache-v1-{{ arch }}-{{ .Branch }}
47
+ - gem-cache-v1
48
+
49
+ bundle-install:
50
+ parameters:
51
+ gemfile:
52
+ default: "Gemfile"
53
+ type: string
54
+ steps:
55
+ - restore-stan-cache:
56
+ gemfile: <<parameters.gemfile>>
57
+ - run:
58
+ name: Bundle Installation
59
+ command: |
60
+ bundle install
61
+ - save-stan-cache:
62
+ gemfile: <<parameters.gemfile>>
63
+
64
+ jobs:
65
+ ruby26:
66
+ parallelism: 3
67
+ docker:
68
+ - image: circleci/ruby:2.6.3-stretch-node
69
+ executor: ruby/default
70
+ environment:
71
+ BUNDLE_JOBS: "3"
72
+ BUNDLE_RETRY: "3"
73
+
74
+ steps:
75
+ - checkout
76
+ - prelim-deps
77
+ - bundle-install
78
+ - run-tests
79
+
80
+ rails50:
81
+ parallelism: 3
82
+ docker:
83
+ - image: circleci/ruby:2.6.3-stretch-node
84
+ - image: mariadb
85
+ environment:
86
+ MYSQL_DATABASE: 'travis_ci_test'
87
+ MYSQL_USER: 'root'
88
+ MYSQL_PASSWORD: ''
89
+ MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
90
+ MYSQL_ROOT_PASSWORD: ''
91
+ MYSQL_ROOT_HOST: '%'
92
+ executor: ruby/default
93
+ environment:
94
+ BUNDLE_JOBS: "3"
95
+ BUNDLE_RETRY: "3"
96
+ BUNDLE_GEMFILE: "./gemfiles/rails50.gemfile"
97
+
98
+ steps:
99
+ - checkout
100
+ - prelim-deps
101
+ - bundle-install:
102
+ gemfile: "./gemfiles/rails50.gemfile"
103
+ - run-tests
104
+
105
+ rails60:
106
+ parallelism: 3
107
+ docker:
108
+ - image: circleci/ruby:2.6.3-stretch-node
109
+ - image: mariadb
110
+ environment:
111
+ MYSQL_DATABASE: 'travis_ci_test'
112
+ MYSQL_USER: 'root'
113
+ MYSQL_PASSWORD: ''
114
+ MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
115
+ MYSQL_ROOT_PASSWORD: ''
116
+ MYSQL_ROOT_HOST: '%'
117
+ executor: ruby/default
118
+ environment:
119
+ BUNDLE_JOBS: "3"
120
+ BUNDLE_RETRY: "3"
121
+ BUNDLE_GEMFILE: "./gemfiles/rails60.gemfile"
122
+
123
+ steps:
124
+ - checkout
125
+ - prelim-deps
126
+ - bundle-install:
127
+ gemfile: "./gemfiles/rails60.gemfile"
128
+ - run-tests
129
+
130
+ libraries:
131
+ parallelism: 3
132
+ docker:
133
+ - image: circleci/ruby:2.6.3-stretch-node
134
+ - image: mariadb
135
+ environment:
136
+ MYSQL_DATABASE: 'travis_ci_test'
137
+ MYSQL_USER: 'root'
138
+ MYSQL_PASSWORD: ''
139
+ MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
140
+ MYSQL_ROOT_PASSWORD: ''
141
+ MYSQL_ROOT_HOST: '%'
142
+ - image: memcached
143
+ - image: postgres
144
+ environment:
145
+ POSTGRES_USER: 'stan'
146
+ POSTGRES_PASSWORD: 'stanlikesdata'
147
+ - image: redis
148
+ executor: ruby/default
149
+ environment:
150
+ BUNDLE_JOBS: "3"
151
+ BUNDLE_RETRY: "3"
152
+ BUNDLE_GEMFILE: "./gemfiles/libraries.gemfile"
153
+
154
+ steps:
155
+ - checkout
156
+ - prelim-deps
157
+ - bundle-install:
158
+ gemfile: "./gemfiles/libraries.gemfile"
159
+ - run-tests
160
+
161
+ workflows:
162
+ version: 2
163
+ whole-enchilada-MRI26:
164
+ jobs:
165
+ - ruby26
166
+ - rails50
167
+ - rails60
168
+ - libraries
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <div align="center">
2
- <img src="http://www.instana.com/wp-content/uploads/2016/11/Instana-Infrastructure-Map-1-1024x551.png"/>
2
+ <img src="https://disznc.s3.amazonaws.com/Ruby-Dashboard-2020-02-10-at-2.31.36-PM.png"/>
3
3
  </div>
4
4
 
5
5
  # Instana
data/Rakefile CHANGED
@@ -12,7 +12,11 @@ Rake::TestTask.new(:test) do |t|
12
12
 
13
13
  if ENV.key?('BUNDLE_GEMFILE')
14
14
  case File.basename(ENV['BUNDLE_GEMFILE']).split('.').first
15
- when /rails50/
15
+ when /rails6/
16
+ t.test_files = %w(test/frameworks/rails/activerecord_test.rb
17
+ test/frameworks/rails/actioncontroller_test.rb
18
+ test/frameworks/rails/actionview5_test.rb)
19
+ when /rails5/
16
20
  t.test_files = %w(test/frameworks/rails/activerecord_test.rb
17
21
  test/frameworks/rails/actioncontroller_test.rb
18
22
  test/frameworks/rails/actionview5_test.rb)
@@ -0,0 +1,72 @@
1
+ source 'https://rubygems.org'
2
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
+
4
+ # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
5
+ gem 'rails', '~> 6.0.2', '>= 6.0.2.1'
6
+ # Use sqlite3 as the database for Active Record
7
+ gem 'sqlite3', '~> 1.4'
8
+ # Use Puma as the app server
9
+ gem 'puma', '~> 4.1'
10
+ # Use SCSS for stylesheets
11
+ gem 'sass-rails', '>= 6'
12
+ # Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
13
+ gem 'webpacker', '~> 4.0'
14
+ # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
15
+ gem 'turbolinks', '~> 5'
16
+ # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
17
+ gem 'jbuilder', '~> 2.7'
18
+ # Use Redis adapter to run Action Cable in production
19
+ # gem 'redis', '~> 4.0'
20
+ # Use Active Model has_secure_password
21
+ # gem 'bcrypt', '~> 3.1.7'
22
+
23
+ gem 'mysql2', '0.4.10'
24
+
25
+ # Use Active Storage variant
26
+ # gem 'image_processing', '~> 1.2'
27
+
28
+ # Reduces boot times through caching; required in config/boot.rb
29
+ gem 'bootsnap', '>= 1.4.2', require: false
30
+
31
+ group :development, :test do
32
+ # Call 'byebug' anywhere in the code to stop execution and get a debugger console
33
+ gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
34
+ end
35
+
36
+ group :development do
37
+ # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
38
+ gem 'web-console', '>= 3.3.0'
39
+ gem 'listen', '>= 3.0.5', '< 3.2'
40
+ # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
41
+ gem 'spring'
42
+ gem 'spring-watcher-listen', '~> 2.0.0'
43
+ end
44
+
45
+ group :test do
46
+ # Adds support for Capybara system testing and selenium driver
47
+ gem 'capybara', '>= 2.15'
48
+ gem 'selenium-webdriver'
49
+ # Easy installation and use of web drivers to run system tests with browsers
50
+ gem 'webdrivers'
51
+ end
52
+
53
+ group :development, :test do
54
+ gem 'rake'
55
+ gem 'minitest', '5.9.1'
56
+ gem 'minitest-reporters'
57
+ gem 'minitest-debugger', :require => false
58
+ gem 'rack-test'
59
+ gem 'webmock'
60
+ # public_suffix dropped support for Ruby 2.1 and earlier.
61
+ gem 'public_suffix', '< 3.0'
62
+ end
63
+
64
+
65
+ # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
66
+ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
67
+
68
+ # Include the Instana Ruby gem's base set of gems
69
+ gemspec :path => File.expand_path(File.dirname(__FILE__) + '/../')
70
+
71
+
72
+ # vim:syntax=ruby
@@ -6,13 +6,13 @@ module Instana
6
6
  ::Instana::Util.method_alias(klass, :render_collection)
7
7
  end
8
8
 
9
- def render_partial_with_instana
9
+ def render_partial_with_instana(*args)
10
10
  kv_payload = { :render => {} }
11
11
  kv_payload[:render][:type] = :partial
12
12
  kv_payload[:render][:name] = @options[:partial].to_s if @options.is_a?(Hash)
13
13
 
14
14
  ::Instana.tracer.log_entry(:render, kv_payload)
15
- render_partial_without_instana
15
+ render_partial_without_instana(*args)
16
16
  rescue Exception => e
17
17
  ::Instana.tracer.log_error(e)
18
18
  raise
@@ -20,13 +20,13 @@ module Instana
20
20
  ::Instana.tracer.log_exit(:render)
21
21
  end
22
22
 
23
- def render_collection_with_instana
23
+ def render_collection_with_instana(*args)
24
24
  kv_payload = { :render => {} }
25
25
  kv_payload[:render][:type] = :collection
26
26
  kv_payload[:render][:name] = @path.to_s
27
27
 
28
28
  ::Instana.tracer.log_entry(:render, kv_payload)
29
- render_collection_without_instana
29
+ render_collection_without_instana(*args)
30
30
  rescue Exception => e
31
31
  ::Instana.tracer.log_error(e)
32
32
  raise
@@ -8,8 +8,9 @@ module Instana
8
8
  @app = app
9
9
  end
10
10
 
11
- def call(env)
12
- kvs = { :http => {} }
11
+ def collect_kvs(env)
12
+ kvs = {}
13
+ kvs[:http] = {}
13
14
  kvs[:http][:method] = env['REQUEST_METHOD']
14
15
  kvs[:http][:url] = ::CGI.unescape(env['PATH_INFO'])
15
16
 
@@ -37,15 +38,27 @@ module Instana
37
38
  end
38
39
  }
39
40
  end
41
+ return kvs
42
+ end
40
43
 
44
+ def call(env)
41
45
  # Check incoming context
42
46
  incoming_context = {}
43
47
  if env.key?('HTTP_X_INSTANA_T')
44
48
  incoming_context[:trace_id] = ::Instana::Util.header_to_id(env['HTTP_X_INSTANA_T'])
45
49
  incoming_context[:span_id] = ::Instana::Util.header_to_id(env['HTTP_X_INSTANA_S']) if env.key?('HTTP_X_INSTANA_S')
46
50
  incoming_context[:level] = env['HTTP_X_INSTANA_L'] if env.key?('HTTP_X_INSTANA_L')
51
+
52
+ # Honor X-Instana-L
53
+ if incoming_context[:level] and incoming_context[:level].length > 0
54
+ if incoming_context[:level][0] == "0"
55
+ return @app.call(env)
56
+ end
57
+ end
47
58
  end
48
59
 
60
+ kvs = collect_kvs(env)
61
+
49
62
  ::Instana.tracer.log_start_or_continue(:rack, {}, incoming_context)
50
63
 
51
64
  status, headers, response = @app.call(env)
@@ -78,8 +91,10 @@ module Instana
78
91
  # Set reponse headers; encode as hex string
79
92
  headers['X-Instana-T'] = ::Instana::Util.id_to_header(trace_id)
80
93
  headers['X-Instana-S'] = ::Instana::Util.id_to_header(span_id)
94
+ headers['X-Instana-L'] = '1'
95
+ headers['Server-Timing'] = "intid;desc=#{::Instana::Util.id_to_header(trace_id)}"
96
+ ::Instana.tracer.log_end(:rack, kvs)
81
97
  end
82
- ::Instana.tracer.log_end(:rack, kvs)
83
98
  end
84
99
  end
85
100
  end
@@ -1,47 +1,32 @@
1
- module Instana
2
- module Instrumentation
3
- class Redis
4
- def self.get_host(client)
5
- client.host
6
- end
7
-
8
- def self.get_port(client)
9
- client.port
10
- end
11
-
12
- def self.pipeline_command(pipeline)
13
- pipeline.is_a?(::Redis::Pipeline::Multi) ? 'MULTI' : 'PIPELINE'
14
- end
15
- end
16
- end
17
- end
18
-
19
1
  if defined?(::Redis) && ::Instana.config[:redis][:enabled]
20
2
  ::Redis::Client.class_eval do
21
3
  def call_with_instana(*args, &block)
22
4
  kv_payload = { redis: {} }
5
+ dnt_spans = [:redis, :'resque-client', :'sidekiq-client']
23
6
 
24
- if !Instana.tracer.tracing?
7
+ if !Instana.tracer.tracing? || dnt_spans.include?(::Instana.tracer.current_span.name)
25
8
  return call_without_instana(*args, &block)
26
9
  end
27
10
 
28
- host = ::Instana::Instrumentation::Redis.get_host(self)
29
- port = ::Instana::Instrumentation::Redis.get_port(self)
30
- kv_payload[:redis] = {
31
- connection: "#{host}:#{port}",
32
- db: db,
33
- command: args[0][0].to_s.upcase
34
- }
35
- ::Instana.tracer.log_entry(:redis, kv_payload)
11
+ begin
12
+ ::Instana.tracer.log_entry(:redis)
13
+
14
+ begin
15
+ kv_payload[:redis][:connection] = "#{self.host}:#{self.port}"
16
+ kv_payload[:redis][:db] = db.to_s
17
+ kv_payload[:redis][:command] = args[0][0].to_s.upcase
18
+ rescue
19
+ nil
20
+ end
36
21
 
37
- call_without_instana(*args, &block)
38
- rescue => e
39
- kv_payload[:redis][:error] = true
40
- ::Instana.tracer.log_info(kv_payload)
41
- ::Instana.tracer.log_error(e)
42
- raise
43
- ensure
44
- ::Instana.tracer.log_exit(:redis, {})
22
+ call_without_instana(*args, &block)
23
+ rescue => e
24
+ ::Instana.tracer.log_info({ redis: {error: true} })
25
+ ::Instana.tracer.log_error(e)
26
+ raise
27
+ ensure
28
+ ::Instana.tracer.log_exit(:redis, kv_payload)
29
+ end
45
30
  end
46
31
 
47
32
  ::Instana.logger.debug "Instrumenting Redis"
@@ -51,29 +36,32 @@ if defined?(::Redis) && ::Instana.config[:redis][:enabled]
51
36
 
52
37
  def call_pipeline_with_instana(*args, &block)
53
38
  kv_payload = { redis: {} }
39
+ dnt_spans = [:redis, :'resque-client', :'sidekiq-client']
54
40
 
55
- if !Instana.tracer.tracing?
41
+ if !Instana.tracer.tracing? || dnt_spans.include?(::Instana.tracer.current_span.name)
56
42
  return call_pipeline_without_instana(*args, &block)
57
43
  end
58
44
 
59
- pipeline = args.first
60
- host = ::Instana::Instrumentation::Redis.get_host(self)
61
- port = ::Instana::Instrumentation::Redis.get_port(self)
62
- kv_payload[:redis] = {
63
- connection: "#{host}:#{port}",
64
- db: db,
65
- command: ::Instana::Instrumentation::Redis.pipeline_command(pipeline)
66
- }
67
- ::Instana.tracer.log_entry(:redis, kv_payload)
45
+ begin
46
+ ::Instana.tracer.log_entry(:redis)
47
+
48
+ pipeline = args.first
49
+ begin
50
+ kv_payload[:redis][:connection] = "#{self.host}:#{self.port}"
51
+ kv_payload[:redis][:db] = db.to_s
52
+ kv_payload[:redis][:command] = pipeline.is_a?(::Redis::Pipeline::Multi) ? 'MULTI' : 'PIPELINE'
53
+ rescue
54
+ nil
55
+ end
68
56
 
69
- call_pipeline_without_instana(*args, &block)
70
- rescue => e
71
- kv_payload[:redis][:error] = true
72
- ::Instana.tracer.log_info(kv_payload)
73
- ::Instana.tracer.log_error(e)
74
- raise
75
- ensure
76
- ::Instana.tracer.log_exit(:redis, {})
57
+ call_pipeline_without_instana(*args, &block)
58
+ rescue => e
59
+ ::Instana.tracer.log_info({ redis: {error: true} })
60
+ ::Instana.tracer.log_error(e)
61
+ raise
62
+ ensure
63
+ ::Instana.tracer.log_exit(:redis, kv_payload)
64
+ end
77
65
  end
78
66
 
79
67
  alias call_pipeline_without_instana call_pipeline