instana 1.193.4 → 1.193.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (157) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +7 -0
  3. data/Appraisals +3 -0
  4. data/Gemfile +3 -0
  5. data/LICENSE +2 -1
  6. data/Rakefile +3 -0
  7. data/benchmarks/10k-rack-traces.rb +3 -0
  8. data/benchmarks/Gemfile +4 -0
  9. data/benchmarks/id_generation.rb +4 -0
  10. data/benchmarks/opentracing.rb +4 -0
  11. data/benchmarks/rack_vanilla_vs_traced.rb +3 -0
  12. data/benchmarks/stackprof_rack_tracing.rb +3 -0
  13. data/benchmarks/time_processing.rb +4 -0
  14. data/bin/console +3 -0
  15. data/examples/opentracing.rb +4 -0
  16. data/examples/tracing.rb +4 -0
  17. data/extras/license_header.rb +44 -0
  18. data/gemfiles/cuba_30.gemfile +3 -0
  19. data/gemfiles/dalli_20.gemfile +3 -0
  20. data/gemfiles/excon_02.gemfile +3 -0
  21. data/gemfiles/graphql_10.gemfile +3 -0
  22. data/gemfiles/grpc_10.gemfile +3 -0
  23. data/gemfiles/net_http_01.gemfile +3 -0
  24. data/gemfiles/rack_16.gemfile +3 -0
  25. data/gemfiles/rack_20.gemfile +3 -0
  26. data/gemfiles/rails_42.gemfile +3 -0
  27. data/gemfiles/rails_50.gemfile +3 -0
  28. data/gemfiles/rails_52.gemfile +3 -0
  29. data/gemfiles/rails_60.gemfile +3 -0
  30. data/gemfiles/redis_40.gemfile +3 -0
  31. data/gemfiles/resque_122.gemfile +3 -0
  32. data/gemfiles/resque_20.gemfile +3 -0
  33. data/gemfiles/rest_client_16.gemfile +3 -0
  34. data/gemfiles/rest_client_20.gemfile +3 -0
  35. data/gemfiles/roda_20.gemfile +3 -0
  36. data/gemfiles/roda_30.gemfile +3 -0
  37. data/gemfiles/sidekiq_42.gemfile +3 -0
  38. data/gemfiles/sidekiq_50.gemfile +3 -0
  39. data/gemfiles/sinatra_14.gemfile +3 -0
  40. data/instana.gemspec +4 -0
  41. data/lib/instana.rb +3 -0
  42. data/lib/instana/activator.rb +3 -0
  43. data/lib/instana/activators/action_cable.rb +24 -0
  44. data/lib/instana/activators/action_controller_api.rb +3 -0
  45. data/lib/instana/activators/action_controller_base.rb +3 -0
  46. data/lib/instana/activators/action_view.rb +3 -0
  47. data/lib/instana/activators/active_record.rb +3 -0
  48. data/lib/instana/activators/cuba.rb +3 -0
  49. data/lib/instana/activators/dalli.rb +3 -0
  50. data/lib/instana/activators/excon.rb +3 -0
  51. data/lib/instana/activators/graphql.rb +3 -0
  52. data/lib/instana/activators/grpc_client.rb +3 -0
  53. data/lib/instana/activators/grpc_server.rb +3 -0
  54. data/lib/instana/activators/net_http.rb +3 -0
  55. data/lib/instana/activators/rack.rb +3 -0
  56. data/lib/instana/activators/rails.rb +3 -0
  57. data/lib/instana/activators/redis.rb +3 -0
  58. data/lib/instana/activators/resque_client.rb +3 -0
  59. data/lib/instana/activators/resque_worker.rb +3 -0
  60. data/lib/instana/activators/rest_client.rb +3 -0
  61. data/lib/instana/activators/roda.rb +3 -0
  62. data/lib/instana/activators/sidekiq_client.rb +3 -0
  63. data/lib/instana/activators/sidekiq_worker.rb +3 -0
  64. data/lib/instana/activators/sinatra.rb +3 -0
  65. data/lib/instana/agent.rb +3 -0
  66. data/lib/instana/agent/helpers.rb +3 -0
  67. data/lib/instana/agent/hooks.rb +3 -0
  68. data/lib/instana/agent/tasks.rb +3 -0
  69. data/lib/instana/base.rb +3 -0
  70. data/lib/instana/collector.rb +3 -0
  71. data/lib/instana/collectors/gc.rb +3 -0
  72. data/lib/instana/collectors/memory.rb +3 -0
  73. data/lib/instana/collectors/thread.rb +3 -0
  74. data/lib/instana/config.rb +3 -0
  75. data/lib/instana/frameworks/cuba.rb +3 -0
  76. data/lib/instana/frameworks/rails.rb +3 -0
  77. data/lib/instana/frameworks/roda.rb +3 -0
  78. data/lib/instana/frameworks/sinatra.rb +3 -0
  79. data/lib/instana/helpers.rb +3 -0
  80. data/lib/instana/instrumentation/action_cable.rb +53 -0
  81. data/lib/instana/instrumentation/action_controller.rb +3 -0
  82. data/lib/instana/instrumentation/action_view.rb +3 -0
  83. data/lib/instana/instrumentation/active_record.rb +3 -0
  84. data/lib/instana/instrumentation/dalli.rb +3 -0
  85. data/lib/instana/instrumentation/excon.rb +3 -0
  86. data/lib/instana/instrumentation/graphql.rb +3 -0
  87. data/lib/instana/instrumentation/grpc.rb +3 -0
  88. data/lib/instana/instrumentation/instrumented_request.rb +4 -0
  89. data/lib/instana/instrumentation/net-http.rb +3 -0
  90. data/lib/instana/instrumentation/rack.rb +3 -0
  91. data/lib/instana/instrumentation/redis.rb +3 -0
  92. data/lib/instana/instrumentation/resque.rb +3 -0
  93. data/lib/instana/instrumentation/rest-client.rb +3 -0
  94. data/lib/instana/instrumentation/sidekiq-client.rb +3 -0
  95. data/lib/instana/instrumentation/sidekiq-worker.rb +3 -0
  96. data/lib/instana/opentracing/carrier.rb +3 -0
  97. data/lib/instana/opentracing/tracer.rb +3 -0
  98. data/lib/instana/rack.rb +4 -0
  99. data/lib/instana/secrets.rb +3 -0
  100. data/lib/instana/setup.rb +3 -0
  101. data/lib/instana/thread_local.rb +3 -0
  102. data/lib/instana/tracer.rb +3 -0
  103. data/lib/instana/tracing/processor.rb +3 -0
  104. data/lib/instana/tracing/span.rb +3 -0
  105. data/lib/instana/tracing/span_context.rb +3 -0
  106. data/lib/instana/util.rb +3 -0
  107. data/lib/instana/version.rb +4 -1
  108. data/lib/oj_check.rb +3 -0
  109. data/lib/opentracing.rb +3 -0
  110. data/test/activator_test.rb +3 -0
  111. data/test/agent/agent_test.rb +3 -0
  112. data/test/benchmarks/bench_id_generation.rb +3 -0
  113. data/test/benchmarks/bench_opentracing.rb +3 -0
  114. data/test/config_test.rb +3 -0
  115. data/test/frameworks/cuba_test.rb +3 -0
  116. data/test/frameworks/roda_test.rb +4 -0
  117. data/test/frameworks/sinatra_test.rb +3 -0
  118. data/test/instana_test.rb +3 -0
  119. data/test/instrumentation/dalli_test.rb +3 -0
  120. data/test/instrumentation/excon_test.rb +3 -0
  121. data/test/instrumentation/graphql_test.rb +3 -0
  122. data/test/instrumentation/grpc_test.rb +3 -0
  123. data/test/instrumentation/net_http_test.rb +3 -0
  124. data/test/instrumentation/rack_instrumented_request_test.rb +3 -0
  125. data/test/instrumentation/rack_test.rb +3 -0
  126. data/test/instrumentation/rails_action_cable_test.rb +131 -0
  127. data/test/instrumentation/rails_action_controller_test.rb +3 -0
  128. data/test/instrumentation/rails_action_view_test.rb +3 -0
  129. data/test/instrumentation/rails_active_record_test.rb +3 -2
  130. data/test/instrumentation/redis_test.rb +3 -0
  131. data/test/instrumentation/resque_test.rb +3 -0
  132. data/test/instrumentation/rest_client_test.rb +3 -0
  133. data/test/instrumentation/sidekiq-client_test.rb +3 -0
  134. data/test/instrumentation/sidekiq-worker_test.rb +3 -0
  135. data/test/secrets_test.rb +3 -0
  136. data/test/support/apps/active_record/active_record.rb +3 -0
  137. data/test/support/apps/grpc/boot.rb +3 -0
  138. data/test/support/apps/grpc/grpc_server.rb +3 -0
  139. data/test/support/apps/http_endpoint/boot.rb +3 -0
  140. data/test/support/apps/rails/boot.rb +3 -0
  141. data/test/support/apps/rails/models/block.rb +3 -0
  142. data/test/support/apps/rails/models/block6.rb +3 -0
  143. data/test/support/apps/resque/boot.rb +3 -0
  144. data/test/support/apps/resque/jobs/resque_error_job.rb +3 -0
  145. data/test/support/apps/resque/jobs/resque_fast_job.rb +3 -0
  146. data/test/support/apps/sidekiq/boot.rb +4 -0
  147. data/test/support/apps/sidekiq/jobs/sidekiq_job_1.rb +3 -0
  148. data/test/support/apps/sidekiq/jobs/sidekiq_job_2.rb +3 -0
  149. data/test/support/apps/sidekiq/worker.rb +3 -0
  150. data/test/support/helpers.rb +3 -0
  151. data/test/test_helper.rb +3 -0
  152. data/test/tracing/custom_test.rb +3 -0
  153. data/test/tracing/id_management_test.rb +4 -0
  154. data/test/tracing/opentracing_test.rb +3 -0
  155. data/test/tracing/tracer_async_test.rb +3 -0
  156. data/test/tracing/tracer_test.rb +3 -0
  157. metadata +7 -2
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2021
3
+
1
4
  module Instana
