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 Presto 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
  # Presto integration constants
5
5
  module Ext
6
6
  APP = 'presto'.freeze
7
- ENV_ANALYTICS_ENABLED = 'DD_PRESTO_ANALYTICS_ENABLED'.freeze
8
- ENV_ANALYTICS_SAMPLE_RATE = 'DD_PRESTO_ANALYTICS_SAMPLE_RATE'.freeze
7
+ ENV_ENABLED = 'DD_TRACE_PRESTO_ENABLED'.freeze
8
+ ENV_ANALYTICS_ENABLED = 'DD_TRACE_PRESTO_ANALYTICS_ENABLED'.freeze
9
+ ENV_ANALYTICS_ENABLED_OLD = 'DD_PRESTO_ANALYTICS_ENABLED'.freeze
10
+ ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_PRESTO_ANALYTICS_SAMPLE_RATE'.freeze
11
+ ENV_ANALYTICS_SAMPLE_RATE_OLD = 'DD_PRESTO_ANALYTICS_SAMPLE_RATE'.freeze
9
12
  SERVICE_NAME = 'presto'.freeze
10
13
  SPAN_QUERY = 'presto.query'.freeze
11
14
  SPAN_RESUME = 'presto.resume_query'.freeze
@@ -7,13 +7,18 @@ module Datadog
7
7
  module Configuration
8
8
  # Custom settings for the Racecar 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
  # Racecar integration constants
5
5
  module Ext
6
6
  APP = 'racecar'.freeze
7
- ENV_ANALYTICS_ENABLED = 'DD_RACECAR_ANALYTICS_ENABLED'.freeze
8
- ENV_ANALYTICS_SAMPLE_RATE = 'DD_RACECAR_ANALYTICS_SAMPLE_RATE'.freeze
7
+ ENV_ENABLED = 'DD_TRACE_RACECAR_ENABLED'.freeze
8
+ ENV_ANALYTICS_ENABLED = 'DD_TRACE_RACECAR_ANALYTICS_ENABLED'.freeze
9
+ ENV_ANALYTICS_ENABLED_OLD = 'DD_RACECAR_ANALYTICS_ENABLED'.freeze
10
+ ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_RACECAR_ANALYTICS_SAMPLE_RATE'.freeze
11
+ ENV_ANALYTICS_SAMPLE_RATE_OLD = 'DD_RACECAR_ANALYTICS_SAMPLE_RATE'.freeze
9
12
  SERVICE_NAME = 'racecar'.freeze
10
13
  SPAN_BATCH = 'racecar.batch'.freeze
11
14
  SPAN_MESSAGE = 'racecar.message'.freeze
@@ -14,13 +14,18 @@ module Datadog
14
14
  ]
15
15
  }.freeze
16
16
 
17
+ option :enabled do |o|
18
+ o.default { env_to_bool(Ext::ENV_ENABLED, true) }
19
+ o.lazy
20
+ end
21
+
17
22
  option :analytics_enabled do |o|
18
- o.default { env_to_bool(Ext::ENV_ANALYTICS_ENABLED, nil) }
23
+ o.default { env_to_bool([Ext::ENV_ANALYTICS_ENABLED, Ext::ENV_ANALYTICS_ENABLED_OLD], nil) }
19
24
  o.lazy
20
25
  end
21
26
 
22
27
  option :analytics_sample_rate do |o|
23
- o.default { env_to_float(Ext::ENV_ANALYTICS_SAMPLE_RATE, 1.0) }
28
+ o.default { env_to_float([Ext::ENV_ANALYTICS_SAMPLE_RATE, Ext::ENV_ANALYTICS_SAMPLE_RATE_OLD], 1.0) }
24
29
  o.lazy
25
30
  end
26
31
 
@@ -4,8 +4,11 @@ module Datadog
4
4
  # Rack integration constants
5
5
  module Ext
6
6
  APP = 'rack'.freeze
