ddtrace 0.38.0 → 0.39.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/Appraisals +29 -5
  3. data/CHANGELOG.md +31 -1
  4. data/Rakefile +69 -66
  5. data/docs/GettingStarted.md +85 -50
  6. data/lib/ddtrace.rb +1 -0
  7. data/lib/ddtrace/configuration/settings.rb +9 -3
  8. data/lib/ddtrace/contrib/action_cable/configuration/settings.rb +7 -2
  9. data/lib/ddtrace/contrib/action_cable/ext.rb +5 -2
  10. data/lib/ddtrace/contrib/action_pack/action_controller/instrumentation.rb +7 -0
  11. data/lib/ddtrace/contrib/action_pack/configuration/settings.rb +7 -2
  12. data/lib/ddtrace/contrib/action_pack/ext.rb +5 -2
  13. data/lib/ddtrace/contrib/action_view/configuration/settings.rb +7 -2
  14. data/lib/ddtrace/contrib/action_view/ext.rb +5 -2
  15. data/lib/ddtrace/contrib/active_model_serializers/configuration/settings.rb +7 -2
  16. data/lib/ddtrace/contrib/active_model_serializers/ext.rb +5 -2
  17. data/lib/ddtrace/contrib/active_record/configuration/settings.rb +7 -2
  18. data/lib/ddtrace/contrib/active_record/ext.rb +5 -2
  19. data/lib/ddtrace/contrib/active_support/configuration/settings.rb +7 -2
  20. data/lib/ddtrace/contrib/active_support/ext.rb +5 -2
  21. data/lib/ddtrace/contrib/aws/configuration/settings.rb +7 -2
  22. data/lib/ddtrace/contrib/aws/ext.rb +5 -2
  23. data/lib/ddtrace/contrib/concurrent_ruby/configuration/settings.rb +5 -0
  24. data/lib/ddtrace/contrib/concurrent_ruby/ext.rb +1 -0
  25. data/lib/ddtrace/contrib/configuration/settings.rb +1 -0
  26. data/lib/ddtrace/contrib/dalli/configuration/settings.rb +7 -2
  27. data/lib/ddtrace/contrib/dalli/ext.rb +5 -2
  28. data/lib/ddtrace/contrib/delayed_job/configuration/settings.rb +7 -2
  29. data/lib/ddtrace/contrib/delayed_job/ext.rb +5 -2
  30. data/lib/ddtrace/contrib/elasticsearch/configuration/settings.rb +7 -2
  31. data/lib/ddtrace/contrib/elasticsearch/ext.rb +5 -2
  32. data/lib/ddtrace/contrib/ethon/configuration/settings.rb +7 -2
  33. data/lib/ddtrace/contrib/ethon/ext.rb +5 -2
  34. data/lib/ddtrace/contrib/excon/configuration/settings.rb +7 -2
  35. data/lib/ddtrace/contrib/excon/ext.rb +5 -2
  36. data/lib/ddtrace/contrib/extensions.rb +1 -1
  37. data/lib/ddtrace/contrib/faraday/configuration/settings.rb +7 -2
  38. data/lib/ddtrace/contrib/faraday/ext.rb +5 -2
  39. data/lib/ddtrace/contrib/faraday/patcher.rb +12 -3
  40. data/lib/ddtrace/contrib/grape/configuration/settings.rb +7 -3
  41. data/lib/ddtrace/contrib/grape/ext.rb +5 -2
  42. data/lib/ddtrace/contrib/graphql/configuration/settings.rb +7 -2
  43. data/lib/ddtrace/contrib/graphql/ext.rb +5 -2
  44. data/lib/ddtrace/contrib/grpc/configuration/settings.rb +7 -2
  45. data/lib/ddtrace/contrib/grpc/ext.rb +5 -2
  46. data/lib/ddtrace/contrib/http/configuration/settings.rb +7 -2
  47. data/lib/ddtrace/contrib/http/ext.rb +5 -2
  48. data/lib/ddtrace/contrib/httprb/configuration/settings.rb +7 -2
  49. data/lib/ddtrace/contrib/httprb/ext.rb +5 -2
  50. data/lib/ddtrace/contrib/httprb/instrumentation.rb +3 -6
  51. data/lib/ddtrace/contrib/kafka/configuration/settings.rb +7 -2
  52. data/lib/ddtrace/contrib/kafka/ext.rb +5 -2
  53. data/lib/ddtrace/contrib/mongodb/configuration/settings.rb +7 -2
  54. data/lib/ddtrace/contrib/mongodb/ext.rb +5 -2
  55. data/lib/ddtrace/contrib/mysql2/configuration/settings.rb +7 -2
  56. data/lib/ddtrace/contrib/mysql2/ext.rb +5 -2
  57. data/lib/ddtrace/contrib/presto/configuration/settings.rb +7 -2
  58. data/lib/ddtrace/contrib/presto/ext.rb +5 -2
  59. data/lib/ddtrace/contrib/racecar/configuration/settings.rb +7 -2
  60. data/lib/ddtrace/contrib/racecar/ext.rb +5 -2
  61. data/lib/ddtrace/contrib/rack/configuration/settings.rb +7 -2
  62. data/lib/ddtrace/contrib/rack/ext.rb +5 -2
  63. data/lib/ddtrace/contrib/rails/configuration/settings.rb +7 -2
  64. data/lib/ddtrace/contrib/rails/ext.rb +5 -2
  65. data/lib/ddtrace/contrib/rake/configuration/settings.rb +7 -3
  66. data/lib/ddtrace/contrib/rake/ext.rb +5 -2
  67. data/lib/ddtrace/contrib/redis/configuration/settings.rb +7 -2
  68. data/lib/ddtrace/contrib/redis/ext.rb +5 -2
  69. data/lib/ddtrace/contrib/resque/configuration/settings.rb +7 -2
  70. data/lib/ddtrace/contrib/resque/ext.rb +5 -2
  71. data/lib/ddtrace/contrib/rest_client/configuration/settings.rb +7 -2
  72. data/lib/ddtrace/contrib/rest_client/ext.rb +5 -2
  73. data/lib/ddtrace/contrib/sequel/configuration/settings.rb +7 -2
  74. data/lib/ddtrace/contrib/sequel/ext.rb +5 -2
  75. data/lib/ddtrace/contrib/sequel/utils.rb +19 -1
  76. data/lib/ddtrace/contrib/shoryuken/configuration/settings.rb +7 -2
  77. data/lib/ddtrace/contrib/shoryuken/ext.rb +5 -2
  78. data/lib/ddtrace/contrib/sidekiq/configuration/settings.rb +7 -2
  79. data/lib/ddtrace/contrib/sidekiq/ext.rb +5 -2
  80. data/lib/ddtrace/contrib/sinatra/configuration/settings.rb +7 -2
  81. data/lib/ddtrace/contrib/sinatra/ext.rb +5 -2
  82. data/lib/ddtrace/contrib/sneakers/configuration/settings.rb +32 -0
  83. data/lib/ddtrace/contrib/sneakers/ext.rb +22 -0
  84. data/lib/ddtrace/contrib/sneakers/integration.rb +41 -0
  85. data/lib/ddtrace/contrib/sneakers/patcher.rb +24 -0
  86. data/lib/ddtrace/contrib/sneakers/tracer.rb +58 -0
  87. data/lib/ddtrace/contrib/sucker_punch/configuration/settings.rb +7 -2
  88. data/lib/ddtrace/contrib/sucker_punch/ext.rb +5 -2
  89. data/lib/ddtrace/diagnostics/environment_logger.rb +1 -1
  90. data/lib/ddtrace/environment.rb +14 -4
  91. data/lib/ddtrace/ext/diagnostics.rb +2 -1
  92. data/lib/ddtrace/ext/transport.rb +1 -0
  93. data/lib/ddtrace/logger.rb +1 -1
  94. data/lib/ddtrace/runtime/metrics.rb +18 -4
  95. data/lib/ddtrace/transport/http.rb +15 -0
  96. data/lib/ddtrace/transport/http/adapters/test.rb +2 -0
  97. data/lib/ddtrace/version.rb +1 -1
  98. metadata +36 -46
