instana 1.193.2 → 1.193.3.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +194 -133
  3. data/.gitignore +2 -0
  4. data/.rubocop.yml +5 -1147
  5. data/.rubocop_todo.yml +1140 -0
  6. data/Appraisals +96 -0
  7. data/Gemfile +11 -32
  8. data/Rakefile +16 -39
  9. data/bin/console +5 -4
  10. data/gemfiles/.bundle/config +1 -2
  11. data/gemfiles/cuba_30.gemfile +14 -0
  12. data/gemfiles/dalli_20.gemfile +14 -0
  13. data/gemfiles/excon_02.gemfile +14 -0
  14. data/gemfiles/graphql_10.gemfile +14 -0
  15. data/gemfiles/grpc_10.gemfile +14 -0
  16. data/gemfiles/net_http_01.gemfile +13 -0
  17. data/gemfiles/rack_16.gemfile +14 -0
  18. data/gemfiles/rack_20.gemfile +14 -0
  19. data/gemfiles/rails_42.gemfile +16 -0
  20. data/gemfiles/rails_50.gemfile +16 -0
  21. data/gemfiles/rails_52.gemfile +16 -0
  22. data/gemfiles/rails_60.gemfile +16 -0
  23. data/gemfiles/redis_40.gemfile +14 -0
  24. data/gemfiles/resque_122.gemfile +15 -0
  25. data/gemfiles/resque_20.gemfile +14 -0
  26. data/gemfiles/rest_client_16.gemfile +14 -0
  27. data/gemfiles/rest_client_20.gemfile +14 -0
  28. data/gemfiles/roda_20.gemfile +14 -0
  29. data/gemfiles/roda_30.gemfile +14 -0
  30. data/gemfiles/sidekiq_42.gemfile +14 -0
  31. data/gemfiles/sidekiq_50.gemfile +14 -0
  32. data/gemfiles/sinatra_14.gemfile +14 -0
  33. data/instana.gemspec +1 -7
  34. data/lib/instana/activator.rb +41 -0
  35. data/lib/instana/activators/cuba.rb +18 -0
  36. data/lib/instana/activators/dalli.rb +20 -0
  37. data/lib/instana/activators/excon.rb +17 -0
  38. data/lib/instana/activators/graphql.rb +19 -0
  39. data/lib/instana/activators/grpc_client.rb +17 -0
  40. data/lib/instana/activators/grpc_server.rb +17 -0
  41. data/lib/instana/activators/net_http.rb +17 -0
  42. data/lib/instana/activators/rack.rb +13 -0
  43. data/lib/instana/activators/rails.rb +15 -0
  44. data/lib/instana/activators/redis.rb +17 -0
  45. data/lib/instana/activators/resque_client.rb +18 -0
  46. data/lib/instana/activators/resque_worker.rb +30 -0
  47. data/lib/instana/activators/rest_client.rb +17 -0
  48. data/lib/instana/activators/roda.rb +18 -0
  49. data/lib/instana/activators/sidekiq_client.rb +21 -0
  50. data/lib/instana/activators/sidekiq_worker.rb +21 -0
  51. data/lib/instana/activators/sinatra.rb +18 -0
  52. data/lib/instana/frameworks/cuba.rb +6 -13
  53. data/lib/instana/frameworks/rails.rb +0 -1
  54. data/lib/instana/frameworks/roda.rb +7 -13
  55. data/lib/instana/frameworks/sinatra.rb +1 -8
  56. data/lib/instana/instrumentation/dalli.rb +0 -6
  57. data/lib/instana/instrumentation/excon.rb +51 -57
  58. data/lib/instana/instrumentation/graphql.rb +16 -18
  59. data/lib/instana/instrumentation/grpc.rb +4 -10
  60. data/lib/instana/instrumentation/instrumented_request.rb +2 -1
  61. data/lib/instana/instrumentation/net-http.rb +2 -5
  62. data/lib/instana/instrumentation/rack.rb +1 -0
  63. data/lib/instana/instrumentation/redis.rb +0 -5
  64. data/lib/instana/instrumentation/resque.rb +0 -25
  65. data/lib/instana/instrumentation/rest-client.rb +0 -5
  66. data/lib/instana/instrumentation/sidekiq-client.rb +0 -9
  67. data/lib/instana/instrumentation/sidekiq-worker.rb +0 -9
  68. data/lib/instana/setup.rb +3 -1
  69. data/lib/instana/version.rb +1 -1
  70. data/test/activator_test.rb +27 -0
  71. data/test/frameworks/cuba_test.rb +38 -40
  72. data/test/frameworks/rails/activerecord_test.rb +13 -13
  73. data/test/frameworks/rails_test.rb +15 -0
  74. data/test/frameworks/roda_test.rb +39 -41
  75. data/test/frameworks/sinatra_test.rb +61 -64
  76. data/test/instrumentation/excon_test.rb +1 -0
  77. data/test/instrumentation/grpc_test.rb +2 -1
  78. data/test/instrumentation/{net-http_test.rb → net_http_test.rb} +1 -0
  79. data/test/instrumentation/{instrumented_request_test.rb → rack_instrumented_request_test.rb} +1 -1
  80. data/test/{frameworks → instrumentation}/rack_test.rb +0 -1
  81. data/test/instrumentation/resque_test.rb +3 -11
  82. data/test/instrumentation/{rest-client_test.rb → rest_client_test.rb} +6 -0
  83. data/test/instrumentation/sidekiq-client_test.rb +1 -0
  84. data/test/instrumentation/sidekiq-worker_test.rb +1 -0
  85. data/test/{servers/grpc_50051.rb → support/apps/grpc/boot.rb} +1 -1
  86. data/test/{apps → support/apps/grpc}/grpc_server.rb +0 -0
  87. data/test/{servers/rackapp_6511.rb → support/apps/http_endpoint/boot.rb} +0 -0
  88. data/test/{servers/rails_3205.rb → support/apps/rails/boot.rb} +8 -14
  89. data/test/{models → support/apps/rails/models}/block.rb +1 -1
  90. data/test/{models → support/apps/rails/models}/block6.rb +0 -0
  91. data/test/support/apps/resque/boot.rb +2 -0
  92. data/test/{jobs → support/apps/resque/jobs}/resque_error_job.rb +0 -0
  93. data/test/{jobs → support/apps/resque/jobs}/resque_fast_job.rb +0 -0
  94. data/test/support/apps/sidekiq/boot.rb +21 -0
  95. data/test/{jobs → support/apps/sidekiq/jobs}/sidekiq_job_1.rb +0 -0
  96. data/test/{jobs → support/apps/sidekiq/jobs}/sidekiq_job_2.rb +0 -0
  97. data/test/{servers → support/apps}/sidekiq/worker.rb +2 -2
  98. data/test/support/helpers.rb +94 -0
  99. data/test/test_helper.rb +24 -138
  100. metadata +89 -81
  101. data/gemfiles/libraries.gemfile +0 -73
  102. data/gemfiles/rails32.gemfile +0 -51
  103. data/gemfiles/rails42.gemfile +0 -50
  104. data/gemfiles/rails50.gemfile +0 -52
  105. data/gemfiles/rails52.gemfile +0 -52
  106. data/gemfiles/rails60.gemfile +0 -72
  107. data/lib/instana/instrumentation.rb +0 -25
  108. data/lib/instana/test.rb +0 -43
  109. data/test/apps/cuba.rb +0 -19
  110. data/test/apps/roda.rb +0 -13
  111. data/test/apps/sinatra.rb +0 -9
  112. data/test/servers/helpers/sidekiq_worker_initializer.rb +0 -27