7
- ENV_ANALYTICS_ENABLED = 'DD_RACK_ANALYTICS_ENABLED'.freeze
8
- ENV_ANALYTICS_SAMPLE_RATE = 'DD_RACK_ANALYTICS_SAMPLE_RATE'.freeze
7
+ ENV_ENABLED = 'DD_TRACE_RACK_ENABLED'.freeze
8
+ ENV_ANALYTICS_ENABLED = 'DD_TRACE_RACK_ANALYTICS_ENABLED'.freeze
9
+ ENV_ANALYTICS_ENABLED_OLD = 'DD_RACK_ANALYTICS_ENABLED'.freeze
10
+ ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_RACK_ANALYTICS_SAMPLE_RATE'.freeze
11
+ ENV_ANALYTICS_SAMPLE_RATE_OLD = 'DD_RACK_ANALYTICS_SAMPLE_RATE'.freeze
9
12
  RACK_ENV_REQUEST_SPAN = 'datadog.rack_request_span'.freeze
10
13
  SERVICE_NAME = 'rack'.freeze
11
14
  SPAN_HTTP_SERVER_QUEUE = 'http_server.queue'.freeze
@@ -19,8 +19,13 @@ module Datadog
19
19
  analytics_sample_rate
20
20
  end
21
21
 
22
+ option :enabled do |o|
23
+ o.default { env_to_bool(Ext::ENV_ENABLED, true) }
24
+ o.lazy
25
+ end
26
+
22
27
  option :analytics_enabled do |o|
23
- o.default { env_to_bool(Ext::ENV_ANALYTICS_ENABLED, nil) }
28
+ o.default { env_to_bool([Ext::ENV_ANALYTICS_ENABLED, Ext::ENV_ANALYTICS_ENABLED_OLD], nil) }
24
29
  o.lazy
25
30
  o.on_set do |value|
26
31
  # Update ActionPack analytics too
@@ -29,7 +34,7 @@ module Datadog
29
34
  end
30
35
 
31
36
  option :analytics_sample_rate do |o|
32
- o.default { env_to_float(Ext::ENV_ANALYTICS_SAMPLE_RATE, 1.0) }
37
+ o.default { env_to_float([Ext::ENV_ANALYTICS_SAMPLE_RATE, Ext::ENV_ANALYTICS_SAMPLE_RATE_OLD], 1.0) }
33
38
  o.lazy
34
39
  o.on_set do |value|
35
40
  # Update ActionPack analytics too
@@ -4,8 +4,11 @@ module Datadog
4
4
  # Rails integration constants
5
5
  module Ext
6
6
  APP = 'rails'.freeze
7
- ENV_ANALYTICS_ENABLED = 'DD_RAILS_ANALYTICS_ENABLED'.freeze
8
- ENV_ANALYTICS_SAMPLE_RATE = 'DD_RAILS_ANALYTICS_SAMPLE_RATE'.freeze
7
+ ENV_ENABLED = 'DD_TRACE_RAILS_ENABLED'.freeze
8
+ ENV_ANALYTICS_ENABLED = 'DD_TRACE_RAILS_ANALYTICS_ENABLED'.freeze
9
+ ENV_ANALYTICS_ENABLED_OLD = 'DD_RAILS_ANALYTICS_ENABLED'.freeze
10
+ ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_RAILS_ANALYTICS_SAMPLE_RATE'.freeze
11
+ ENV_ANALYTICS_SAMPLE_RATE_OLD = 'DD_RAILS_ANALYTICS_SAMPLE_RATE'.freeze
9
12
  ENV_DISABLE = 'DISABLE_DATADOG_RAILS'.freeze
10
13
  end
11
14
  end
@@ -7,17 +7,21 @@ module Datadog
7
7
  module Configuration
8
8
  # Custom settings for the Rake 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
 
20
- option :enabled, default: true
21
25
  option :quantize, default: {}
22
26
  option :service_name, default: Ext::SERVICE_NAME
23
27
  end
@@ -4,8 +4,11 @@ module Datadog
4
4
  # Rake integration constants
5
5
  module Ext
6
6
  APP = 'rake'.freeze