@@ -7,13 +7,18 @@ module Datadog
7
7
  module Configuration
8
8
  # Custom settings for the Ethon integration
9
9
  class Settings < Contrib::Configuration::Settings
10
+ option :enabled do |o|
11
+ o.default { env_to_bool(Ext::ENV_ENABLED, true) }
12
+ o.lazy
13
+ end
14
+
10
15
  option :analytics_enabled do |o|
11
- o.default { env_to_bool(Ext::ENV_ANALYTICS_ENABLED, false) }
16
+ o.default { env_to_bool([Ext::ENV_ANALYTICS_ENABLED, Ext::ENV_ANALYTICS_ENABLED_OLD], false) }
12
17
  o.lazy
13
18
  end
14
19
 
15
20
  option :analytics_sample_rate do |o|
16
- o.default { env_to_float(Ext::ENV_ANALYTICS_SAMPLE_RATE, 1.0) }
21
+ o.default { env_to_float([Ext::ENV_ANALYTICS_SAMPLE_RATE, Ext::ENV_ANALYTICS_SAMPLE_RATE_OLD], 1.0) }
17
22
  o.lazy
18
23
  end
19
24
 
@@ -4,8 +4,11 @@ module Datadog
4
4
  # Ethon integration constants
5
5
  module Ext