@@ -0,0 +1,15 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rake"
6
+ gem "minitest", "5.9.1"
7
+ gem "minitest-reporters"
8
+ gem "webmock"
9
+ gem "puma"
10
+ gem "rack-test"
11
+ gem "simplecov", "~> 0.21.2"
12
+ gem "resque", ">= 1.22", "< 2.0"
13
+ gem "redis", "~> 3.3", ">= 3.3.5"
14
+
15
+ gemspec path: "../"
@@ -0,0 +1,14 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rake"
6
+ gem "minitest", "5.9.1"
7
+ gem "minitest-reporters"
8
+ gem "webmock"
9
+ gem "puma"
10
+ gem "rack-test"
11
+ gem "simplecov", "~> 0.21.2"
12
+ gem "resque", ">= 2.0", "< 3.0"
13
+
14
+ gemspec path: "../"
@@ -0,0 +1,14 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rake"
6
+ gem "minitest", "5.9.1"
7
+ gem "minitest-reporters"
8
+ gem "webmock"
9
+ gem "puma"
10
+ gem "rack-test"
11
+ gem "simplecov", "~> 0.21.2"
12
+ gem "rest-client", ">= 1.6", "< 2.0"
13
+
14
+ gemspec path: "../"
@@ -0,0 +1,14 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rake"
6
+ gem "minitest", "5.9.1"
7
+ gem "minitest-reporters"
8
+ gem "webmock"
9
+ gem "puma"
10
+ gem "rack-test"
11
+ gem "simplecov", "~> 0.21.2"
12
+ gem "rest-client", ">= 2.0", "< 3.0"
13
+
14
+ gemspec path: "../"
@@ -0,0 +1,14 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rake"
6
+ gem "minitest", "5.9.1"
7
+ gem "minitest-reporters"
8
+ gem "webmock"
9
+ gem "puma"
10
+ gem "rack-test"
11
+ gem "simplecov", "~> 0.21.2"
12
+ gem "roda", ">= 2.0", "< 3.0"
13
+
14
+ gemspec path: "../"
@@ -0,0 +1,14 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rake"
6
+ gem "minitest", "5.9.1"
7
+ gem "minitest-reporters"
8
+ gem "webmock"
9
+ gem "puma"
10
+ gem "rack-test"
11
+ gem "simplecov", "~> 0.21.2"
12
+ gem "roda", ">= 3.0", "< 4.0"
13
+
14
+ gemspec path: "../"
@@ -0,0 +1,14 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rake"
6
+ gem "minitest", "5.9.1"
7
+ gem "minitest-reporters"
8
+ gem "webmock"
9
+ gem "puma"
10
+ gem "rack-test"
11
+ gem "simplecov", "~> 0.21.2"
12
+ gem "sidekiq", "~> 4.2.10"
13
+
14
+ gemspec path: "../"
@@ -0,0 +1,14 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rake"
6
+ gem "minitest", "5.9.1"
7
+ gem "minitest-reporters"
8
+ gem "webmock"
9
+ gem "puma"
10
+ gem "rack-test"
11
+ gem "simplecov", "~> 0.21.2"
12
+ gem "sidekiq", ">= 5.0", "< 6.0"
13
+
14
+ gemspec path: "../"
@@ -0,0 +1,14 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rake"
6
+ gem "minitest", "5.9.1"
7
+ gem "minitest-reporters"
8
+ gem "webmock"
9
+ gem "puma"
10
+ gem "rack-test"
11
+ gem "simplecov", "~> 0.21.2"
12
+ gem "sinatra", "1.4.7"
13
+
14
+ gemspec path: "../"
data/instana.gemspec CHANGED
@@ -33,13 +33,7 @@ Gem::Specification.new do |spec|
33
33
  spec.add_development_dependency "bundler", "~> 2.0"
