ddtrace 0.38.0 → 0.43.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (194) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +56 -0
  3. data/.github/workflows/add-milestone-to-pull-requests.yml +42 -0
  4. data/.github/workflows/create-next-milestone.yml +20 -0
  5. data/.gitlab-ci.yml +1 -0
  6. data/.simplecov +38 -0
  7. data/Appraisals +293 -105
  8. data/CHANGELOG.md +192 -1
  9. data/CONTRIBUTING.md +2 -2
  10. data/Rakefile +554 -480
  11. data/ddtrace.gemspec +3 -0
  12. data/docs/DevelopmentGuide.md +28 -2
  13. data/docs/GettingStarted.md +207 -82
  14. data/lib/ddtrace.rb +4 -0
  15. data/lib/ddtrace/buffer.rb +259 -52
  16. data/lib/ddtrace/configuration.rb +55 -5
  17. data/lib/ddtrace/configuration/components.rb +4 -7
  18. data/lib/ddtrace/configuration/options.rb +3 -1
  19. data/lib/ddtrace/configuration/settings.rb +18 -6
  20. data/lib/ddtrace/context.rb +18 -0
  21. data/lib/ddtrace/context_provider.rb +17 -5
  22. data/lib/ddtrace/contrib/action_cable/configuration/settings.rb +7 -2
  23. data/lib/ddtrace/contrib/action_cable/ext.rb +5 -2
  24. data/lib/ddtrace/contrib/action_pack/configuration/settings.rb +7 -2
  25. data/lib/ddtrace/contrib/action_pack/ext.rb +5 -2
  26. data/lib/ddtrace/contrib/action_view/configuration/settings.rb +7 -2
  27. data/lib/ddtrace/contrib/action_view/ext.rb +5 -2
  28. data/lib/ddtrace/contrib/active_model_serializers/configuration/settings.rb +7 -2
  29. data/lib/ddtrace/contrib/active_model_serializers/ext.rb +5 -2
  30. data/lib/ddtrace/contrib/active_record/configuration/settings.rb +7 -2
  31. data/lib/ddtrace/contrib/active_record/events/sql.rb +4 -0
  32. data/lib/ddtrace/contrib/active_record/ext.rb +5 -2
  33. data/lib/ddtrace/contrib/active_support/cache/instrumentation.rb +104 -3
  34. data/lib/ddtrace/contrib/active_support/cache/patcher.rb +21 -0
  35. data/lib/ddtrace/contrib/active_support/configuration/settings.rb +7 -2
  36. data/lib/ddtrace/contrib/active_support/ext.rb +8 -2
  37. data/lib/ddtrace/contrib/active_support/notifications/event.rb +10 -0
  38. data/lib/ddtrace/contrib/active_support/notifications/subscription.rb +2 -2
  39. data/lib/ddtrace/contrib/aws/configuration/settings.rb +7 -2
  40. data/lib/ddtrace/contrib/aws/ext.rb +5 -2
  41. data/lib/ddtrace/contrib/aws/instrumentation.rb +6 -1
  42. data/lib/ddtrace/contrib/aws/patcher.rb +0 -1
  43. data/lib/ddtrace/contrib/concurrent_ruby/configuration/settings.rb +5 -0
  44. data/lib/ddtrace/contrib/concurrent_ruby/ext.rb +1 -0
  45. data/lib/ddtrace/contrib/configurable.rb +2 -0
  46. data/lib/ddtrace/contrib/configuration/resolvers/pattern_resolver.rb +4 -5
  47. data/lib/ddtrace/contrib/configuration/settings.rb +1 -0
  48. data/lib/ddtrace/contrib/cucumber/configuration/settings.rb +38 -0
  49. data/lib/ddtrace/contrib/cucumber/ext.rb +19 -0
  50. data/lib/ddtrace/contrib/cucumber/formatter.rb +104 -0
  51. data/lib/ddtrace/contrib/cucumber/instrumentation.rb +24 -0
  52. data/lib/ddtrace/contrib/cucumber/integration.rb +40 -0
  53. data/lib/ddtrace/contrib/cucumber/patcher.rb +23 -0
  54. data/lib/ddtrace/contrib/dalli/configuration/settings.rb +7 -2
  55. data/lib/ddtrace/contrib/dalli/ext.rb +5 -2
  56. data/lib/ddtrace/contrib/dalli/instrumentation.rb +4 -0
  57. data/lib/ddtrace/contrib/delayed_job/configuration/settings.rb +9 -2
  58. data/lib/ddtrace/contrib/delayed_job/ext.rb +7 -2
  59. data/lib/ddtrace/contrib/delayed_job/plugin.rb +39 -15
  60. data/lib/ddtrace/contrib/elasticsearch/configuration/settings.rb +7 -2
  61. data/lib/ddtrace/contrib/elasticsearch/ext.rb +5 -2
  62. data/lib/ddtrace/contrib/elasticsearch/patcher.rb +4 -0
  63. data/lib/ddtrace/contrib/ethon/configuration/settings.rb +7 -2
  64. data/lib/ddtrace/contrib/ethon/easy_patch.rb +4 -2
  65. data/lib/ddtrace/contrib/ethon/ext.rb +5 -2
  66. data/lib/ddtrace/contrib/ethon/multi_patch.rb +4 -0
  67. data/lib/ddtrace/contrib/excon/configuration/settings.rb +7 -2
  68. data/lib/ddtrace/contrib/excon/ext.rb +5 -2
  69. data/lib/ddtrace/contrib/excon/middleware.rb +11 -1
  70. data/lib/ddtrace/contrib/extensions.rb +1 -1
  71. data/lib/ddtrace/contrib/faraday/configuration/settings.rb +7 -2
  72. data/lib/ddtrace/contrib/faraday/ext.rb +5 -2
  73. data/lib/ddtrace/contrib/faraday/middleware.rb +4 -0
  74. data/lib/ddtrace/contrib/faraday/patcher.rb +13 -4
  75. data/lib/ddtrace/contrib/grape/configuration/settings.rb +14 -3
  76. data/lib/ddtrace/contrib/grape/endpoint.rb +24 -7
  77. data/lib/ddtrace/contrib/grape/ext.rb +5 -2
  78. data/lib/ddtrace/contrib/graphql/configuration/settings.rb +7 -2
  79. data/lib/ddtrace/contrib/graphql/ext.rb +5 -2
  80. data/lib/ddtrace/contrib/grpc/configuration/settings.rb +7 -2
  81. data/lib/ddtrace/contrib/grpc/datadog_interceptor/client.rb +5 -1
  82. data/lib/ddtrace/contrib/grpc/datadog_interceptor/server.rb +4 -0
  83. data/lib/ddtrace/contrib/grpc/ext.rb +5 -2
  84. data/lib/ddtrace/contrib/http/configuration/settings.rb +7 -2
  85. data/lib/ddtrace/contrib/http/ext.rb +5 -2
  86. data/lib/ddtrace/contrib/http/instrumentation.rb +6 -2
  87. data/lib/ddtrace/contrib/httprb/configuration/settings.rb +7 -2
  88. data/lib/ddtrace/contrib/httprb/ext.rb +5 -2
  89. data/lib/ddtrace/contrib/httprb/instrumentation.rb +8 -8
  90. data/lib/ddtrace/contrib/kafka/configuration/settings.rb +7 -2
  91. data/lib/ddtrace/contrib/kafka/event.rb +1 -1
  92. data/lib/ddtrace/contrib/kafka/ext.rb +5 -2
  93. data/lib/ddtrace/contrib/mongodb/configuration/settings.rb +7 -2
  94. data/lib/ddtrace/contrib/mongodb/ext.rb +5 -2
  95. data/lib/ddtrace/contrib/mongodb/subscribers.rb +4 -0
  96. data/lib/ddtrace/contrib/mysql2/configuration/settings.rb +7 -2
  97. data/lib/ddtrace/contrib/mysql2/ext.rb +5 -2
  98. data/lib/ddtrace/contrib/mysql2/instrumentation.rb +4 -0
  99. data/lib/ddtrace/contrib/presto/configuration/settings.rb +7 -2
  100. data/lib/ddtrace/contrib/presto/ext.rb +5 -2
  101. data/lib/ddtrace/contrib/presto/instrumentation.rb +3 -0
  102. data/lib/ddtrace/contrib/que/configuration/settings.rb +43 -0
  103. data/lib/ddtrace/contrib/que/ext.rb +30 -0
  104. data/lib/ddtrace/contrib/que/integration.rb +42 -0
  105. data/lib/ddtrace/contrib/que/patcher.rb +24 -0
  106. data/lib/ddtrace/contrib/que/tracer.rb +57 -0
  107. data/lib/ddtrace/contrib/racecar/configuration/settings.rb +7 -2
  108. data/lib/ddtrace/contrib/racecar/event.rb +4 -0
  109. data/lib/ddtrace/contrib/racecar/events.rb +2 -0
  110. data/lib/ddtrace/contrib/racecar/events/consume.rb +27 -0
  111. data/lib/ddtrace/contrib/racecar/ext.rb +6 -2
  112. data/lib/ddtrace/contrib/rack/configuration/settings.rb +7 -2
  113. data/lib/ddtrace/contrib/rack/ext.rb +5 -2
  114. data/lib/ddtrace/contrib/rack/middlewares.rb +2 -0
  115. data/lib/ddtrace/contrib/rails/configuration/settings.rb +12 -2
  116. data/lib/ddtrace/contrib/rails/ext.rb +6 -2
  117. data/lib/ddtrace/contrib/rails/log_injection.rb +81 -0
  118. data/lib/ddtrace/contrib/rails/middlewares.rb +7 -2
  119. data/lib/ddtrace/contrib/rails/patcher.rb +29 -0
  120. data/lib/ddtrace/contrib/rake/configuration/settings.rb +7 -3
  121. data/lib/ddtrace/contrib/rake/ext.rb +5 -2
  122. data/lib/ddtrace/contrib/redis/configuration/settings.rb +7 -2
  123. data/lib/ddtrace/contrib/redis/ext.rb +5 -2
  124. data/lib/ddtrace/contrib/redis/tags.rb +4 -0
  125. data/lib/ddtrace/contrib/resque/configuration/settings.rb +8 -2
  126. data/lib/ddtrace/contrib/resque/ext.rb +5 -2
  127. data/lib/ddtrace/contrib/resque/integration.rb +1 -1
  128. data/lib/ddtrace/contrib/resque/resque_job.rb +1 -1
  129. data/lib/ddtrace/contrib/rest_client/configuration/settings.rb +7 -2
  130. data/lib/ddtrace/contrib/rest_client/ext.rb +5 -2
  131. data/lib/ddtrace/contrib/rest_client/request_patch.rb +4 -0
  132. data/lib/ddtrace/contrib/rspec/configuration/settings.rb +38 -0
  133. data/lib/ddtrace/contrib/rspec/example.rb +61 -0
  134. data/lib/ddtrace/contrib/rspec/example_group.rb +61 -0
  135. data/lib/ddtrace/contrib/rspec/ext.rb +19 -0
  136. data/lib/ddtrace/contrib/rspec/integration.rb +41 -0
  137. data/lib/ddtrace/contrib/rspec/patcher.rb +25 -0
  138. data/lib/ddtrace/contrib/sequel/configuration/settings.rb +7 -2
  139. data/lib/ddtrace/contrib/sequel/database.rb +3 -1
  140. data/lib/ddtrace/contrib/sequel/dataset.rb +3 -2
  141. data/lib/ddtrace/contrib/sequel/ext.rb +6 -2
  142. data/lib/ddtrace/contrib/sequel/utils.rb +35 -6
  143. data/lib/ddtrace/contrib/shoryuken/configuration/settings.rb +8 -2
  144. data/lib/ddtrace/contrib/shoryuken/ext.rb +5 -2
  145. data/lib/ddtrace/contrib/shoryuken/tracer.rb +4 -1
  146. data/lib/ddtrace/contrib/sidekiq/configuration/settings.rb +8 -2
  147. data/lib/ddtrace/contrib/sidekiq/ext.rb +5 -2
  148. data/lib/ddtrace/contrib/sidekiq/server_tracer.rb +4 -1
  149. data/lib/ddtrace/contrib/sinatra/configuration/settings.rb +7 -2
  150. data/lib/ddtrace/contrib/sinatra/env.rb +5 -4
  151. data/lib/ddtrace/contrib/sinatra/ext.rb +5 -2
  152. data/lib/ddtrace/contrib/sinatra/tracer.rb +21 -42
  153. data/lib/ddtrace/contrib/sinatra/tracer_middleware.rb +50 -23
  154. data/lib/ddtrace/contrib/sneakers/configuration/settings.rb +33 -0
  155. data/lib/ddtrace/contrib/sneakers/ext.rb +22 -0
  156. data/lib/ddtrace/contrib/sneakers/integration.rb +41 -0
  157. data/lib/ddtrace/contrib/sneakers/patcher.rb +24 -0
  158. data/lib/ddtrace/contrib/sneakers/tracer.rb +55 -0
  159. data/lib/ddtrace/contrib/status_code_matcher.rb +67 -0
  160. data/lib/ddtrace/contrib/sucker_punch/configuration/settings.rb +7 -2
  161. data/lib/ddtrace/contrib/sucker_punch/ext.rb +5 -2
  162. data/lib/ddtrace/diagnostics/environment_logger.rb +1 -1
  163. data/lib/ddtrace/environment.rb +14 -4
  164. data/lib/ddtrace/ext/app_types.rb +1 -0
  165. data/lib/ddtrace/ext/ci.rb +265 -0
  166. data/lib/ddtrace/ext/diagnostics.rb +2 -1
  167. data/lib/ddtrace/ext/distributed.rb +8 -2
  168. data/lib/ddtrace/ext/git.rb +12 -0
  169. data/lib/ddtrace/ext/integration.rb +8 -0
  170. data/lib/ddtrace/ext/runtime.rb +2 -0
  171. data/lib/ddtrace/ext/test.rb +24 -0
  172. data/lib/ddtrace/ext/transport.rb +1 -0
  173. data/lib/ddtrace/logger.rb +1 -1
  174. data/lib/ddtrace/opentracer/distributed_headers.rb +1 -1
  175. data/lib/ddtrace/propagation/grpc_propagator.rb +18 -6
  176. data/lib/ddtrace/runtime/identity.rb +4 -5
  177. data/lib/ddtrace/runtime/metrics.rb +24 -6
  178. data/lib/ddtrace/sampler.rb +2 -2
  179. data/lib/ddtrace/sampling/rate_limiter.rb +65 -16
  180. data/lib/ddtrace/span.rb +152 -27
  181. data/lib/ddtrace/tracer.rb +25 -13
  182. data/lib/ddtrace/transport/http.rb +15 -0
  183. data/lib/ddtrace/transport/http/adapters/net.rb +8 -2
  184. data/lib/ddtrace/transport/http/adapters/test.rb +2 -0
  185. data/lib/ddtrace/transport/http/statistics.rb +14 -1
  186. data/lib/ddtrace/transport/traces.rb +7 -2
  187. data/lib/ddtrace/utils.rb +16 -13
  188. data/lib/ddtrace/utils/forking.rb +52 -0
  189. data/lib/ddtrace/version.rb +1 -1
  190. data/lib/ddtrace/workers/async.rb +2 -2
  191. data/lib/ddtrace/workers/loop.rb +1 -1
  192. data/lib/ddtrace/workers/polling.rb +1 -1
  193. data/lib/ddtrace/writer.rb +19 -1
  194. metadata +53 -6