6
6
  APP = 'ethon'.freeze
7
- ENV_ANALYTICS_ENABLED = 'DD_ETHON_ANALYTICS_ENABLED'.freeze
8
- ENV_ANALYTICS_SAMPLE_RATE = 'DD_ETHON_ANALYTICS_SAMPLE_RATE'.freeze
7
+ ENV_ENABLED = 'DD_TRACE_ETHON_ENABLED'.freeze
8
+ ENV_ANALYTICS_ENABLED = 'DD_TRACE_ETHON_ANALYTICS_ENABLED'.freeze
9
+ ENV_ANALYTICS_ENABLED_OLD = 'DD_ETHON_ANALYTICS_ENABLED'.freeze
10
+ ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_ETHON_ANALYTICS_SAMPLE_RATE'.freeze
11
+ ENV_ANALYTICS_SAMPLE_RATE_OLD = 'DD_ETHON_ANALYTICS_SAMPLE_RATE'.freeze
9
12
  SERVICE_NAME = 'ethon'.freeze
10
13
  SPAN_REQUEST = 'ethon.request'.freeze
11
14
  SPAN_MULTI_REQUEST = 'ethon.multi.request'.freeze
@@ -7,13 +7,18 @@ module Datadog
7
7
  module Configuration
8
8
  # Custom settings for the Excon integration
9
9
  class Settings < Contrib::Configuration::Settings
10
+ option :enabled do |o|
11
+ o.default { env_to_bool(Ext::ENV_ENABLED, true) }
12
+ o.lazy
13
+ end
14
+
10
15
  option :analytics_enabled do |o|
11
- o.default { env_to_bool(Ext::ENV_ANALYTICS_ENABLED, false) }
16
+ o.default { env_to_bool([Ext::ENV_ANALYTICS_ENABLED, Ext::ENV_ANALYTICS_ENABLED_OLD], false) }
12
17
  o.lazy
13
18
  end
14
19
 
15
20
  option :analytics_sample_rate do |o|
16
- o.default { env_to_float(Ext::ENV_ANALYTICS_SAMPLE_RATE, 1.0) }
21
+ o.default { env_to_float([Ext::ENV_ANALYTICS_SAMPLE_RATE, Ext::ENV_ANALYTICS_SAMPLE_RATE_OLD], 1.0) }
17
22
  o.lazy
18
23
  end
19
24
 
@@ -4,8 +4,11 @@ module Datadog
4
4
  # Excon integration constants
5
5
  module Ext
6
6
  APP = 'excon'.freeze
7
- ENV_ANALYTICS_ENABLED = 'DD_EXCON_ANALYTICS_ENABLED'.freeze
8
- ENV_ANALYTICS_SAMPLE_RATE = 'DD_EXCON_ANALYTICS_SAMPLE_RATE'.freeze
7
+ ENV_ENABLED = 'DD_TRACE_EXCON_ENABLED'.freeze
8
+ ENV_ANALYTICS_ENABLED = 'DD_TRACE_EXCON_ANALYTICS_ENABLED'.freeze
9
+ ENV_ANALYTICS_ENABLED_OLD = 'DD_EXCON_ANALYTICS_ENABLED'.freeze
10
+ ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_EXCON_ANALYTICS_SAMPLE_RATE'.freeze
11
+ ENV_ANALYTICS_SAMPLE_RATE_OLD = 'DD_EXCON_ANALYTICS_SAMPLE_RATE'.freeze
9
12
  SERVICE_NAME = 'excon'.freeze
10
13
  SPAN_REQUEST = 'excon.request'.freeze
11
14
  end
@@ -56,7 +56,7 @@ module Datadog
56
56
  def instrument(integration_name, options = {}, &block)
57
57
  integration = fetch_integration(integration_name)
58
58
 
59
- unless integration.nil?
59
+ unless integration.nil? || !integration.default_configuration.enabled
60
60
  configuration_name = options[:describes] || :default
61
61
  filtered_options = options.reject { |k, _v| k == :describes }
62
62
  integration.configure(configuration_name, filtered_options, &block)
@@ -12,13 +12,18 @@ module Datadog
12
12
  Datadog::Ext::HTTP::ERROR_RANGE.cover?(env[:status])
13
13
  end
14
14
 
15
+ option :enabled do |o|
16
+ o.default { env_to_bool(Ext::ENV_ENABLED, true) }
17
+ o.lazy
18
+ end
19
+
15
20
  option :analytics_enabled do |o|
16
- o.default { env_to_bool(Ext::ENV_ANALYTICS_ENABLED, false) }
21
+ o.default { env_to_bool([Ext::ENV_ANALYTICS_ENABLED, Ext::ENV_ANALYTICS_ENABLED_OLD], false) }
17
22
  o.lazy