2
5
  class Activator
3
6
  class << self
@@ -0,0 +1,24 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2021
3
+
4
+ module Instana
5
+ module Activators
6
+ class ActionCable < Activator
7
+ def can_instrument?
8
+ defined?(::ActionCable::Connection::Base) && defined?(::ActionCable::Channel::Base)
9
+ end
10
+
11
+ def instrument
12
+ require 'instana/instrumentation/action_cable'
13
+
14
+ ::ActionCable::Connection::Base
15
+ .prepend(Instana::Instrumentation::ActionCableConnection)
16
+
17
+ ::ActionCable::Channel::Base
18
+ .prepend(Instana::Instrumentation::ActionCableChannel)
19
+
20
+ true
21
+ end
22
+ end
23
+ end
24
+ end
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2021
3
+
1
4
  module Instana
2
5
  module Activators
3
6
  class ActionControllerAPI < Activator
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2021
3
+
1
4
  module Instana
2
5
  module Activators
3
6
  class ActionControllerBase < Activator
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2021
3
+
1
4
  module Instana
2
5
  module Activators
3
6
  class ActionView < Activator
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2021
3
+
1
4
  module Instana
2
5
  module Activators
3
6
  class ActiveRecord < Activator
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2021
3
+
1
4
  module Instana
2
5
  module Activators