@@ -41,10 +41,12 @@ Gem::Specification.new do |spec|
41
41
  spec.add_development_dependency 'opentracing', '>= 0.4.1'
42
42
 
43
43
  # Development dependencies
44
+ spec.add_development_dependency 'concurrent-ruby' # Leave it open as we also have it as an integration and want Appraisal to control the version under test.
44
45
  spec.add_development_dependency 'rake', '>= 10.5'
45
46
  spec.add_development_dependency 'rubocop', '= 0.49.1' if RUBY_VERSION >= '2.1.0'
46
47
  spec.add_development_dependency 'rspec', '~> 3.0'
47
48
  spec.add_development_dependency 'rspec-collection_matchers', '~> 1.1'
49
+ spec.add_development_dependency 'ruby-prof', '~> 1.4' if RUBY_PLATFORM != 'java' && RUBY_VERSION >= '2.4.0'
48
50
  spec.add_development_dependency 'minitest', '= 5.10.1'
49
51
  spec.add_development_dependency 'minitest-around', '0.5.0'
50
52
  spec.add_development_dependency 'minitest-stub_any_instance', '1.0.2'
@@ -67,5 +69,6 @@ Gem::Specification.new do |spec|
67
69
  spec.add_development_dependency 'redcarpet', '~> 3.4' if RUBY_PLATFORM != 'java'