18
23
  end
19
24
 
20
25
  option :analytics_sample_rate do |o|
21
- o.default { env_to_float(Ext::ENV_ANALYTICS_SAMPLE_RATE, 1.0) }
26
+ o.default { env_to_float([Ext::ENV_ANALYTICS_SAMPLE_RATE, Ext::ENV_ANALYTICS_SAMPLE_RATE_OLD], 1.0) }
22
27
  o.lazy
23
28
  end
24
29
 
@@ -4,8 +4,11 @@ module Datadog
4
4
  # Faraday integration constants
5
5
  module Ext
6
6
  APP = 'faraday'.freeze
7
- ENV_ANALYTICS_ENABLED = 'DD_FARADAY_ANALYTICS_ENABLED'.freeze
8
- ENV_ANALYTICS_SAMPLE_RATE = 'DD_FARADAY_ANALYTICS_SAMPLE_RATE'.freeze
7
+ ENV_ENABLED = 'DD_TRACE_FARADAY_ENABLED'.freeze
8
+ ENV_ANALYTICS_ENABLED = 'DD_TRACE_FARADAY_ANALYTICS_ENABLED'.freeze
9
+ ENV_ANALYTICS_ENABLED_OLD = 'DD_FARADAY_ANALYTICS_ENABLED'.freeze
10
+ ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_FARADAY_ANALYTICS_SAMPLE_RATE'.freeze
11
+ ENV_ANALYTICS_SAMPLE_RATE_OLD = 'DD_FARADAY_ANALYTICS_SAMPLE_RATE'.freeze
9
12
  SERVICE_NAME = 'faraday'.freeze
10
13
  SPAN_REQUEST = 'faraday.request'.freeze
11
14
  end
@@ -41,13 +41,22 @@ module Datadog
41
41
 
42
42
  def add_default_middleware!
43
43
  if target_version >= Gem::Version.new('1.0.0')
44
+ # Patch the default connection (e.g. +Faraday.get+)
45
+ ::Faraday.default_connection.use(:ddtrace)
46
+
47
+ # Patch new connection instances (e.g. +Faraday.new+)
44
48
  ::Faraday::Connection.send(:prepend, Connection)
45
49
  else
50
+ # Patch the default connection (e.g. +Faraday.get+)
51
+ #
52
+ # We insert our middleware before the 'adapter', which is
53
+ # always the last handler.
54
+ idx = ::Faraday.default_connection.builder.handlers.size - 1
55
+ ::Faraday.default_connection.builder.insert(idx, Middleware)
56
+
57
+ # Patch new connection instances (e.g. +Faraday.new+)
46
58
  ::Faraday::RackBuilder.send(:prepend, RackBuilder)
47
59
  end
48
-
49
- # Instrument the Faraday default connection (e.g. +Faraday.get+)
50
- ::Faraday.default_connection.use(:ddtrace)
51
60
  end
52
61
 
53
62
  def get_option(option)
@@ -8,17 +8,21 @@ module Datadog
8
8
  module Configuration
9
9
  # Custom settings for the Grape integration
10
10
  class Settings < Contrib::Configuration::Settings
11
+ option :enabled do |o|
12
+ o.default { env_to_bool(Ext::ENV_ENABLED, true) }
13
+ o.lazy
14
+ end
15
+
11
16
  option :analytics_enabled do |o|
12
- o.default { env_to_bool(Ext::ENV_ANALYTICS_ENABLED, nil) }
17
+ o.default { env_to_bool([Ext::ENV_ANALYTICS_ENABLED, Ext::ENV_ANALYTICS_ENABLED_OLD], nil) }
13
18
  o.lazy
14
19
  end
15
20
 
16
21
  option :analytics_sample_rate do |o|
17
- o.default { env_to_float(Ext::ENV_ANALYTICS_SAMPLE_RATE, 1.0) }
22
+ o.default { env_to_float([Ext::ENV_ANALYTICS_SAMPLE_RATE, Ext::ENV_ANALYTICS_SAMPLE_RATE_OLD], 1.0) }
18
23
  o.lazy
19
24
  end
20
25
 
21
- option :enabled, default: true
22
26
  option :service_name, default: Ext::SERVICE_NAME
23
27
  end
24
28
  end
@@ -4,8 +4,11 @@ module Datadog
4
4
  # Grape integration constants
5
5
  module Ext
6
6
  APP = 'grape'.freeze