3
6
  class Cuba < Activator
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2021
3
+
1
4
  module Instana
2
5
  module Activators
3
6
  class Dalli < Activator
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2021
3
+
1
4
  module Instana
2
5
  module Activators
3
6
  class Excon < Activator
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2021
3
+
1
4
  module Instana
2
5
  module Activators
3
6
  class Graphql < Activator
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2021
3
+
1
4
  module Instana
2
5
  module Activators
3
6
  class GrpcClient < Activator
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2021
3
+
1
4
  module Instana
2
5
  module Activators
3
6
  class GrpcServer < Activator
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2021
3
+
1
4
  module Instana
2
5
  module Activators
3
6
  class NetHTTP < Activator
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2021
3
+
1
4
  module Instana
2
5
  module Activators
3
6
  class Rack < Activator
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2021
3
+
1
4
  module Instana
2
5
  module Activators
3
6
  class Rails < Activator
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2021
3
+
1
4
  module Instana
2
5
  module Activators
3
6
  class Redis < Activator
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2021
3
+
1
4
  module Instana
2
5
  module Activators
3
6
  class ResqueClient < Activator
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2021
3
+
1
4
  module Instana
2
5
  module Activators
3
6
  class ResqueWorker < Activator
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2021
3
+
1
4
  module Instana
2
5
  module Activators
3
6
  class RestClient < Activator
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2021
3
+
1
4
  module Instana
2
5
  module Activators
3
6
  class Roda < Activator
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2021
3
+
1
4
  module Instana
2
5
  module Activators
3
6
  class SidekiqClient < Activator
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2021
3
+
1
4
  module Instana
2
5
  module Activators
3
6
  class SidekiqWorker < Activator
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2021
3
+
1
4
  module Instana
2
5
  module Activators
3
6
  class Sinatra < Activator
data/lib/instana/agent.rb CHANGED
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2016
3
+
1
4
  require 'net/http'
2
5
  require 'socket'
3
6
  require 'sys/proctable'
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2018
3
+
1
4
  module AgentHelpers
2
5
  # Attempts to determine if we're running inside a container.