68
70
  spec.add_development_dependency 'pry', '~> 0.10.4'
69
71
  spec.add_development_dependency 'pry-stack_explorer', '~> 0.4.9.2'
72
+ spec.add_development_dependency 'simplecov', '~> 0.17'
70
73
  spec.add_development_dependency 'warning', '~> 1' if RUBY_VERSION >= '2.5.0'
71
74
  end
@@ -98,6 +98,22 @@ $ bundle exec appraisal contrib rake spec:redis'[--seed,1234]'
98
98
 
99
99
  This can be useful for replicating conditions from CI or isolating certain tests.
100
100
 
101
+ **Checking test coverage**
102
+
103
+ You can check test code coverage by creating a report _after_ running a test suite:
104
+ ```
105
+ # Run the desired test suite
106
+ $ bundle exec appraisal contrib rake spec:redis
107
+ # Generate report for the suite executed
108
+ $ bundle exec rake coverage:report
109
+ ```
110
+
111
+ A webpage will be generated at `coverage/report/index.html` with the resulting report.
112
+
113
+ Because you are likely not running all tests locally, your report will contain partial coverage results.
114
+ You *must* check the CI step `coverage` for the complete test coverage report, ensuring coverage is not
115
+ decreased.
116
+
101
117
  ### Checking code quality
102
118
 
103
119
  **Linting**