7
- ENV_ANALYTICS_ENABLED = 'DD_GRAPE_ANALYTICS_ENABLED'.freeze
8
- ENV_ANALYTICS_SAMPLE_RATE = 'DD_GRAPE_ANALYTICS_SAMPLE_RATE'.freeze
7
+ ENV_ENABLED = 'DD_TRACE_GRAPE_ENABLED'.freeze
8
+ ENV_ANALYTICS_ENABLED = 'DD_TRACE_GRAPE_ANALYTICS_ENABLED'.freeze
9
+ ENV_ANALYTICS_ENABLED_OLD = 'DD_GRAPE_ANALYTICS_ENABLED'.freeze
10
+ ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_GRAPE_ANALYTICS_SAMPLE_RATE'.freeze
11
+ ENV_ANALYTICS_SAMPLE_RATE_OLD = 'DD_GRAPE_ANALYTICS_SAMPLE_RATE'.freeze
9
12
  SERVICE_NAME = 'grape'.freeze
10
13
  SPAN_ENDPOINT_RENDER = 'grape.endpoint_render'.freeze
11
14
  SPAN_ENDPOINT_RUN = 'grape.endpoint_run'.freeze
@@ -8,13 +8,18 @@ module Datadog
8
8
  module Configuration
9
9
  # Custom settings for the GraphQL integration
10
10
  class Settings < Contrib::Configuration::Settings
11
+ option :enabled do |o|
12
+ o.default { env_to_bool(Ext::ENV_ENABLED, true) }
13
+ o.lazy
14
+ end
15
+
11
16
  option :analytics_enabled do |o|
12
- o.default { env_to_bool(Ext::ENV_ANALYTICS_ENABLED, nil) }
17
+ o.default { env_to_bool([Ext::ENV_ANALYTICS_ENABLED, Ext::ENV_ANALYTICS_ENABLED_OLD], nil) }
13
18
  o.lazy
14
19
  end
15
20
 
16
21
  option :analytics_sample_rate do |o|
17
- o.default { env_to_float(Ext::ENV_ANALYTICS_SAMPLE_RATE, 1.0) }
22
+ o.default { env_to_float([Ext::ENV_ANALYTICS_SAMPLE_RATE, Ext::ENV_ANALYTICS_SAMPLE_RATE_OLD], 1.0) }
18
23
  o.lazy
19
24
  end
20
25
 
@@ -4,8 +4,11 @@ module Datadog
4
4
  # GraphQL integration constants
5
5
  module Ext
6
6
  APP = 'ruby-graphql'.freeze
7
- ENV_ANALYTICS_ENABLED = 'DD_GRAPHQL_ANALYTICS_ENABLED'.freeze
8
- ENV_ANALYTICS_SAMPLE_RATE = 'DD_GRAPHQL_ANALYTICS_SAMPLE_RATE'.freeze
7
+ ENV_ENABLED = 'DD_TRACE_GRAPHQL_ENABLED'.freeze
8
+ ENV_ANALYTICS_ENABLED = 'DD_TRACE_GRAPHQL_ANALYTICS_ENABLED'.freeze
9
+ ENV_ANALYTICS_ENABLED_OLD = 'DD_GRAPHQL_ANALYTICS_ENABLED'.freeze
10
+ ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_GRAPHQL_ANALYTICS_SAMPLE_RATE'.freeze
11
+ ENV_ANALYTICS_SAMPLE_RATE_OLD = 'DD_GRAPHQL_ANALYTICS_SAMPLE_RATE'.freeze
9
12
  SERVICE_NAME = 'ruby-graphql'.freeze
10
13
  end
11
14
  end
@@ -7,13 +7,18 @@ module Datadog
7
7
  module Configuration
8
8
  # Custom settings for the gRPC integration
9
9
  class Settings < Contrib::Configuration::Settings
10
+ option :enabled do |o|
11
+ o.default { env_to_bool(Ext::ENV_ENABLED, true) }
12
+ o.lazy
13
+ end
14
+
10
15
  option :analytics_enabled do |o|
11
- o.default { env_to_bool(Ext::ENV_ANALYTICS_ENABLED, false) }
16
+ o.default { env_to_bool([Ext::ENV_ANALYTICS_ENABLED, Ext::ENV_ANALYTICS_ENABLED_OLD], false) }
12
17
  o.lazy
13
18
  end
14
19
 
15
20
  option :analytics_sample_rate do |o|
16
- o.default { env_to_float(Ext::ENV_ANALYTICS_SAMPLE_RATE, 1.0) }
21
+ o.default { env_to_float([Ext::ENV_ANALYTICS_SAMPLE_RATE, Ext::ENV_ANALYTICS_SAMPLE_RATE_OLD], 1.0) }
17
22
  o.lazy
18
23
  end
19
24
 
@@ -4,8 +4,11 @@ module Datadog
4
4
  # gRPC integration constants
5
5
  module Ext