3
6
  # The qualifications are:
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2018
3
+
1
4
  module AgentHooks
2
5
  # Used post fork to re-initialize state and restart communications with
3
6
  # the host agent.
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2018
3
+
1
4
  module AgentTasks
2
5
  # When request(s) are received by the host agent, it is sent here
3
6
  # for handling & processing.
data/lib/instana/base.rb CHANGED
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2016
3
+
1
4
  require "logger"
2
5
  require "instana/version"
3
6
  require "instana/util"
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2016
3
+
1
4
  module Instana
2
5
  class Collector
3
6
  attr_accessor :collectors
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2016
3
+
1
4
  module Instana
2
5
  module Collectors
3
6
  class GC
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2016
3
+
1
4
  require 'get_process_mem'
2
5
 
3
6
  module Instana
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2016
3
+
1
4
  module Instana
2
5
  module Collectors
3
6
  class Thread
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2016
3
+
1
4
  module Instana
2
5
  class Config
3
6
 
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2016
3
+
1
4
  require "instana/rack"
2
5
 
3
6
  module Instana
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2016
3
+
1
4
  if ::Rails::VERSION::MAJOR < 3
2
5
  ::Rails.configuration.after_initialize do
3
6
  # In Rails, let's use the Rails logger
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2016
3
+
1
4
  require "instana/rack"
2
5
 
3
6
  module Instana
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2016
3
+
1
4
  require "instana/rack"
2
5
 
3
6
  # This instrumentation will insert Rack into Sinatra _and_ Padrino since
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2016
3
+
1
4
  module Instana
2
5
  module Helpers
3
6
  EUM_SNIPPET= (File.read(File.dirname(__FILE__) + '/eum/eum.js.erb')).freeze
@@ -0,0 +1,53 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2021
3
+
4
+ module Instana
5
+ module Instrumentation
6
+ module ActionCableConnection
7
+ def instana_trace_context
8
+ @instana_trace_context
9
+ end
10
+
11
+ def process
12
+ @instana_trace_context ||= ::Instana.tracer.tracing? ? ::Instana.tracer.current_span.context : {}
13
+ super
14
+ end
15
+ end
16
+
17
+ module ActionCableChannel
18
+ def transmit(*args)
19
+ rpc_tags = {
20
+ service: ::Instana::Util.get_app_name,
21
+ rpc: {
22
+ flavor: :actioncable,
23
+ call: self.class.to_s,
24
+ call_type: :transmit,
25
+ host: Socket.gethostname
26
+ }
27
+ }
28
+
29
+ context = connection.instana_trace_context
30
+ ::Instana.tracer.start_or_continue_trace(:'rpc-server', rpc_tags, context) do
31
+ super(*args)
32
+ end
33
+ end
34
+
35
+ def dispatch_action(action, data)
36
+ rpc_tags = {
37
+ service: ::Instana::Util.get_app_name,
38
+ rpc: {
39
+ flavor: :actioncable,
40
+ call: "#{self.class}##{action}",
41
+ call_type: :action,
42
+ host: Socket.gethostname
43
+ }
44
+ }
45
+
46
+ context = connection.instana_trace_context
47
+ ::Instana.tracer.start_or_continue_trace(:'rpc-server', rpc_tags, context) do
48
+ super(action, data)
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2021
3
+
1
4
  module Instana
2
5
  module Instrumentation
3
6
  module ActionController
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2021
3
+
1
4
  module Instana
2
5
  module Instrumentation
3
6
  module ActionView
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2021
3
+
1
4
  module Instana
2
5
  module Instrumentation
3
6
  module ActiveRecord
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2017
3
+
1
4
  module Instana
2
5
  module Instrumentation
3
6
  module Dalli
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2016
3
+
1
4
  module Instana
2
5
  module Instrumentation
3
6
  class Excon < ::Excon::Middleware::Base
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2021
3
+
1
4
  module Instana
2
5
  module Instrumentation
3
6
  class GraphqlTracing < GraphQL::Tracing::PlatformTracing
@@ -1,3 +1,6 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2017
3
+
1
4
  call_types = [:request_response, :client_streamer, :server_streamer, :bidi_streamer]
2
5
 
3
6
  module Instana
@@ -1,5 +1,9 @@
1
1
  # Note: We really only need "cgi/util" here but Ruby 2.4.1 has an issue:
2
2
  # https://bugs.ruby-lang.org/issues/13539
3
+
4
+ # (c) Copyright IBM Corp. 2021
5
+ # (c) Copyright Instana Inc. 2021
6
+
3
7
  require 'cgi'
4
8
  require 'rack/request'
5
9