7
- ENV_ANALYTICS_ENABLED = 'DD_RAKE_ANALYTICS_ENABLED'.freeze
8
- ENV_ANALYTICS_SAMPLE_RATE = 'DD_RAKE_ANALYTICS_SAMPLE_RATE'.freeze
7
+ ENV_ENABLED = 'DD_TRACE_RAKE_ENABLED'.freeze
8
+ ENV_ANALYTICS_ENABLED = 'DD_TRACE_RAKE_ANALYTICS_ENABLED'.freeze
9
+ ENV_ANALYTICS_ENABLED_OLD = 'DD_RAKE_ANALYTICS_ENABLED'.freeze
10
+ ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_RAKE_ANALYTICS_SAMPLE_RATE'.freeze
11
+ ENV_ANALYTICS_SAMPLE_RATE_OLD = 'DD_RAKE_ANALYTICS_SAMPLE_RATE'.freeze
9
12
  SERVICE_NAME = 'rake'.freeze
10
13
  SPAN_INVOKE = 'rake.invoke'.freeze
11
14
  SPAN_EXECUTE = 'rake.execute'.freeze
@@ -7,13 +7,18 @@ module Datadog
7
7
  module Configuration
8
8
  # Custom settings for the Redis 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
  # Redis integration constants
5
5
  module Ext
6
6
  APP = 'redis'.freeze
7
- ENV_ANALYTICS_ENABLED = 'DD_REDIS_ANALYTICS_ENABLED'.freeze
8
- ENV_ANALYTICS_SAMPLE_RATE = 'DD_REDIS_ANALYTICS_SAMPLE_RATE'.freeze
7
+ ENV_ENABLED = 'DD_TRACE_REDIS_ENABLED'.freeze
8
+ ENV_ANALYTICS_ENABLED = 'DD_TRACE_REDIS_ANALYTICS_ENABLED'.freeze
9
+ ENV_ANALYTICS_ENABLED_OLD = 'DD_REDIS_ANALYTICS_ENABLED'.freeze
10
+ ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_REDIS_ANALYTICS_SAMPLE_RATE'.freeze
11
+ ENV_ANALYTICS_SAMPLE_RATE_OLD = 'DD_REDIS_ANALYTICS_SAMPLE_RATE'.freeze
9
12
  METRIC_PIPELINE_LEN = 'redis.pipeline_length'.freeze
10
13
  SERVICE_NAME = 'redis'.freeze
11
14
  SPAN_COMMAND = 'redis.command'.freeze
@@ -7,13 +7,18 @@ module Datadog
7
7
  module Configuration
8
8
  # Custom settings for the Resque 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
  # Resque integration constants
5
5
  module Ext
6
6
  APP = 'resque'.freeze
7
- ENV_ANALYTICS_ENABLED = 'DD_RESQUE_ANALYTICS_ENABLED'.freeze
8
- ENV_ANALYTICS_SAMPLE_RATE = 'DD_RESQUE_ANALYTICS_SAMPLE_RATE'.freeze
7
+ ENV_ENABLED = 'DD_TRACE_RESQUE_ENABLED'.freeze
8
+ ENV_ANALYTICS_ENABLED = 'DD_TRACE_RESQUE_ANALYTICS_ENABLED'.freeze
9
+ ENV_ANALYTICS_ENABLED_OLD = 'DD_RESQUE_ANALYTICS_ENABLED'.freeze
10
+ ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_RESQUE_ANALYTICS_SAMPLE_RATE'.freeze
11
+ ENV_ANALYTICS_SAMPLE_RATE_OLD = 'DD_RESQUE_ANALYTICS_SAMPLE_RATE'.freeze
9
12
  SERVICE_NAME = 'resque'.freeze
10
13
  SPAN_JOB = 'resque.job'.freeze
11
14
  end
@@ -7,13 +7,18 @@ module Datadog
7
7
  module Configuration
8
8
  # Custom settings for the RestClient 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
  # RestClient integration constants
5
5
  module Ext
6
6
  APP = 'rest_client'.freeze