6
6
  APP = 'grpc'.freeze
7
- ENV_ANALYTICS_ENABLED = 'DD_GRPC_ANALYTICS_ENABLED'.freeze
8
- ENV_ANALYTICS_SAMPLE_RATE = 'DD_GRPC_ANALYTICS_SAMPLE_RATE'.freeze
7
+ ENV_ENABLED = 'DD_TRACE_GRPC_ENABLED'.freeze
8
+ ENV_ANALYTICS_ENABLED = 'DD_TRACE_GRPC_ANALYTICS_ENABLED'.freeze
9
+ ENV_ANALYTICS_ENABLED_OLD = 'DD_GRPC_ANALYTICS_ENABLED'.freeze
10
+ ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_GRPC_ANALYTICS_SAMPLE_RATE'.freeze
11
+ ENV_ANALYTICS_SAMPLE_RATE_OLD = 'DD_GRPC_ANALYTICS_SAMPLE_RATE'.freeze
9
12
  SERVICE_NAME = 'grpc'.freeze
10
13
  SPAN_CLIENT = 'grpc.client'.freeze
11
14
  SPAN_SERVICE = 'grpc.service'.freeze
@@ -7,13 +7,18 @@ module Datadog
7
7
  module Configuration
8
8
  # Custom settings for the HTTP integration
9
9
  class Settings < Contrib::Configuration::Settings
10
+ option :enabled do |o|
11
+ o.default { env_to_bool(Ext::ENV_ENABLED, true) }
12
+ o.lazy
13
+ end
14
+
10
15
  option :analytics_enabled do |o|
11
- o.default { env_to_bool(Ext::ENV_ANALYTICS_ENABLED, false) }
16
+ o.default { env_to_bool([Ext::ENV_ANALYTICS_ENABLED, Ext::ENV_ANALYTICS_ENABLED_OLD], false) }
12
17
  o.lazy
13
18
  end
14
19
 
15
20
  option :analytics_sample_rate do |o|
16
- o.default { env_to_float(Ext::ENV_ANALYTICS_SAMPLE_RATE, 1.0) }
21
+ o.default { env_to_float([Ext::ENV_ANALYTICS_SAMPLE_RATE, Ext::ENV_ANALYTICS_SAMPLE_RATE_OLD], 1.0) }
17
22
  o.lazy
18
23
  end
19
24
 
@@ -4,8 +4,11 @@ module Datadog
4
4
  # HTTP integration constants
5
5
  module Ext
6
6
  APP = 'net/http'.freeze
7
- ENV_ANALYTICS_ENABLED = 'DD_HTTP_ANALYTICS_ENABLED'.freeze
8
- ENV_ANALYTICS_SAMPLE_RATE = 'DD_HTTP_ANALYTICS_SAMPLE_RATE'.freeze
7
+ ENV_ENABLED = 'DD_TRACE_HTTP_ENABLED'.freeze
8
+ ENV_ANALYTICS_ENABLED = 'DD_TRACE_HTTP_ANALYTICS_ENABLED'.freeze
9
+ ENV_ANALYTICS_ENABLED_OLD = 'DD_HTTP_ANALYTICS_ENABLED'.freeze
10
+ ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_HTTP_ANALYTICS_SAMPLE_RATE'.freeze
11
+ ENV_ANALYTICS_SAMPLE_RATE_OLD = 'DD_HTTP_ANALYTICS_SAMPLE_RATE'.freeze
9
12
  SERVICE_NAME = 'net/http'.freeze
10
13
  SPAN_REQUEST = 'http.request'.freeze
11
14
  end
@@ -7,13 +7,18 @@ module Datadog
7
7
  module Configuration
8
8
  # Custom settings for the Httprb integration
9
9
  class Settings < Contrib::Configuration::Settings
10
+ option :enabled do |o|
11
+ o.default { env_to_bool(Ext::ENV_ENABLED, true) }
12
+ o.lazy
13
+ end
14
+
10
15
  option :analytics_enabled do |o|
11
- o.default { env_to_bool(Ext::ENV_ANALYTICS_ENABLED, false) }
16
+ o.default { env_to_bool([Ext::ENV_ANALYTICS_ENABLED, Ext::ENV_ANALYTICS_ENABLED_OLD], false) }
12
17
  o.lazy
13
18
  end
14
19
 
15
20
  option :analytics_sample_rate do |o|
16
- o.default { env_to_float(Ext::ENV_ANALYTICS_SAMPLE_RATE, 1.0) }
21
+ o.default { env_to_float([Ext::ENV_ANALYTICS_SAMPLE_RATE, Ext::ENV_ANALYTICS_SAMPLE_RATE_OLD], 1.0) }
17
22
  o.lazy
18
23
  end