34
34
  spec.add_development_dependency "rake", "~> 10.0"
35
35
  spec.add_development_dependency "minitest", "~> 5.0"
36
- spec.add_development_dependency('pry', '>= 0.10.0')
37
-
38
- # Development debugging
39
- unless RUBY_PLATFORM =~ /java/i
40
- spec.add_development_dependency('byebug', '>= 8.0.0')
41
- spec.add_development_dependency('pry-byebug', '>= 3.0.0')
42
- end
36
+ spec.add_development_dependency "appraisal"
43
37
 
44
38
  spec.add_runtime_dependency('sys-proctable', '>= 1.2.2')
45
39
  spec.add_runtime_dependency('get_process_mem', '>= 0.2.1')
@@ -0,0 +1,41 @@
1
+ module Instana
2
+ class Activator
3
+ class << self
4
+ attr_reader :trace_point, :activators
5
+
6
+ def start
7
+ @trace_point = TracePoint.new(:end) do
8
+ activated = ::Instana::Activator.call
9
+ ::Instana.logger.debug { "Activated #{activated.join(', ')}" } unless activated.empty?
10
+ end
11
+
12
+ @trace_point.enable if enabled?
13
+ end
14
+
15
+ def call
16
+ @activators ||= []
17
+ activated, @activators = @activators.partition(&:call)
18
+ activated
19
+ end
20
+
21
+ def inherited(subclass)
22
+ super(subclass)
23
+
24
+ @activators ||= []
25
+ @activators << subclass.new
26
+ end
27
+
28
+ private
29
+
30
+ def enabled?
31
+ ENV.fetch('INSTANA_DISABLE_AUTO_INSTR', 'false').eql?('false') || !ENV.key?('INSTANA_DISABLE')
32
+ end
33
+ end
34
+
35
+ def call
36
+ instrument if can_instrument?
37
+ end
38
+ end
39
+ end
40
+
41
+ Dir["#{__dir__}/activators/*.rb"].sort.each { |f| require(f) }
@@ -0,0 +1,18 @@
1
+ module Instana
2
+ module Activators
3
+ class Cuba < Activator
4
+ def can_instrument?
5
+ defined?(::Instana::Rack) && defined?(::Cuba)
6
+ end
7
+
8
+ def instrument
9
+ require 'instana/frameworks/cuba'
10
+
11
+ ::Cuba.use ::Instana::Rack
12
+ ::Cuba.prepend ::Instana::CubaPathTemplateExtractor
13
+
14
+ true
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,20 @@
1
+ module Instana
2
+ module Activators
3
+ class Dalli < Activator
4
+ def can_instrument?
5
+ defined?(::Dalli::Client) &&
6
+ defined?(::Dalli::Server) &&
7
+ Instana.config[:dalli][:enabled]
8
+ end
9
+
10
+ def instrument
11
+ require 'instana/instrumentation/dalli'
12
+
13
+ ::Dalli::Client.prepend ::Instana::Instrumentation::Dalli
14
+ ::Dalli::Server.prepend ::Instana::Instrumentation::DalliServer
15
+
16
+ true
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,17 @@
1
+ module Instana
2
+ module Activators
3
+ class Excon < Activator
4
+ def can_instrument?
5
+ defined?(::Excon) && Instana.config[:excon][:enabled]
6
+ end
7
+
8
+ def instrument
9
+ require 'instana/instrumentation/excon'
10
+
11
+ ::Excon.defaults[:middlewares].unshift(::Instana::Instrumentation::Excon)
12
+
13
+ true
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,19 @@
1
+ module Instana
2
+ module Activators
3
+ class Graphql < Activator
4
+ def can_instrument?
5
+ defined?(::GraphQL::Schema) &&
6
+ defined?(GraphQL::Tracing::PlatformTracing) &&
7
+ Instana.config[:graphql][:enabled]
8
+ end
9
+
10
+ def instrument
11
+ require 'instana/instrumentation/graphql'
12
+
13
+ ::GraphQL::Schema.use(::Instana::Instrumentation::GraphqlTracing)
14
+
15
+ true
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,17 @@
1
+ module Instana
2
+ module Activators
3
+ class GrpcClient < Activator
4
+ def can_instrument?
5
+ defined?(::GRPC::ActiveCall) && ::Instana.config[:grpc][:enabled]
6
+ end
7
+
8
+ def instrument
9
+ require 'instana/instrumentation/grpc'
10
+
11
+ ::GRPC::ClientStub.prepend(::Instana::Instrumentation::GRPCCientInstrumentation)
12
+
13
+ true
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ module Instana
2
+ module Activators
3
+ class GrpcServer < Activator
4
+ def can_instrument?
5
+ defined?(::GRPC::RpcDesc) && ::Instana.config[:grpc][:enabled]
6
+ end
7
+
8
+ def instrument
9
+ require 'instana/instrumentation/grpc'
10
+
11
+ ::GRPC::RpcDesc.prepend(::Instana::Instrumentation::GRPCServerInstrumentation)
12
+
13
+ true
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ module Instana
2
+ module Activators
3
+ class NetHTTP < Activator
4
+ def can_instrument?
5
+ defined?(::Net::HTTP) && ::Instana.config[:nethttp][:enabled]
6
+ end
7
+
8
+ def instrument
9
+ require 'instana/instrumentation/net-http'
10
+
11
+ ::Net::HTTP.prepend(::Instana::Instrumentation::NetHTTPInstrumentation)
12
+
13
+ true
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,13 @@
1
+ module Instana
2
+ module Activators
3
+ class Rack < Activator
4
+ def can_instrument?
5
+ defined?(::Rack)
6
+ end
7
+
8
+ def instrument
9
+ require 'instana/instrumentation/rack'
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,15 @@
1
+ module Instana
2
+ module Activators
3
+ class Rails < Activator
4
+ def can_instrument?
5
+ defined?(::Instana::Rack) &&
6
+ defined?(::Rails) &&
7
+ defined?(::Rails::VERSION)
8
+ end
9
+
10
+ def instrument
11
+ require 'instana/frameworks/rails'
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,17 @@
1
+ module Instana
2
+ module Activators
3
+ class Redis < Activator
4
+ def can_instrument?
5
+ defined?(::Redis) && ::Instana.config[:redis][:enabled]
6
+ end
7
+
8
+ def instrument
9
+ require 'instana/instrumentation/redis'
10
+
11
+ ::Redis::Client.prepend(::Instana::RedisInstrumentation)
12
+
13
+ true
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,18 @@
1
+ module Instana
2
+ module Activators
3
+ class ResqueClient < Activator
4
+ def can_instrument?
5
+ defined?(::Resque) &&
6
+ ::Instana.config[:'resque-client'][:enabled]
7
+ end
8
+
9
+ def instrument
10
+ require 'instana/instrumentation/resque'
11
+
12
+ ::Resque.prepend(::Instana::Instrumentation::ResqueClient)
13
+
14
+ true
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,30 @@
1
+ module Instana
2
+ module Activators
3
+ class ResqueWorker < Activator
4
+ def can_instrument?
5
+ defined?(::Resque::Worker) &&
6
+ defined?(::Resque::Job) &&
7
+ ::Instana.config[:'resque-worker'][:enabled]
8
+ end
9
+
10
+ def instrument
11
+ require 'instana/instrumentation/resque'
12
+
13
+ ::Resque::Worker.prepend(::Instana::Instrumentation::ResqueWorker)
14
+ ::Resque::Job.prepend(::Instana::Instrumentation::ResqueJob)
15
+
16
+ ::Resque.before_fork do |_job|
17
+ ::Instana.agent.before_resque_fork
18
+ end
19
+ ::Resque.after_fork do |_job|
20
+ ::Instana.agent.after_resque_fork
21
+ end
22
+
23
+ # Set this so we assure that any remaining collected traces are reported at_exit
24
+ ENV['RUN_AT_EXIT_HOOKS'] = "1"
25
+
26
+ true
27
+ end
28
+ end
29
+ end
30
+ end