7
- ENV_ANALYTICS_ENABLED = 'DD_REST_CLIENT_ANALYTICS_ENABLED'.freeze
8
- ENV_ANALYTICS_SAMPLE_RATE = 'DD_REST_CLIENT_ANALYTICS_SAMPLE_RATE'.freeze
7
+ ENV_ENABLED = 'DD_TRACE_REST_CLIENT_ENABLED'.freeze
8
+ ENV_ANALYTICS_ENABLED = 'DD_TRACE_REST_CLIENT_ANALYTICS_ENABLED'.freeze
9
+ ENV_ANALYTICS_ENABLED_OLD = 'DD_REST_CLIENT_ANALYTICS_ENABLED'.freeze
10
+ ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_REST_CLIENT_ANALYTICS_SAMPLE_RATE'.freeze
11
+ ENV_ANALYTICS_SAMPLE_RATE_OLD = 'DD_REST_CLIENT_ANALYTICS_SAMPLE_RATE'.freeze
9
12
  SERVICE_NAME = 'rest_client'.freeze
10
13
  SPAN_REQUEST = 'rest_client.request'.freeze
11
14
  end
@@ -7,13 +7,18 @@ module Datadog
7
7
  module Configuration
8
8
  # Custom settings for the Sequel 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
  end
@@ -4,8 +4,11 @@ module Datadog
4
4
  # Sequel integration constants
5
5
  module Ext
6
6
  APP = 'sequel'.freeze
7
- ENV_ANALYTICS_ENABLED = 'DD_SEQUEL_ANALYTICS_ENABLED'.freeze
8
- ENV_ANALYTICS_SAMPLE_RATE = 'DD_SEQUEL_ANALYTICS_SAMPLE_RATE'.freeze
7
+ ENV_ENABLED = 'DD_TRACE_SEQUEL_ENABLED'.freeze
8
+ ENV_ANALYTICS_ENABLED = 'DD_TRACE_SEQUEL_ANALYTICS_ENABLED'.freeze
9
+ ENV_ANALYTICS_ENABLED_OLD = 'DD_SEQUEL_ANALYTICS_ENABLED'.freeze
10
+ ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_SEQUEL_ANALYTICS_SAMPLE_RATE'.freeze
11
+ ENV_ANALYTICS_SAMPLE_RATE_OLD = 'DD_SEQUEL_ANALYTICS_SAMPLE_RATE'.freeze
9
12
  SERVICE_NAME = 'sequel'.freeze
10
13
  SPAN_QUERY = 'sequel.query'.freeze
11
14
  TAG_DB_VENDOR = 'sequel.db.vendor'.freeze
@@ -4,8 +4,26 @@ module Datadog
4
4
  # General purpose functions for Sequel
5
5
  module Utils
6
6
  class << self
7
+ # Ruby database connector library
8
+ #
9
+ # e.g. adapter:mysql2 (database:mysql), adapter:jdbc (database:postgres)
7
10
  def adapter_name(database)
8
- Datadog::Utils::Database.normalize_vendor(database.adapter_scheme.to_s)
11
+ scheme = database.adapter_scheme.to_s
12
+
13
+ if scheme == 'jdbc'.freeze
14
+ # The subtype is more important in this case,
15
+ # otherwise all database adapters will be 'jdbc'.
16
+ database_type(database)
17
+ else
18
+ Datadog::Utils::Database.normalize_vendor(scheme)
19
+ end
20
+ end
21
+
22
+ # Database engine
23
+ #
24
+ # e.g. database:mysql (adapter:mysql2), database:postgres (adapter:jdbc)
25
+ def database_type(database)
26
+ Datadog::Utils::Database.normalize_vendor(database.database_type.to_s)
9
27
  end
10
28
 
11
29
  def parse_opts(sql, opts, db_opts)
@@ -6,13 +6,18 @@ module Datadog
6
6
  module Configuration
7
7
  # Default settings for the Shoryuken integration
8
8
  class Settings < Contrib::Configuration::Settings
9
+ option :enabled do |o|
10
+ o.default { env_to_bool(Ext::ENV_ENABLED, true) }
11
+ o.lazy
12
+ end
13
+
9
14
  option :analytics_enabled do |o|