19
24
 
@@ -4,8 +4,11 @@ module Datadog
4
4
  # Httprb integration constants
5
5
  module Ext
6
6
  APP = 'httprb'.freeze
7
- ENV_ANALYTICS_ENABLED = 'DD_HTTPRB_ANALYTICS_ENABLED'.freeze
8
- ENV_ANALYTICS_SAMPLE_RATE = 'DD_HTTPRB_ANALYTICS_SAMPLE_RATE'.freeze
7
+ ENV_ENABLED = 'DD_TRACE_HTTPRB_ENABLED'.freeze
8
+ ENV_ANALYTICS_ENABLED = 'DD_TRACE_HTTPRB_ANALYTICS_ENABLED'.freeze
9
+ ENV_ANALYTICS_ENABLED_OLD = 'DD_HTTPRB_ANALYTICS_ENABLED'.freeze
10
+ ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_EHTTPRB_ANALYTICS_SAMPLE_RATE'.freeze
11
+ ENV_ANALYTICS_SAMPLE_RATE_OLD = 'DD_HTTPRB_ANALYTICS_SAMPLE_RATE'.freeze
9
12
  SERVICE_NAME = 'httprb'.freeze
10
13
  SPAN_REQUEST = 'httprb.request'.freeze
11
14
  end
@@ -82,12 +82,9 @@ module Datadog
82
82
 
83
83
  case response.code.to_i
84
84
  when 400...599
85
- begin
86
- message = JSON.parse(response.body)['message']
87
- rescue
88
- message = 'Error'
89
- end
90
- span.set_error(["Error #{response.code}", message])
85
+ # https://github.com/DataDog/dd-trace-rb/issues/1116
86
+ # parsing the response body message will alter downstream application behavior
87
+ span.set_error(["Error #{response.code}", 'Error'])
91
88
  end
92
89
  end
93
90
 
@@ -7,13 +7,18 @@ module Datadog
7
7
  module Configuration
8
8
  # Custom settings for the Kafka integration
9
9
  class Settings < Contrib::Configuration::Settings
10
+ option :enabled do |o|
11
+ o.default { env_to_bool(Ext::ENV_ENABLED, true) }
12
+ o.lazy
13
+ end
14
+
10
15
  option :analytics_enabled do |o|
11
- o.default { env_to_bool(Ext::ENV_ANALYTICS_ENABLED, false) }
16
+ o.default { env_to_bool([Ext::ENV_ANALYTICS_ENABLED, Ext::ENV_ANALYTICS_ENABLED_OLD], false) }
12
17
  o.lazy
13
18
  end
14
19
 
15
20
  option :analytics_sample_rate do |o|
16
- o.default { env_to_float(Ext::ENV_ANALYTICS_SAMPLE_RATE, 1.0) }
21
+ o.default { env_to_float([Ext::ENV_ANALYTICS_SAMPLE_RATE, Ext::ENV_ANALYTICS_SAMPLE_RATE_OLD], 1.0) }
17
22
  o.lazy
18
23
  end
19
24
 
@@ -4,8 +4,11 @@ module Datadog
4
4
  # Kafka integration constants
5
5
  module Ext
6
6
  APP = 'kafka'.freeze
7
- ENV_ANALYTICS_ENABLED = 'DD_KAFKA_ANALYTICS_ENABLED'.freeze
8
- ENV_ANALYTICS_SAMPLE_RATE = 'DD_KAFKA_ANALYTICS_SAMPLE_RATE'.freeze
7
+ ENV_ENABLED = 'DD_TRACE_KAFKA_ENABLED'.freeze
8
+ ENV_ANALYTICS_ENABLED = 'DD_TRACE_KAFKA_ANALYTICS_ENABLED'.freeze
9
+ ENV_ANALYTICS_ENABLED_OLD = 'DD_KAFKA_ANALYTICS_ENABLED'.freeze
10
+ ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_KAFKA_ANALYTICS_SAMPLE_RATE'.freeze
11
+ ENV_ANALYTICS_SAMPLE_RATE_OLD = 'DD_KAFKA_ANALYTICS_SAMPLE_RATE'.freeze
9
12
  SERVICE_NAME = 'kafka'.freeze
10
13
  SPAN_CONNECTION_REQUEST = 'kafka.connection.request'.freeze
11
14
  SPAN_CONSUMER_HEARTBEAT = 'kafka.consumer.heartbeat'.freeze
@@ -9,13 +9,18 @@ module Datadog
9
9
  class Settings < Contrib::Configuration::Settings
10
10
  DEFAULT_QUANTIZE = { show: [:collection, :database, :operation] }.freeze
11
11
 