@@ -108,6 +124,16 @@ The trace library uses Rubocop to enforce [code style](https://github.com/bbatso
108
124
  $ bundle exec rake rubocop
109
125
  ```
110
126
 
127
+ ### Running benchmarks
128
+
129
+ If your changes can have a measurable performance impact, we recommend running our benchmark suite:
130
+
131
+ ```
132
+ $ bundle exec rake spec:benchmark
133
+ ```
134
+
135
+ Results are printed to STDOUT as well as written to the `./tmp/benchmark/` directory.
136
+
111
137
  ## Appendix
112
138
 
113
139
  ### Writing new integrations
@@ -125,9 +151,9 @@ To get started quickly, it's perfectly fine to copy-paste an existing integratio
125
151
 
126
152
  Once you have it working in your application, you can [add unit tests](#writing-tests), [run them locally](#running-tests), and [check for code quality](#checking-code-quality) using Docker Compose.
127
153
 
128
- Then [open a pull request](https://github.com/DataDog/dd-trace-rb/CONTRIBUTING.md#have-a-patch) and be sure to add the following to the description:
154
+ Then [open a pull request](../CONTRIBUTING.md#have-a-patch) and be sure to add the following to the description:
129
155
 
130
- - [Documentation](https://github.com/DataDog/dd-trace-rb/docs/GettingStarted.md) for the integration, including versions supported.
156
+ - [Documentation](./GettingStarted.md) for the integration, including versions supported.
131
157
  - Links to the repository/website of the library being integrated
132
158
  - Screenshots showing a sample trace
133
159
  - Any additional code snippets, sample apps, benchmarks, or other resources that demonstrate its implementation are a huge plus!
@@ -34,6 +34,7 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
34
34
  - [Active Support](#active-support)
35
35
  - [AWS](#aws)
36
36
  - [Concurrent Ruby](#concurrent-ruby)
37
+ - [Cucumber](#cucumber)
37
38
  - [Dalli](#dalli)
38
39
  - [DelayedJob](#delayedjob)
39
40
  - [Elasticsearch](#elasticsearch)
@@ -43,11 +44,12 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
43
44
  - [Grape](#grape)
44
45
  - [GraphQL](#graphql)
45
46
  - [gRPC](#grpc)
46
- - [http.rb](#http.rb)
47
+ - [http.rb](#http-rb)
47
48
  - [MongoDB](#mongodb)
48
49
  - [MySQL2](#mysql2)
49
50
  - [Net/HTTP](#net-http)
50
51
  - [Presto](#presto)
52
+ - [Que](#que)
51
53
  - [Racecar](#racecar)
52
54
  - [Rack](#rack)
53
55
  - [Rails](#rails)
@@ -59,6 +61,7 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
59
61
  - [Sequel](#sequel)
60
62
  - [Sidekiq](#sidekiq)
61
63
  - [Sinatra](#sinatra)
64
+ - [Sneakers](#sneakers)
62
65
  - [Sucker Punch](#sucker-punch)
63
66
  - [Advanced configuration](#advanced-configuration)
64
67
  - [Tracer settings](#tracer-settings)
@@ -91,9 +94,9 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
91
94
  | | | 2.2 | Full | Latest |
92
95
  | | | 2.1 | Full | Latest |
93
96
  | | | 2.0 | Full | Latest |
94
- | | | 1.9.3 | Maintenance (until August 6th, 2020) | < 0.27.0 |
95
- | | | 1.9.1 | Maintenance (until August 6th, 2020) | < 0.27.0 |
96
- | JRuby | http://jruby.org/ | 9.2.0.0 | Alpha | Latest |
97
+ | | | 1.9.3 | EOL since August 6th, 2020 | < 0.27.0 |
98
+ | | | 1.9.1 | EOL since August 6th, 2020 | < 0.27.0 |
99
+ | JRuby | https://www.jruby.org | 9.2 | Full | Latest |
97
100
 
98
101
  **Supported web servers**:
99
102
 
@@ -326,43 +329,46 @@ end
326
329
 
327
330
  For a list of available integrations, and their configuration options, please refer to the following:
328
331
 
329
- | Name | Key | Versions Supported | How to configure | Gem source |
330
- | ------------------------ | -------------------------- | ------------------------ | ----------------------------------- | ------------------------------------------------------------------------------ |
331
- | Action Cable | `action_cable` | `>= 5.0` | *[Link](#action-cable)* | *[Link](https://github.com/rails/rails/tree/master/actioncable)* |
332
- | Action View | `action_view` | `>= 3.0` | *[Link](#action-view)* | *[Link](https://github.com/rails/rails/tree/master/actionview)* |
333
- | Active Model Serializers | `active_model_serializers` | `>= 0.9` | *[Link](#active-model-serializers)* | *[Link](https://github.com/rails-api/active_model_serializers)* |
334
- | Action Pack | `action_pack` | `>= 3.0` | *[Link](#action-pack)* | *[Link](https://github.com/rails/rails/tree/master/actionpack)* |
335
- | Active Record | `active_record` | `>= 3.0` | *[Link](#active-record)* | *[Link](https://github.com/rails/rails/tree/master/activerecord)* |
336
- | Active Support | `active_support` | `>= 3.0` | *[Link](#active-support)* | *[Link](https://github.com/rails/rails/tree/master/activesupport)* |
337
- | AWS | `aws` | `>= 2.0` | *[Link](#aws)* | *[Link](https://github.com/aws/aws-sdk-ruby)* |
338
- | Concurrent Ruby | `concurrent_ruby` | `>= 0.9` | *[Link](#concurrent-ruby)* | *[Link](https://github.com/ruby-concurrency/concurrent-ruby)* |
339
- | Dalli | `dalli` | `>= 2.0` | *[Link](#dalli)* | *[Link](https://github.com/petergoldstein/dalli)* |
340
- | DelayedJob | `delayed_job` | `>= 4.1` | *[Link](#delayedjob)* | *[Link](https://github.com/collectiveidea/delayed_job)* |
341
- | Elasticsearch | `elasticsearch` | `>= 1.0` | *[Link](#elasticsearch)* | *[Link](https://github.com/elastic/elasticsearch-ruby)* |
342
- | Ethon | `ethon` | `>= 0.11` | *[Link](#ethon)* | *[Link](https://github.com/typhoeus/ethon)* |
343
- | Excon | `excon` | `>= 0.50` | *[Link](#excon)* | *[Link](https://github.com/excon/excon)* |
344
- | Faraday | `faraday` | `>= 0.14` | *[Link](#faraday)* | *[Link](https://github.com/lostisland/faraday)* |
345
- | Grape | `grape` | `>= 1.0` | *[Link](#grape)* | *[Link](https://github.com/ruby-grape/grape)* |
346
- | GraphQL | `graphql` | `>= 1.7.9` | *[Link](#graphql)* | *[Link](https://github.com/rmosolgo/graphql-ruby)* |
347
- | gRPC | `grpc` | `>= 1.7` | *[Link](#grpc)* | *[Link](https://github.com/grpc/grpc/tree/master/src/rubyc)* |
348
- | http.rb | `httprb` | `>= 2.0` | *[Link](#http.rb)* | *[Link](https://github.com/httprb/http)* |
349
- | Kafka | `ruby-kafka` | `>= 0.7.10` | *[Link](#kafka)* | |
350
- | MongoDB | `mongo` | `>= 2.1` | *[Link](#mongodb)* | *[Link](https://github.com/mongodb/mongo-ruby-driver)* |
351
- | MySQL2 | `mysql2` | `>= 0.3.21` | *[Link](#mysql2)* | *[Link](https://github.com/brianmario/mysql2)* |
352
- | Net/HTTP | `http` | *(Any supported Ruby)* | *[Link](#nethttp)* | *[Link](https://ruby-doc.org/stdlib-2.4.0/libdoc/net/http/rdoc/Net/HTTP.html)* |
353
- | Presto | `presto` | `>= 0.5.14` | *[Link](#presto)* | *[Link](https://github.com/treasure-data/presto-client-ruby)* |
354
- | Racecar | `racecar` | `>= 0.3.5` | *[Link](#racecar)* | *[Link](https://github.com/zendesk/racecar)* |
355
- | Rack | `rack` | `>= 1.1` | *[Link](#rack)* | *[Link](https://github.com/rack/rack)* |
356
- | Rails | `rails` | `>= 3.0` | *[Link](#rails)* | *[Link](https://github.com/rails/rails)* |
357
- | Rake | `rake` | `>= 12.0` | *[Link](#rake)* | *[Link](https://github.com/ruby/rake)* |
358
- | Redis | `redis` | `>= 3.2` | *[Link](#redis)* | *[Link](https://github.com/redis/redis-rb)* |
359
- | Resque | `resque` | `>= 1.0, < 2.0` | *[Link](#resque)* | *[Link](https://github.com/resque/resque)* |
360
- | Rest Client | `rest-client` | `>= 1.8` | *[Link](#rest-client)* | *[Link](https://github.com/rest-client/rest-client)* |
361
- | Sequel | `sequel` | `>= 3.41` | *[Link](#sequel)* | *[Link](https://github.com/jeremyevans/sequel)* |
362
- | Shoryuken | `shoryuken` | `>= 3.2` | *[Link](#shoryuken)* | *[Link](https://github.com/phstc/shoryuken)* |
363
- | Sidekiq | `sidekiq` | `>= 3.5.4` | *[Link](#sidekiq)* | *[Link](https://github.com/mperham/sidekiq)* |
364
- | Sinatra | `sinatra` | `>= 1.4` | *[Link](#sinatra)* | *[Link](https://github.com/sinatra/sinatra)* |
365
- | Sucker Punch | `sucker_punch` | `>= 2.0` | *[Link](#sucker-punch)* | *[Link](https://github.com/brandonhilkert/sucker_punch)* |
332
+ | Name | Key | Versions Supported: MRI | Versions Supported: JRuby | How to configure | Gem source |
333
+ | ------------------------ | -------------------------- | ------------------------ | --------------------------| ----------------------------------- | ------------------------------------------------------------------------------ |
334
+ | Action Cable | `action_cable` | `>= 5.0` | `>= 5.0` | *[Link](#action-cable)* | *[Link](https://github.com/rails/rails/tree/master/actioncable)* |
335
+ | Action View | `action_view` | `>= 3.0` | `>= 3.0` | *[Link](#action-view)* | *[Link](https://github.com/rails/rails/tree/master/actionview)* |
336
+ | Active Model Serializers | `active_model_serializers` | `>= 0.9` | `>= 0.9` | *[Link](#active-model-serializers)* | *[Link](https://github.com/rails-api/active_model_serializers)* |
337
+ | Action Pack | `action_pack` | `>= 3.0` | `>= 3.0` | *[Link](#action-pack)* | *[Link](https://github.com/rails/rails/tree/master/actionpack)* |
338
+ | Active Record | `active_record` | `>= 3.0` | `>= 3.0` | *[Link](#active-record)* | *[Link](https://github.com/rails/rails/tree/master/activerecord)* |
339
+ | Active Support | `active_support` | `>= 3.0` | `>= 3.0` | *[Link](#active-support)* | *[Link](https://github.com/rails/rails/tree/master/activesupport)* |
340
+ | AWS | `aws` | `>= 2.0` | `>= 2.0` | *[Link](#aws)* | *[Link](https://github.com/aws/aws-sdk-ruby)* |
341
+ | Concurrent Ruby | `concurrent_ruby` | `>= 0.9` | `>= 0.9` | *[Link](#concurrent-ruby)* | *[Link](https://github.com/ruby-concurrency/concurrent-ruby)* |
342
+ | Cucumber | `cucumber` | `>= 3.0` | `>= 1.7.16` | *[Link](#cucumber)* | *[Link](https://github.com/cucumber/cucumber-ruby)* |
343
+ | Dalli | `dalli` | `>= 2.0` | `>= 2.0` | *[Link](#dalli)* | *[Link](https://github.com/petergoldstein/dalli)* |
344
+ | DelayedJob | `delayed_job` | `>= 4.1` | `>= 4.1` | *[Link](#delayedjob)* | *[Link](https://github.com/collectiveidea/delayed_job)* |
345
+ | Elasticsearch | `elasticsearch` | `>= 1.0` | `>= 1.0` | *[Link](#elasticsearch)* | *[Link](https://github.com/elastic/elasticsearch-ruby)* |
346
+ | Ethon | `ethon` | `>= 0.11` | `>= 0.11` | *[Link](#ethon)* | *[Link](https://github.com/typhoeus/ethon)* |
347
+ | Excon | `excon` | `>= 0.50` | `>= 0.50` | *[Link](#excon)* | *[Link](https://github.com/excon/excon)* |
348
+ | Faraday | `faraday` | `>= 0.14` | `>= 0.14` | *[Link](#faraday)* | *[Link](https://github.com/lostisland/faraday)* |
349
+ | Grape | `grape` | `>= 1.0` | `>= 1.0` | *[Link](#grape)* | *[Link](https://github.com/ruby-grape/grape)* |
350
+ | GraphQL | `graphql` | `>= 1.7.9` | `>= 1.7.9` | *[Link](#graphql)* | *[Link](https://github.com/rmosolgo/graphql-ruby)* |
351
+ | gRPC | `grpc` | `>= 1.7` | *gem not available* | *[Link](#grpc)* | *[Link](https://github.com/grpc/grpc/tree/master/src/rubyc)* |
352
+ | http.rb | `httprb` | `>= 2.0` | `>= 2.0` | *[Link](#http-rb)* | *[Link](https://github.com/httprb/http)* |
353
+ | Kafka | `ruby-kafka` | `>= 0.7.10` | `>= 0.7.10` | *[Link](#kafka)* | *[Link](https://github.com/zendesk/ruby-kafka)* |
354
+ | MongoDB | `mongo` | `>= 2.1` | `>= 2.1` | *[Link](#mongodb)* | *[Link](https://github.com/mongodb/mongo-ruby-driver)* |
355
+ | MySQL2 | `mysql2` | `>= 0.3.21` | *gem not available* | *[Link](#mysql2)* | *[Link](https://github.com/brianmario/mysql2)* |
356
+ | Net/HTTP | `http` | *(Any supported Ruby)* | *(Any supported Ruby)* | *[Link](#nethttp)* | *[Link](https://ruby-doc.org/stdlib-2.4.0/libdoc/net/http/rdoc/Net/HTTP.html)* |
357
+ | Presto | `presto` | `>= 0.5.14` | `>= 0.5.14` | *[Link](#presto)* | *[Link](https://github.com/treasure-data/presto-client-ruby)* |
358
+ | Que | `que` | `>= 1.0.0.beta2` | `>= 1.0.0.beta2` | *[Link](#que)* | *[Link](https://github.com/que-rb/que)* |
359
+ | Racecar | `racecar` | `>= 0.3.5` | `>= 0.3.5` | *[Link](#racecar)* | *[Link](https://github.com/zendesk/racecar)* |
360
+ | Rack | `rack` | `>= 1.1` | `>= 1.1` | *[Link](#rack)* | *[Link](https://github.com/rack/rack)* |
361
+ | Rails | `rails` | `>= 3.0` | `>= 3.0` | *[Link](#rails)* | *[Link](https://github.com/rails/rails)* |
362
+ | Rake | `rake` | `>= 12.0` | `>= 12.0` | *[Link](#rake)* | *[Link](https://github.com/ruby/rake)* |
363
+ | Redis | `redis` | `>= 3.2` | `>= 3.2` | *[Link](#redis)* | *[Link](https://github.com/redis/redis-rb)* |
364
+ | Resque | `resque` | `>= 1.0` | `>= 1.0` | *[Link](#resque)* | *[Link](https://github.com/resque/resque)* |
365
+ | Rest Client | `rest-client` | `>= 1.8` | `>= 1.8` | *[Link](#rest-client)* | *[Link](https://github.com/rest-client/rest-client)* |
366
+ | Sequel | `sequel` | `>= 3.41` | `>= 3.41` | *[Link](#sequel)* | *[Link](https://github.com/jeremyevans/sequel)* |
367
+ | Shoryuken | `shoryuken` | `>= 3.2` | `>= 3.2` | *[Link](#shoryuken)* | *[Link](https://github.com/phstc/shoryuken)* |
368
+ | Sidekiq | `sidekiq` | `>= 3.5.4` | `>= 3.5.4` | *[Link](#sidekiq)* | *[Link](https://github.com/mperham/sidekiq)* |
369
+ | Sinatra | `sinatra` | `>= 1.4` | `>= 1.4` | *[Link](#sinatra)* | *[Link](https://github.com/sinatra/sinatra)* |
370
+ | Sneakers | `sneakers` | `>= 2.12.0` | `>= 2.12.0` | *[Link](#sneakers)* | *[Link](https://github.com/jondot/sneakers)* |
371
+ | Sucker Punch | `sucker_punch` | `>= 2.0` | `>= 2.0` | *[Link](#sucker-punch)* | *[Link](https://github.com/brandonhilkert/sucker_punch)* |
366
372
 
367
373
  ### Action Cable
368
374
 
@@ -473,7 +479,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
473
479
  | Key | Description | Default |
474
480
  | ---| --- | --- |
475
481
  | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to the global setting, `false` for off. | `false` |
476
- | `orm_service_name` | Service name used for the Ruby ORM portion of `active_record` instrumentation. Overrides service name for ORM spans if explicitly set, which otherwise inherit their service from their parent. | `'active_record'` |
482
+ | `orm_service_name` | Service name used for the mapping portion of query results to ActiveRecord objects. Inherits service name from parent by default. | _parent.service_name_ (e.g. `'mysql2'`) |
477
483
  | `service_name` | Service name used for database portion of `active_record` instrumentation. | Name of database adapter (e.g. `'mysql2'`) |
478
484
 
479
485
  **Configuring trace settings per database**
@@ -586,6 +592,42 @@ Where `options` is an optional `Hash` that accepts the following parameters:
586
592
  | --- | ----------- | ------- |
587
593
  | `service_name` | Service name used for `concurrent-ruby` instrumentation | `'concurrent-ruby'` |
588
594
 
595
+ ### Cucumber
596
+
597
+ Cucumber integration will trace all executions of scenarios and steps when using `cucumber` framework.
598
+
599
+ To activate your integration, use the `Datadog.configure` method:
600
+
601
+ ```ruby
602
+ require 'cucumber'
603
+ require 'ddtrace'
604
+
605
+ # Configure default Cucumber integration
606
+ Datadog.configure do |c|
607
+ c.use :cucumber, options
608
+ end
609
+
610
+ # Example of how to attach tags from scenario to active span
611
+ Around do |scenario, block|
612
+ active_span = Datadog.configuration[:cucumber][:tracer].active_span
613
+ unless active_span.nil?
614
+ scenario.tags.filter { |tag| tag.include? ':' }.each do |tag|
615
+ active_span.set_tag(*tag.name.split(':', 2))
616
+ end
617
+ end
618
+ block.call
619
+ end
620
+ ```
621
+
622
+ Where `options` is an optional `Hash` that accepts the following parameters:
623
+
624
+ | Key | Description | Default |
625
+ | --- | ----------- | ------- |
626
+ | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `true` |
627
+ | `enabled` | Defines whether Cucumber tests should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
628
+ | `service_name` | Service name used for `cucumber` instrumentation. | `'cucumber'` |
629
+ | `operation_name` | Operation name used for `cucumber` instrumentation. Useful if you want rename automatic trace metrics e.g. `trace.#{operation_name}.errors`. | `'cucumber.test'` |
630
+
589
631
  ### Dalli
590
632
 
591
633
  Dalli integration will trace all calls to your `memcached` server:
@@ -613,7 +655,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
613
655
 
614
656
  ### DelayedJob
615
657
 
616
- The DelayedJob integration uses lifecycle hooks to trace the job executions.
658
+ The DelayedJob integration uses lifecycle hooks to trace the job executions and enqueues.
617
659
 
618
660
  You can enable it through `Datadog.configure`:
619
661
 
@@ -631,6 +673,8 @@ Where `options` is an optional `Hash` that accepts the following parameters:
631
673
  | --- | ----------- | ------- |
632
674
  | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
633
675
  | `service_name` | Service name used for `DelayedJob` instrumentation | `'delayed_job'` |
676
+ | `client_service_name` | Service name used for client-side `DelayedJob` instrumentation | `'delayed_job-client'` |
677
+ | `error_handler` | Custom error handler invoked when a job raises an error. Provided `span` and `error` as arguments. Sets error on the span by default. Useful for ignoring transient errors. | `proc { |span, error| span.set_error(error) unless span.nil? }` |
634
678
 
635
679
  ### Elasticsearch
636
680
 
@@ -811,6 +855,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
811
855
  | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `nil` |
812
856
  | `enabled` | Defines whether Grape should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
813
857
  | `service_name` | Service name used for `grape` instrumentation | `'grape'` |
858
+ | `error_statuses`| Defines a status code or range of status codes which should be marked as errors. `'404,405,500-599'` or `[404,405,'500-599']` | `nil` |
814
859
 
815
860
  ### GraphQL
816
861
 
@@ -1108,6 +1153,31 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1108
1153
  | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1109
1154
  | `service_name` | Service name used for `presto` instrumentation | `'presto'` |
1110
1155
 
1156
+ ### Que
1157
+
1158
+ The Que integration is a middleware which will trace job executions.
1159
+
1160
+ You can enable it through `Datadog.configure`:
1161
+
1162
+ ```ruby
1163
+ require 'ddtrace'
1164
+
1165
+ Datadog.configure do |c|
1166
+ c.use :que, options
1167
+ end
1168
+ ```
1169
+
1170
+ Where `options` is an optional `Hash` that accepts the following parameters:
1171
+
1172
+ | Key | Description | Default |
1173
+ | --- | ----------- | ------- |
1174
+ | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1175
+ | `enabled` | Defines whether Que should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
1176
+ | `service_name` | Service name used for `que` instrumentation | `'que'` |
1177
+ | `tag_args` | Enable tagging of a job's args field. `true` for on, `false` for off. | `false` |
1178
+ | `tag_data` | Enable tagging of a job's data field. `true` for on, `false` for off. | `false` |
1179
+ | `error_handler` | Custom error handler invoked when a job raises an error. Provided `span` and `error` as arguments. Sets error on the span by default. Useful for ignoring transient errors. | `proc { |span, error| span.set_error(error) unless span.nil? }` |
1180
+
1111
1181
  ### Racecar
1112
1182
 
1113
1183
  The Racecar integration provides tracing for Racecar jobs.
@@ -1170,7 +1240,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1170
1240
  | `service_name` | Service name used for `rack` instrumentation | `'rack'` |
1171
1241
  | `web_service_name` | Service name for frontend server request queuing spans. (e.g. `'nginx'`) | `'web-server'` |
1172
1242
 
1173
-
1174
1243
  **Configuring URL quantization behavior**
1175
1244
 
1176
1245
  ```ruby
@@ -1230,17 +1299,18 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1230
1299
  | `middleware_names` | Enables any short-circuited middleware requests to display the middleware name as a resource for the trace. | `false` |
1231
1300
  | `service_name` | Service name used when tracing application requests (on the `rack` level) | `'<app_name>'` (inferred from your Rails application namespace) |
1232
1301
  | `template_base_path` | Used when the template name is parsed. If you don't store your templates in the `views/` folder, you may need to change this value | `'views/'` |
1302
+ | `log_injection` | Automatically enables injection [Trace Correlation](#trace-correlation) information, such as `dd.trace_id`, into Rails logs. Supports the default logger (`ActiveSupport::TaggedLogging`) and `Lograge`. Details on the format of Trace Correlation information can be found in the [Trace Correlation](#trace-correlation) section. | `false` |
1233
1303
 
1234
1304
  **Supported versions**
1235
1305
 
1236
- | Ruby Versions | Supported Rails Versions |
1237
- | ------------- | ------------------------ |
1238
- | 2.0 | 3.0 - 3.2 |
1239
- | 2.1 | 3.0 - 4.2 |
1240
- | 2.2 - 2.3 | 3.0 - 5.2 |
1241
- | 2.4 | 4.2.8 - 5.2 |
1242
- | 2.5 | 4.2.8 - 6.0 |
1243
- | 2.6 - 2.7 | 5.0 - 6.0 |
1306
+ | MRI Versions | JRuby Versions | Rails Versions |
1307
+ | ------------- | -------------- | -------------- |
1308
+ | 2.0 | | 3.0 - 3.2 |
1309
+ | 2.1 | | 3.0 - 4.2 |
1310
+ | 2.2 - 2.3 | | 3.0 - 5.2 |
1311
+ | 2.4 | | 4.2.8 - 5.2 |
1312
+ | 2.5 | | 4.2.8 - 6.0 |
1313
+ | 2.6 - 2.7 | 9.2 | 5.0 - 6.0 |
1244
1314
 
1245
1315
  ### Rake
1246
1316
 
@@ -1407,6 +1477,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1407
1477
  | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to the global setting, `false` for off. | `false` |
1408
1478
  | `service_name` | Service name used for `resque` instrumentation | `'resque'` |
1409
1479
  | `workers` | An array including all worker classes you want to trace (e.g. `[MyJob]`) | `[]` |
1480
+ | `error_handler` | Custom error handler invoked when a job raises an error. Provided `span` and `error` as arguments. Sets error on the span by default. Useful for ignoring transient errors. | `proc { |span, error| span.set_error(error) unless span.nil? }` |
1410
1481
 
1411
1482
  ### Rest Client
1412
1483
 
@@ -1429,6 +1500,31 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1429
1500
  | `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
1430
1501
  | `service_name` | Service name for `rest_client` instrumentation. | `'rest_client'` |
1431
1502
 
1503
+ ## RSpec
1504
+
1505
+ RSpec integration will trace all executions of example groups and examples when using `rspec` test framework.
1506
+
1507
+ To activate your integration, use the `Datadog.configure` method:
1508
+
1509
+ ```ruby
1510
+ require 'rspec'
1511
+ require 'ddtrace'
1512
+
1513
+ # Configure default RSpec integration
1514
+ Datadog.configure do |c|
1515
+ c.use :rspec, options
1516
+ end
1517
+ ```
1518
+
1519
+ Where `options` is an optional `Hash` that accepts the following parameters:
1520
+
1521
+ | Key | Description | Default |
1522
+ | --- | ----------- | ------- |
1523
+ | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `true` |
1524
+ | `enabled` | Defines whether RSpec tests should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
1525
+ | `service_name` | Service name used for `rspec` instrumentation. | `'rspec'` |
1526
+ | `operation_name` | Operation name used for `rspec` instrumentation. Useful if you want rename automatic trace metrics e.g. `trace.#{operation_name}.errors`. | `'rspec.example'` |
1527
+
1432
1528
  ### Sequel
1433
1529
 
1434
1530
  The Sequel integration traces queries made to your database.
@@ -1497,6 +1593,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1497
1593
  | --- | ----------- | ------- |
1498
1594
  | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1499
1595
  | `service_name` | Service name used for `shoryuken` instrumentation | `'shoryuken'` |
1596
+ | `error_handler` | Custom error handler invoked when a job raises an error. Provided `span` and `error` as arguments. Sets error on the span by default. Useful for ignoring transient errors. | `proc { |span, error| span.set_error(error) unless span.nil? }` |
1500
1597
 
1501
1598
  ### Sidekiq
1502
1599
 
@@ -1520,6 +1617,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1520
1617
  | `client_service_name` | Service name used for client-side `sidekiq` instrumentation | `'sidekiq-client'` |
1521
1618
  | `service_name` | Service name used for server-side `sidekiq` instrumentation | `'sidekiq'` |
1522
1619
  | `tag_args` | Enable tagging of job arguments. `true` for on, `false` for off. | `false` |
1620
+ | `error_handler` | Custom error handler invoked when a job raises an error. Provided `span` and `error` as arguments. Sets error on the span by default. Useful for ignoring transient errors. | `proc { |span, error| span.set_error(error) unless span.nil? }` |
1523
1621
 
1524
1622
  ### Sinatra
1525
1623
 
@@ -1585,6 +1683,30 @@ Ensure you register `Datadog::Contrib::Sinatra::Tracer` as a middleware before y
1585
1683
  | `resource_script_names` | Prepend resource names with script name | `false` |
1586
1684
  | `service_name` | Service name used for `sinatra` instrumentation | `'sinatra'` |
1587
1685
 
1686
+ ### Sneakers
1687
+
1688
+ The Sneakers integration is a server-side middleware which will trace job executions.
1689
+
1690
+ You can enable it through `Datadog.configure`:
1691
+
1692
+ ```ruby
1693
+ require 'ddtrace'
1694
+
1695
+ Datadog.configure do |c|
1696
+ c.use :sneakers, options
1697
+ end
1698
+ ```
1699
+
1700
+ Where `options` is an optional `Hash` that accepts the following parameters:
1701
+
1702
+ | Key | Description | Default |
1703
+ | --- | ----------- | ------- |
1704
+ | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1705
+ | `enabled` | Defines whether Sneakers should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
1706
+ | `service_name` | Service name used for `sneakers` instrumentation | `'sneakers'` |
1707
+ | `tag_body` | Enable tagging of job message. `true` for on, `false` for off. | `false` |
1708
+ | `error_handler` | Custom error handler invoked when a job raises an error. Provided `span` and `error` as arguments. Sets error on the span by default. Useful for ignoring transient errors. | `proc { |span, error| span.set_error(error) unless span.nil? }` |
1709
+
1588
1710
  ### Sucker Punch
1589
1711
 
1590
1712
  The `sucker_punch` integration traces all scheduled jobs:
@@ -1633,13 +1755,14 @@ end
1633
1755
 
1634
1756
  Available options are:
1635
1757
 
1636
- - `enabled`: defines if the `tracer` is enabled or not. If set to `false` instrumentation will still run, but no spans are sent to the trace agent.
1758
+ - `enabled`: defines if the `tracer` is enabled or not. If set to `false` instrumentation will still run, but no spans are sent to the trace agent. Can be configured through the `DD_TRACE_ENABLED` environment variable. Defaults to `true`.
1637
1759
  - `hostname`: set the hostname of the trace agent.
1638
1760
  - `instance`: set to a custom `Datadog::Tracer` instance. If provided, other trace settings are ignored (you must configure it manually.)
1639
1761
  - `partial_flush.enabled`: set to `true` to enable partial trace flushing (for long running traces.) Disabled by default. *Experimental.*
1640
1762
  - `port`: set the port the trace agent is listening on.
1641
1763
  - `sampler`: set to a custom `Datadog::Sampler` instance. If provided, the tracer will use this sampler to determine sampling behavior.
1642
1764
  - `diagnostics.startup_logs.enabled`: Startup configuration and diagnostic log. Defaults to `true`. Can be configured through the `DD_TRACE_STARTUP_LOGS` environment variable.
1765
+ - `diagnostics.debug`: set to true to enable debug logging. Can be configured through the `DD_TRACE_DEBUG` environment variable. Defaults to `false`.
1643
1766
 
1644
1767
  #### Custom logging
1645
1768
 
@@ -1687,6 +1810,16 @@ This enables you to set this value on a per application basis, so you can have f
1687
1810
 
1688
1811
  Tags can also be set directly on individual spans, which will supersede any conflicting tags defined at the application level.
1689
1812
 
1813
+ ### Environment variables
1814
+
1815
+ Other Environment Variables:
1816
+
1817
+ - `DD_TRACE_AGENT_URL`: Sets the URL endpoint where traces are sent. Has priority over `DD_AGENT_HOST` and `DD_TRACE_AGENT_PORT` if set. e.g. `DD_TRACE_AGENT_URL=http://localhost:8126`.
1818
+ - `DD_TRACE_<INTEGRATION>_ENABLED`: Enables or disables an **activated** integration. Defaults to `true`.. e.g. `DD_TRACE_RAILS_ENABLED=false`. This option has no effects on integrations that have not been explicitly activated (e.g. `Datadog.configure{ |c| c.use :integration }`).on code. This environment variable can only be used to disable an integration.
1819
+ - `DD_TRACE_<INTEGRATION>_ANALYTICS_ENABLED`: Enables or disable App Analytics for a specific integration. Valid values are: true or false (default). e.g. `DD_TRACE_ACTION_CABLE_ANALYTICS_ENABLED=true`.
1820
+ - `DD_TRACE_<INTEGRATION>_ANALYTICS_SAMPLE_RATE`: Sets the App Analytics sampling rate for a specific integration. A floating number between 0.0 and 1.0 (default). e.g. `DD_TRACE_ACTION_CABLE_ANALYTICS_SAMPLE_RATE=0.5`.
1821
+ - `DD_LOGS_INJECTION`: Automatically enables injection [Trace Correlation](#trace-correlation) information, such as `dd.trace_id`, into Rails logs. Supports the default logger (`ActiveSupport::TaggedLogging`) and `Lograge`. Details on the format of Trace Correlation information can be found in the [Trace Correlation](#trace-correlation) section. Valid values are: `true` or `false`(default). e.g. `DD_LOGS_INJECTION=true`.
1822
+
1690
1823
  ### Sampling
1691
1824
 
1692
1825
  `ddtrace` can perform trace sampling. While the trace agent already samples traces to reduce bandwidth usage, client sampling reduces the performance overhead.
@@ -1852,7 +1985,7 @@ For more details on how to activate distributed tracing for integrations, see th
1852
1985
  - [Rack](#rack)
1853
1986
  - [Rails](#rails)
1854
1987
  - [Sinatra](#sinatra)
1855
- - [http.rb](#http.rb)
1988
+ - [http.rb](#http-rb)
1856
1989
 
1857
1990
  **Using the HTTP propagator**
1858
1991
 
@@ -1966,34 +2099,28 @@ Datadog::Pipeline.before_flush(
1966
2099
 
1967
2100
  ### Trace correlation
1968
2101
 
1969
- In many cases, such as logging, it may be useful to correlate trace IDs to other events or data streams, for easier cross-referencing. The tracer can produce a correlation identifier for the currently active trace via `active_correlation`, which can be used to decorate these other data sources.
2102
+ In many cases, such as logging, it may be useful to correlate trace IDs to other events or data streams, for easier cross-referencing.
2103
+
2104
+ #### For logging in Rails applications
2105
+
2106
+ ##### Automatic
2107
+
2108
+ For Rails applications using the default logger (`ActiveSupport::TaggedLogging`) or `lograge`, you can automatically enable trace correlation injection by setting the `rails` instrumentation configuration option `log_injection` to `true` or by setting environment variable `DD_LOGS_INJECTION=true`:
1970
2109
 
1971
2110
  ```ruby
1972
- # When a trace is active...
1973
- Datadog.tracer.trace('correlation.example') do
1974
- # Returns #<Datadog::Correlation::Identifier>
1975
- correlation = Datadog.tracer.active_correlation
1976
- correlation.trace_id # => 5963550561812073440
1977
- correlation.span_id # => 2232727802607726424
1978
- correlation.env # => 'production' (derived from DD_ENV)
1979
- correlation.service # => 'billing-api' (derived from DD_SERVICE)
1980
- correlation.version # => '2.5.17' (derived from DD_VERSION)
1981
- end
2111
+ # config/initializers/datadog.rb
2112
+ require 'ddtrace'
1982
2113
 
1983
- # When a trace isn't active...
1984
- correlation = Datadog.tracer.active_correlation
1985
- # Returns #<Datadog::Correlation::Identifier>
1986
- correlation = Datadog.tracer.active_correlation
1987
- correlation.trace_id # => 0
1988
- correlation.span_id # => 0
1989
- correlation.env # => 'production' (derived from DD_ENV)
1990
- correlation.service # => 'billing-api' (derived from DD_SERVICE)
1991
- correlation.version # => '2.5.17' (derived from DD_VERSION)
2114
+ Datadog.configure do |c|
2115
+ c.use :rails, log_injection: true
2116
+ end
1992
2117
  ```
1993
2118
 
1994
- #### For logging in Rails applications using Lograge (recommended)
2119
+ _Note:_ For `lograge` users who have also defined `lograge.custom_options` in an `initializers/lograge.rb` configuration file, due to the order that Rails loads initializers (alphabetical), automatic trace correlation may not take effect, since `initializers/datadog.rb` would be overwritten by the `initializers/lograge.rb` initializer. To support automatic trace correlation with _existing_ `lograge.custom_options`, use the [Manual (Lograge)](#manual-lograge) configuration below.
2120
+
2121
+ ##### Manual (Lograge)
1995
2122
 
1996
- After [setting up Lograge in a Rails application](https://docs.datadoghq.com/logs/log_collection/ruby/), modify the `custom_options` block in your environment configuration file (e.g. `config/environments/production.rb`) to add the trace IDs:
2123
+ After [setting up Lograge in a Rails application](https://docs.datadoghq.com/logs/log_collection/ruby/), manually modify the `custom_options` block in your environment configuration file (e.g. `config/environments/production.rb`) to add the trace IDs.
1997
2124
 
1998
2125
  ```ruby
1999
2126
  config.lograge.custom_options = lambda do |event|
@@ -2016,11 +2143,9 @@ config.lograge.custom_options = lambda do |event|
2016
2143
  end
2017
2144
  ```
2018
2145
 
2019
- #### For logging in Rails applications
2020
-
2021
- Rails applications which are configured with an `ActiveSupport::TaggedLogging` logger can append correlation IDs as tags to log output. The default Rails logger implements this tagged logging, making it easier to add correlation tags.
2146
+ ##### Manual (ActiveSupport::TaggedLogging)
2022
2147
 
2023
- In your Rails environment configuration file, add the following:
2148
+ Rails applications which are configured with the default `ActiveSupport::TaggedLogging` logger can append correlation IDs as tags to log output. To enable Trace Correlation with `ActiveSupport::TaggedLogging`, in your Rails environment configuration file, add the following:
2024
2149
 
2025
2150
  ```ruby
2026
2151
  Rails.application.configure do
@@ -2179,13 +2304,13 @@ end
2179
2304
 
2180
2305
  See the [Dogstatsd documentation](https://www.rubydoc.info/github/DataDog/dogstatsd-ruby/master/frames) for more details about configuring `Datadog::Statsd`.
2181
2306
 
2182
- The stats sent will include:
2307
+ The stats are VM specific and will include:
2183
2308
 
2184
2309
  | Name | Type | Description |
2185
2310
  | -------------------------- | ------- | -------------------------------------------------------- |
2186
2311
  | `runtime.ruby.class_count` | `gauge` | Number of classes in memory space. |
2187
2312
  | `runtime.ruby.thread_count` | `gauge` | Number of threads. |
2188
- | `runtime.ruby.gc.*`. | `gauge` | Garbage collection statistics (one per value in GC.stat) |
2313
+ | `runtime.ruby.gc.*`. | `gauge` | Garbage collection statistics: collected from `GC.stat`. |
2189
2314
 
2190
2315
  In addition, all metrics include the following tags:
2191
2316