10
- o.default { env_to_bool(Ext::ENV_ANALYTICS_ENABLED, false) }
15
+ o.default { env_to_bool([Ext::ENV_ANALYTICS_ENABLED, Ext::ENV_ANALYTICS_ENABLED_OLD], false) }
11
16
  o.lazy
12
17
  end
13
18
 
14
19
  option :analytics_sample_rate do |o|
15
- o.default { env_to_float(Ext::ENV_ANALYTICS_SAMPLE_RATE, 1.0) }
20
+ o.default { env_to_float([Ext::ENV_ANALYTICS_SAMPLE_RATE, Ext::ENV_ANALYTICS_SAMPLE_RATE_OLD], 1.0) }
16
21
  o.lazy
17
22
  end
18
23
 
@@ -4,8 +4,11 @@ module Datadog
4
4
  # Shoryuken integration constants
5
5
  module Ext
6
6
  APP = 'shoryuken'.freeze
7
- ENV_ANALYTICS_ENABLED = 'DD_SHORYUKEN_ANALYTICS_ENABLED'.freeze
8
- ENV_ANALYTICS_SAMPLE_RATE = 'DD_SHORYUKEN_ANALYTICS_SAMPLE_RATE'.freeze
7
+ ENV_ENABLED = 'DD_TRACE_SHORYUKEN_ENABLED'.freeze
8
+ ENV_ANALYTICS_ENABLED = 'DD_TRACE_SHORYUKEN_ANALYTICS_ENABLED'.freeze
9
+ ENV_ANALYTICS_ENABLED_OLD = 'DD_SHORYUKEN_ANALYTICS_ENABLED'.freeze
10
+ ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_SHORYUKEN_ANALYTICS_SAMPLE_RATE'.freeze
11
+ ENV_ANALYTICS_SAMPLE_RATE_OLD = 'DD_SHORYUKEN_ANALYTICS_SAMPLE_RATE'.freeze
9
12
  SERVICE_NAME = 'shoryuken'.freeze
10
13
  SPAN_JOB = 'shoryuken.job'.freeze
11
14
  TAG_JOB_ID = 'shoryuken.id'.freeze
@@ -7,13 +7,18 @@ module Datadog
7
7
  module Configuration
8
8
  # Custom settings for the Sidekiq 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
 
@@ -5,8 +5,11 @@ module Datadog
5
5
  module Ext
6
6
  APP = 'sidekiq'.freeze
7
7
  CLIENT_SERVICE_NAME = 'sidekiq-client'.freeze
8
- ENV_ANALYTICS_ENABLED = 'DD_SIDEKIQ_ANALYTICS_ENABLED'.freeze
9
- ENV_ANALYTICS_SAMPLE_RATE = 'DD_SIDEKIQ_ANALYTICS_SAMPLE_RATE'.freeze
8
+ ENV_ENABLED = 'DD_TRACE_SIDEKIQ_ENABLED'.freeze
9
+ ENV_ANALYTICS_ENABLED = 'DD_TRACE_SIDEKIQ_ANALYTICS_ENABLED'.freeze
10
+ ENV_ANALYTICS_ENABLED_OLD = 'DD_SIDEKIQ_ANALYTICS_ENABLED'.freeze
11
+ ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_SIDEKIQ_ANALYTICS_SAMPLE_RATE'.freeze
12
+ ENV_ANALYTICS_SAMPLE_RATE_OLD = 'DD_SIDEKIQ_ANALYTICS_SAMPLE_RATE'.freeze
10
13
  ENV_TAG_JOB_ARGS = 'DD_SIDEKIQ_TAG_JOB_ARGS'.freeze
11
14
  SERVICE_NAME = 'sidekiq'.freeze
12
15
  SPAN_PUSH = 'sidekiq.push'.freeze
@@ -12,13 +12,18 @@ module Datadog
12
12
  response: %w[Content-Type X-Request-ID]
13
13
  }.freeze
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, nil) }
21
+ o.default { env_to_bool([Ext::ENV_ANALYTICS_ENABLED, Ext::ENV_ANALYTICS_ENABLED_OLD], nil) }
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