12
+ option :enabled do |o|
13
+ o.default { env_to_bool(Ext::ENV_ENABLED, true) }
14
+ o.lazy
15
+ end
16
+
12
17
  option :analytics_enabled do |o|
13
- o.default { env_to_bool(Ext::ENV_ANALYTICS_ENABLED, false) }
18
+ o.default { env_to_bool([Ext::ENV_ANALYTICS_ENABLED, Ext::ENV_ANALYTICS_ENABLED_OLD], false) }
14
19
  o.lazy
15
20
  end
16
21
 
17
22
  option :analytics_sample_rate do |o|
18
- o.default { env_to_float(Ext::ENV_ANALYTICS_SAMPLE_RATE, 1.0) }
23
+ o.default { env_to_float([Ext::ENV_ANALYTICS_SAMPLE_RATE, Ext::ENV_ANALYTICS_SAMPLE_RATE_OLD], 1.0) }
19
24
  o.lazy
20
25
  end
21
26
 
@@ -4,8 +4,11 @@ module Datadog
4
4
  # MongoDB integration constants
5
5
  module Ext
6
6
  APP = 'mongodb'.freeze
7
- ENV_ANALYTICS_ENABLED = 'DD_MONGO_ANALYTICS_ENABLED'.freeze
8
- ENV_ANALYTICS_SAMPLE_RATE = 'DD_MONGO_ANALYTICS_SAMPLE_RATE'.freeze
7
+ ENV_ENABLED = 'DD_TRACE_MONGO_ENABLED'.freeze
8
+ ENV_ANALYTICS_ENABLED = 'DD_TRACE_MONGO_ANALYTICS_ENABLED'.freeze
9
+ ENV_ANALYTICS_ENABLED_OLD = 'DD_MONGO_ANALYTICS_ENABLED'.freeze
10
+ ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_MONGO_ANALYTICS_SAMPLE_RATE'.freeze
11
+ ENV_ANALYTICS_SAMPLE_RATE_OLD = 'DD_MONGO_ANALYTICS_SAMPLE_RATE'.freeze
9
12
  SERVICE_NAME = 'mongodb'.freeze
10
13
  SPAN_COMMAND = 'mongo.cmd'.freeze
11
14
  SPAN_TYPE_COMMAND = 'mongodb'.freeze
@@ -7,13 +7,18 @@ module Datadog
7
7
  module Configuration
8
8
  # Custom settings for the Mysql2 integration
9
9
  class Settings < Contrib::Configuration::Settings
10
+ option :enabled do |o|
11
+ o.default { env_to_bool(Ext::ENV_ENABLED, true) }
12
+ o.lazy
13
+ end
14
+
10
15
  option :analytics_enabled do |o|
11
- o.default { env_to_bool(Ext::ENV_ANALYTICS_ENABLED, false) }
16
+ o.default { env_to_bool([Ext::ENV_ANALYTICS_ENABLED, Ext::ENV_ANALYTICS_ENABLED_OLD], false) }
12
17
  o.lazy
13
18
  end
14
19
 
15
20
  option :analytics_sample_rate do |o|
16
- o.default { env_to_float(Ext::ENV_ANALYTICS_SAMPLE_RATE, 1.0) }
21
+ o.default { env_to_float([Ext::ENV_ANALYTICS_SAMPLE_RATE, Ext::ENV_ANALYTICS_SAMPLE_RATE_OLD], 1.0) }
17
22
  o.lazy
18
23
  end
19
24
 
@@ -4,8 +4,11 @@ module Datadog
4
4
  # Mysql2 integration constants
5
5
  module Ext
6
6
  APP = 'mysql2'.freeze
7
- ENV_ANALYTICS_ENABLED = 'DD_MYSQL2_ANALYTICS_ENABLED'.freeze
8
- ENV_ANALYTICS_SAMPLE_RATE = 'DD_MYSQL2_ANALYTICS_SAMPLE_RATE'.freeze
7
+ ENV_ENABLED = 'DD_TRACE_MYSQL2_ENABLED'.freeze
8
+ ENV_ANALYTICS_ENABLED = 'DD_TRACE_MYSQL2_ANALYTICS_ENABLED'.freeze
9
+ ENV_ANALYTICS_ENABLED_OLD = 'DD_MYSQL2_ANALYTICS_ENABLED'.freeze
10
+ ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_MYSQL2_ANALYTICS_SAMPLE_RATE'.freeze
11
+ ENV_ANALYTICS_SAMPLE_RATE_OLD = 'DD_MYSQL2_ANALYTICS_SAMPLE_RATE'.freeze
9
12
  SERVICE_NAME = 'mysql2'.freeze
10
13
  SPAN_QUERY = 'mysql2.query'.freeze
11
14
  TAG_DB_NAME = 'mysql2.db.name'.freeze