ddtrace 0.37.0 → 0.42.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +56 -0
- data/.gitignore +2 -0
- data/.gitlab-ci.yml +1 -0
- data/.simplecov +38 -0
- data/Appraisals +186 -11
- data/CHANGELOG.md +188 -1
- data/CONTRIBUTING.md +1 -1
- data/Rakefile +518 -482
- data/ddtrace.gemspec +3 -0
- data/docker-compose.yml +2 -2
- data/docs/DevelopmentGuide.md +26 -0
- data/docs/GettingStarted.md +188 -78
- data/lib/ddtrace.rb +4 -0
- data/lib/ddtrace/buffer.rb +259 -52
- data/lib/ddtrace/configuration.rb +39 -5
- data/lib/ddtrace/configuration/components.rb +4 -7
- data/lib/ddtrace/configuration/options.rb +3 -1
- data/lib/ddtrace/configuration/settings.rb +32 -4
- data/lib/ddtrace/context_provider.rb +6 -5
- data/lib/ddtrace/contrib/action_cable/configuration/settings.rb +7 -2
- data/lib/ddtrace/contrib/action_cable/ext.rb +5 -2
- data/lib/ddtrace/contrib/action_pack/configuration/settings.rb +7 -2
- data/lib/ddtrace/contrib/action_pack/ext.rb +5 -2
- data/lib/ddtrace/contrib/action_view/configuration/settings.rb +7 -2
- data/lib/ddtrace/contrib/action_view/ext.rb +5 -2
- data/lib/ddtrace/contrib/active_model_serializers/configuration/settings.rb +7 -2
- data/lib/ddtrace/contrib/active_model_serializers/ext.rb +5 -2
- data/lib/ddtrace/contrib/active_record/configuration/settings.rb +7 -2
- data/lib/ddtrace/contrib/active_record/events/sql.rb +4 -0
- data/lib/ddtrace/contrib/active_record/ext.rb +5 -2
- data/lib/ddtrace/contrib/active_support/configuration/settings.rb +7 -2
- data/lib/ddtrace/contrib/active_support/ext.rb +5 -2
- data/lib/ddtrace/contrib/active_support/notifications/subscription.rb +3 -3
- data/lib/ddtrace/contrib/aws/configuration/settings.rb +7 -2
- data/lib/ddtrace/contrib/aws/ext.rb +5 -2
- data/lib/ddtrace/contrib/aws/instrumentation.rb +4 -0
- data/lib/ddtrace/contrib/concurrent_ruby/configuration/settings.rb +5 -0
- data/lib/ddtrace/contrib/concurrent_ruby/ext.rb +1 -0
- data/lib/ddtrace/contrib/configuration/settings.rb +1 -0
- data/lib/ddtrace/contrib/dalli/configuration/settings.rb +7 -2
- data/lib/ddtrace/contrib/dalli/ext.rb +5 -2
- data/lib/ddtrace/contrib/dalli/instrumentation.rb +4 -0
- data/lib/ddtrace/contrib/delayed_job/configuration/settings.rb +8 -2
- data/lib/ddtrace/contrib/delayed_job/ext.rb +7 -2
- data/lib/ddtrace/contrib/delayed_job/plugin.rb +37 -15
- data/lib/ddtrace/contrib/elasticsearch/configuration/settings.rb +7 -2
- data/lib/ddtrace/contrib/elasticsearch/ext.rb +5 -2
- data/lib/ddtrace/contrib/elasticsearch/patcher.rb +4 -0
- data/lib/ddtrace/contrib/ethon/configuration/settings.rb +7 -2
- data/lib/ddtrace/contrib/ethon/easy_patch.rb +4 -2
- data/lib/ddtrace/contrib/ethon/ext.rb +5 -2
- data/lib/ddtrace/contrib/ethon/multi_patch.rb +4 -0
- data/lib/ddtrace/contrib/excon/configuration/settings.rb +7 -2
- data/lib/ddtrace/contrib/excon/ext.rb +5 -2
- data/lib/ddtrace/contrib/excon/middleware.rb +4 -0
- data/lib/ddtrace/contrib/extensions.rb +11 -1
- data/lib/ddtrace/contrib/faraday/configuration/settings.rb +7 -2
- data/lib/ddtrace/contrib/faraday/ext.rb +5 -2
- data/lib/ddtrace/contrib/faraday/middleware.rb +9 -3
- data/lib/ddtrace/contrib/faraday/patcher.rb +12 -0
- data/lib/ddtrace/contrib/grape/configuration/settings.rb +7 -3
- data/lib/ddtrace/contrib/grape/endpoint.rb +6 -4
- data/lib/ddtrace/contrib/grape/ext.rb +5 -2
- data/lib/ddtrace/contrib/graphql/configuration/settings.rb +7 -2
- data/lib/ddtrace/contrib/graphql/ext.rb +5 -2
- data/lib/ddtrace/contrib/grpc/configuration/settings.rb +7 -2
- data/lib/ddtrace/contrib/grpc/datadog_interceptor/client.rb +6 -4
- data/lib/ddtrace/contrib/grpc/datadog_interceptor/server.rb +4 -0
- data/lib/ddtrace/contrib/grpc/ext.rb +5 -2
- data/lib/ddtrace/contrib/http/configuration/settings.rb +7 -2
- data/lib/ddtrace/contrib/http/ext.rb +5 -2
- data/lib/ddtrace/contrib/http/instrumentation.rb +4 -0
- data/lib/ddtrace/contrib/httprb/configuration/settings.rb +32 -0
- data/lib/ddtrace/contrib/httprb/ext.rb +17 -0
- data/lib/ddtrace/contrib/httprb/instrumentation.rb +163 -0
- data/lib/ddtrace/contrib/httprb/integration.rb +43 -0
- data/lib/ddtrace/contrib/httprb/patcher.rb +35 -0
- data/lib/ddtrace/contrib/kafka/configuration/settings.rb +30 -0
- data/lib/ddtrace/contrib/kafka/consumer_event.rb +14 -0
- data/lib/ddtrace/contrib/kafka/consumer_group_event.rb +14 -0
- data/lib/ddtrace/contrib/kafka/event.rb +51 -0
- data/lib/ddtrace/contrib/kafka/events.rb +44 -0
- data/lib/ddtrace/contrib/kafka/events/connection/request.rb +34 -0
- data/lib/ddtrace/contrib/kafka/events/consumer/process_batch.rb +41 -0
- data/lib/ddtrace/contrib/kafka/events/consumer/process_message.rb +39 -0
- data/lib/ddtrace/contrib/kafka/events/consumer_group/heartbeat.rb +39 -0
- data/lib/ddtrace/contrib/kafka/events/consumer_group/join_group.rb +29 -0
- data/lib/ddtrace/contrib/kafka/events/consumer_group/leave_group.rb +29 -0
- data/lib/ddtrace/contrib/kafka/events/consumer_group/sync_group.rb +29 -0
- data/lib/ddtrace/contrib/kafka/events/produce_operation/send_messages.rb +32 -0
- data/lib/ddtrace/contrib/kafka/events/producer/deliver_messages.rb +35 -0
- data/lib/ddtrace/contrib/kafka/ext.rb +41 -0
- data/lib/ddtrace/contrib/kafka/integration.rb +39 -0
- data/lib/ddtrace/contrib/kafka/patcher.rb +26 -0
- data/lib/ddtrace/contrib/mongodb/configuration/settings.rb +7 -2
- data/lib/ddtrace/contrib/mongodb/ext.rb +5 -2
- data/lib/ddtrace/contrib/mongodb/subscribers.rb +4 -0
- data/lib/ddtrace/contrib/mysql2/configuration/settings.rb +7 -2
- data/lib/ddtrace/contrib/mysql2/ext.rb +5 -2
- data/lib/ddtrace/contrib/mysql2/instrumentation.rb +4 -0
- data/lib/ddtrace/contrib/presto/configuration/settings.rb +7 -2
- data/lib/ddtrace/contrib/presto/ext.rb +5 -2
- data/lib/ddtrace/contrib/presto/instrumentation.rb +3 -0
- data/lib/ddtrace/contrib/que/configuration/settings.rb +42 -0
- data/lib/ddtrace/contrib/que/ext.rb +30 -0
- data/lib/ddtrace/contrib/que/integration.rb +42 -0
- data/lib/ddtrace/contrib/que/patcher.rb +24 -0
- data/lib/ddtrace/contrib/que/tracer.rb +56 -0
- data/lib/ddtrace/contrib/racecar/configuration/settings.rb +7 -2
- data/lib/ddtrace/contrib/racecar/event.rb +4 -0
- data/lib/ddtrace/contrib/racecar/events.rb +2 -0
- data/lib/ddtrace/contrib/racecar/events/consume.rb +27 -0
- data/lib/ddtrace/contrib/racecar/ext.rb +6 -2
- data/lib/ddtrace/contrib/rack/configuration/settings.rb +7 -2
- data/lib/ddtrace/contrib/rack/ext.rb +5 -2
- data/lib/ddtrace/contrib/rack/middlewares.rb +17 -12
- data/lib/ddtrace/contrib/rails/configuration/settings.rb +12 -2
- data/lib/ddtrace/contrib/rails/ext.rb +6 -2
- data/lib/ddtrace/contrib/rails/log_injection.rb +81 -0
- data/lib/ddtrace/contrib/rails/middlewares.rb +7 -2
- data/lib/ddtrace/contrib/rails/patcher.rb +26 -0
- data/lib/ddtrace/contrib/rake/configuration/settings.rb +7 -3
- data/lib/ddtrace/contrib/rake/ext.rb +5 -2
- data/lib/ddtrace/contrib/redis/configuration/settings.rb +7 -2
- data/lib/ddtrace/contrib/redis/ext.rb +5 -2
- data/lib/ddtrace/contrib/redis/tags.rb +4 -0
- data/lib/ddtrace/contrib/resque/configuration/settings.rb +7 -2
- data/lib/ddtrace/contrib/resque/ext.rb +5 -2
- data/lib/ddtrace/contrib/resque/integration.rb +1 -1
- data/lib/ddtrace/contrib/rest_client/configuration/settings.rb +7 -2
- data/lib/ddtrace/contrib/rest_client/ext.rb +5 -2
- data/lib/ddtrace/contrib/rest_client/request_patch.rb +6 -2
- data/lib/ddtrace/contrib/sequel/configuration/settings.rb +7 -2
- data/lib/ddtrace/contrib/sequel/database.rb +3 -1
- data/lib/ddtrace/contrib/sequel/dataset.rb +3 -2
- data/lib/ddtrace/contrib/sequel/ext.rb +6 -2
- data/lib/ddtrace/contrib/sequel/utils.rb +35 -6
- data/lib/ddtrace/contrib/shoryuken/configuration/settings.rb +7 -2
- data/lib/ddtrace/contrib/shoryuken/ext.rb +5 -2
- data/lib/ddtrace/contrib/sidekiq/configuration/settings.rb +7 -2
- data/lib/ddtrace/contrib/sidekiq/ext.rb +6 -2
- data/lib/ddtrace/contrib/sidekiq/patcher.rb +8 -1
- data/lib/ddtrace/contrib/sidekiq/server_tracer.rb +1 -0
- data/lib/ddtrace/contrib/sinatra/configuration/settings.rb +7 -2
- data/lib/ddtrace/contrib/sinatra/env.rb +5 -4
- data/lib/ddtrace/contrib/sinatra/ext.rb +5 -2
- data/lib/ddtrace/contrib/sinatra/tracer.rb +21 -42
- data/lib/ddtrace/contrib/sinatra/tracer_middleware.rb +50 -23
- data/lib/ddtrace/contrib/sneakers/configuration/settings.rb +32 -0
- data/lib/ddtrace/contrib/sneakers/ext.rb +22 -0
- data/lib/ddtrace/contrib/sneakers/integration.rb +41 -0
- data/lib/ddtrace/contrib/sneakers/patcher.rb +24 -0
- data/lib/ddtrace/contrib/sneakers/tracer.rb +58 -0
- data/lib/ddtrace/contrib/sucker_punch/configuration/settings.rb +7 -2
- data/lib/ddtrace/contrib/sucker_punch/ext.rb +5 -2
- data/lib/ddtrace/diagnostics/environment_logger.rb +278 -0
- data/lib/ddtrace/environment.rb +17 -3
- data/lib/ddtrace/ext/diagnostics.rb +3 -0
- data/lib/ddtrace/ext/environment.rb +2 -0
- data/lib/ddtrace/ext/integration.rb +8 -0
- data/lib/ddtrace/ext/runtime.rb +1 -0
- data/lib/ddtrace/ext/transport.rb +1 -0
- data/lib/ddtrace/logger.rb +1 -1
- data/lib/ddtrace/opentracer/distributed_headers.rb +1 -1
- data/lib/ddtrace/pipeline/span_filter.rb +15 -15
- data/lib/ddtrace/propagation/grpc_propagator.rb +18 -6
- data/lib/ddtrace/runtime/metrics.rb +24 -6
- data/lib/ddtrace/sampler.rb +4 -2
- data/lib/ddtrace/span.rb +162 -27
- data/lib/ddtrace/tracer.rb +24 -18
- data/lib/ddtrace/transport/http.rb +15 -0
- data/lib/ddtrace/transport/http/adapters/net.rb +16 -2
- data/lib/ddtrace/transport/http/adapters/test.rb +6 -0
- data/lib/ddtrace/transport/http/adapters/unix_socket.rb +4 -0
- data/lib/ddtrace/transport/http/statistics.rb +14 -1
- data/lib/ddtrace/transport/response.rb +11 -0
- data/lib/ddtrace/transport/traces.rb +7 -2
- data/lib/ddtrace/utils.rb +7 -3
- data/lib/ddtrace/version.rb +1 -1
- data/lib/ddtrace/workers/async.rb +2 -2
- data/lib/ddtrace/workers/loop.rb +1 -1
- data/lib/ddtrace/workers/polling.rb +1 -1
- data/lib/ddtrace/workers/trace_writer.rb +3 -0
- data/lib/ddtrace/writer.rb +33 -12
- metadata +81 -2
data/ddtrace.gemspec
CHANGED
@@ -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
|
data/docker-compose.yml
CHANGED
@@ -281,11 +281,11 @@ services:
|
|
281
281
|
- bundle-jruby-9.2:/usr/local/bundle
|
282
282
|
- gemfiles-jruby-9.2:/app/gemfiles
|
283
283
|
ddagent:
|
284
|
-
image: datadog/
|
284
|
+
image: datadog/agent
|
285
285
|
environment:
|
286
286
|
- DD_APM_ENABLED=true
|
287
287
|
- DD_BIND_HOST=0.0.0.0
|
288
|
-
- DD_API_KEY=
|
288
|
+
- DD_API_KEY=00000000000000000000000000000000
|
289
289
|
expose:
|
290
290
|
- "8125/udp"
|
291
291
|
- "8126"
|
data/docs/DevelopmentGuide.md
CHANGED
@@ -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
|
data/docs/GettingStarted.md
CHANGED
@@ -43,10 +43,12 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
|
|
43
43
|
- [Grape](#grape)
|
44
44
|
- [GraphQL](#graphql)
|
45
45
|
- [gRPC](#grpc)
|
46
|
+
- [http.rb](#http-rb)
|
46
47
|
- [MongoDB](#mongodb)
|
47
48
|
- [MySQL2](#mysql2)
|
48
49
|
- [Net/HTTP](#net-http)
|
49
50
|
- [Presto](#presto)
|
51
|
+
- [Que](#que)
|
50
52
|
- [Racecar](#racecar)
|
51
53
|
- [Rack](#rack)
|
52
54
|
- [Rails](#rails)
|
@@ -58,6 +60,7 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
|
|
58
60
|
- [Sequel](#sequel)
|
59
61
|
- [Sidekiq](#sidekiq)
|
60
62
|
- [Sinatra](#sinatra)
|
63
|
+
- [Sneakers](#sneakers)
|
61
64
|
- [Sucker Punch](#sucker-punch)
|
62
65
|
- [Advanced configuration](#advanced-configuration)
|
63
66
|
- [Tracer settings](#tracer-settings)
|
@@ -90,9 +93,9 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
|
|
90
93
|
| | | 2.2 | Full | Latest |
|
91
94
|
| | | 2.1 | Full | Latest |
|
92
95
|
| | | 2.0 | Full | Latest |
|
93
|
-
| | | 1.9.3 |
|
94
|
-
| | | 1.9.1 |
|
95
|
-
| JRuby |
|
96
|
+
| | | 1.9.3 | EOL since August 6th, 2020 | < 0.27.0 |
|
97
|
+
| | | 1.9.1 | EOL since August 6th, 2020 | < 0.27.0 |
|
98
|
+
| JRuby | https://www.jruby.org | 9.2 | Full | Latest |
|
96
99
|
|
97
100
|
**Supported web servers**:
|
98
101
|
|
@@ -325,41 +328,45 @@ end
|
|
325
328
|
|
326
329
|
For a list of available integrations, and their configuration options, please refer to the following:
|
327
330
|
|
328
|
-
| Name | Key | Versions Supported
|
329
|
-
| ------------------------ | -------------------------- | ------------------------ | ----------------------------------- | ------------------------------------------------------------------------------ |
|
330
|
-
| Action Cable | `action_cable` | `>= 5.0` | *[Link](#action-cable)* | *[Link](https://github.com/rails/rails/tree/master/actioncable)* |
|
331
|
-
| Action View | `action_view` | `>= 3.0` | *[Link](#action-view)* | *[Link](https://github.com/rails/rails/tree/master/actionview)* |
|
332
|
-
| Active Model Serializers | `active_model_serializers` | `>= 0.9` | *[Link](#active-model-serializers)* | *[Link](https://github.com/rails-api/active_model_serializers)* |
|
333
|
-
| Action Pack | `action_pack` | `>= 3.0` | *[Link](#action-pack)* | *[Link](https://github.com/rails/rails/tree/master/actionpack)* |
|
334
|
-
| Active Record | `active_record` | `>= 3.0` | *[Link](#active-record)* | *[Link](https://github.com/rails/rails/tree/master/activerecord)* |
|
335
|
-
| Active Support | `active_support` | `>= 3.0` | *[Link](#active-support)* | *[Link](https://github.com/rails/rails/tree/master/activesupport)* |
|
336
|
-
| AWS | `aws` | `>= 2.0` | *[Link](#aws)* | *[Link](https://github.com/aws/aws-sdk-ruby)* |
|
337
|
-
| Concurrent Ruby | `concurrent_ruby` | `>= 0.9` | *[Link](#concurrent-ruby)* | *[Link](https://github.com/ruby-concurrency/concurrent-ruby)* |
|
338
|
-
| Dalli | `dalli` | `>= 2.0` | *[Link](#dalli)* | *[Link](https://github.com/petergoldstein/dalli)* |
|
339
|
-
| DelayedJob | `delayed_job` | `>= 4.1` | *[Link](#delayedjob)* | *[Link](https://github.com/collectiveidea/delayed_job)* |
|
340
|
-
| Elasticsearch | `elasticsearch` | `>= 1.0` | *[Link](#elasticsearch)* | *[Link](https://github.com/elastic/elasticsearch-ruby)* |
|
341
|
-
| Ethon | `ethon` | `>= 0.11` | *[Link](#ethon)* | *[Link](https://github.com/typhoeus/ethon)* |
|
342
|
-
| Excon | `excon` | `>= 0.50` | *[Link](#excon)* | *[Link](https://github.com/excon/excon)* |
|
343
|
-
| Faraday | `faraday` | `>= 0.14` | *[Link](#faraday)* | *[Link](https://github.com/lostisland/faraday)* |
|
344
|
-
| Grape | `grape` | `>= 1.0` | *[Link](#grape)* | *[Link](https://github.com/ruby-grape/grape)* |
|
345
|
-
| GraphQL | `graphql` | `>= 1.7.9` | *[Link](#graphql)* | *[Link](https://github.com/rmosolgo/graphql-ruby)* |
|
346
|
-
| gRPC | `grpc` | `>= 1.7` | *[Link](#grpc)* | *[Link](https://github.com/grpc/grpc/tree/master/src/rubyc)* |
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
331
|
+
| Name | Key | Versions Supported: MRI | Versions Supported: JRuby | How to configure | Gem source |
|
332
|
+
| ------------------------ | -------------------------- | ------------------------ | --------------------------| ----------------------------------- | ------------------------------------------------------------------------------ |
|
333
|
+
| Action Cable | `action_cable` | `>= 5.0` | `>= 5.0` | *[Link](#action-cable)* | *[Link](https://github.com/rails/rails/tree/master/actioncable)* |
|
334
|
+
| Action View | `action_view` | `>= 3.0` | `>= 3.0` | *[Link](#action-view)* | *[Link](https://github.com/rails/rails/tree/master/actionview)* |
|
335
|
+
| Active Model Serializers | `active_model_serializers` | `>= 0.9` | `>= 0.9` | *[Link](#active-model-serializers)* | *[Link](https://github.com/rails-api/active_model_serializers)* |
|
336
|
+
| Action Pack | `action_pack` | `>= 3.0` | `>= 3.0` | *[Link](#action-pack)* | *[Link](https://github.com/rails/rails/tree/master/actionpack)* |
|
337
|
+
| Active Record | `active_record` | `>= 3.0` | `>= 3.0` | *[Link](#active-record)* | *[Link](https://github.com/rails/rails/tree/master/activerecord)* |
|
338
|
+
| Active Support | `active_support` | `>= 3.0` | `>= 3.0` | *[Link](#active-support)* | *[Link](https://github.com/rails/rails/tree/master/activesupport)* |
|
339
|
+
| AWS | `aws` | `>= 2.0` | `>= 2.0` | *[Link](#aws)* | *[Link](https://github.com/aws/aws-sdk-ruby)* |
|
340
|
+
| Concurrent Ruby | `concurrent_ruby` | `>= 0.9` | `>= 0.9` | *[Link](#concurrent-ruby)* | *[Link](https://github.com/ruby-concurrency/concurrent-ruby)* |
|
341
|
+
| Dalli | `dalli` | `>= 2.0` | `>= 2.0` | *[Link](#dalli)* | *[Link](https://github.com/petergoldstein/dalli)* |
|
342
|
+
| DelayedJob | `delayed_job` | `>= 4.1` | `>= 4.1` | *[Link](#delayedjob)* | *[Link](https://github.com/collectiveidea/delayed_job)* |
|
343
|
+
| Elasticsearch | `elasticsearch` | `>= 1.0` | `>= 1.0` | *[Link](#elasticsearch)* | *[Link](https://github.com/elastic/elasticsearch-ruby)* |
|
344
|
+
| Ethon | `ethon` | `>= 0.11` | `>= 0.11` | *[Link](#ethon)* | *[Link](https://github.com/typhoeus/ethon)* |
|
345
|
+
| Excon | `excon` | `>= 0.50` | `>= 0.50` | *[Link](#excon)* | *[Link](https://github.com/excon/excon)* |
|
346
|
+
| Faraday | `faraday` | `>= 0.14` | `>= 0.14` | *[Link](#faraday)* | *[Link](https://github.com/lostisland/faraday)* |
|
347
|
+
| Grape | `grape` | `>= 1.0` | `>= 1.0` | *[Link](#grape)* | *[Link](https://github.com/ruby-grape/grape)* |
|
348
|
+
| GraphQL | `graphql` | `>= 1.7.9` | `>= 1.7.9` | *[Link](#graphql)* | *[Link](https://github.com/rmosolgo/graphql-ruby)* |
|
349
|
+
| gRPC | `grpc` | `>= 1.7` | *gem not available* | *[Link](#grpc)* | *[Link](https://github.com/grpc/grpc/tree/master/src/rubyc)* |
|
350
|
+
| http.rb | `httprb` | `>= 2.0` | `>= 2.0` | *[Link](#http-rb)* | *[Link](https://github.com/httprb/http)* |
|
351
|
+
| Kafka | `ruby-kafka` | `>= 0.7.10` | `>= 0.7.10` | *[Link](#kafka)* | *[Link](https://github.com/zendesk/ruby-kafka)* |
|
352
|
+
| MongoDB | `mongo` | `>= 2.1` | `>= 2.1` | *[Link](#mongodb)* | *[Link](https://github.com/mongodb/mongo-ruby-driver)* |
|
353
|
+
| MySQL2 | `mysql2` | `>= 0.3.21` | *gem not available* | *[Link](#mysql2)* | *[Link](https://github.com/brianmario/mysql2)* |
|
354
|
+
| 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)* |
|
355
|
+
| Presto | `presto` | `>= 0.5.14` | `>= 0.5.14` | *[Link](#presto)* | *[Link](https://github.com/treasure-data/presto-client-ruby)* |
|
356
|
+
| Que | `que` | `>= 1.0.0.beta2` | `>= 1.0.0.beta2` | *[Link](#que)* | *[Link](https://github.com/que-rb/que)* |
|
357
|
+
| Racecar | `racecar` | `>= 0.3.5` | `>= 0.3.5` | *[Link](#racecar)* | *[Link](https://github.com/zendesk/racecar)* |
|
358
|
+
| Rack | `rack` | `>= 1.1` | `>= 1.1` | *[Link](#rack)* | *[Link](https://github.com/rack/rack)* |
|
359
|
+
| Rails | `rails` | `>= 3.0` | `>= 3.0` | *[Link](#rails)* | *[Link](https://github.com/rails/rails)* |
|
360
|
+
| Rake | `rake` | `>= 12.0` | `>= 12.0` | *[Link](#rake)* | *[Link](https://github.com/ruby/rake)* |
|
361
|
+
| Redis | `redis` | `>= 3.2` | `>= 3.2` | *[Link](#redis)* | *[Link](https://github.com/redis/redis-rb)* |
|
362
|
+
| Resque | `resque` | `>= 1.0` | `>= 1.0` | *[Link](#resque)* | *[Link](https://github.com/resque/resque)* |
|
363
|
+
| Rest Client | `rest-client` | `>= 1.8` | `>= 1.8` | *[Link](#rest-client)* | *[Link](https://github.com/rest-client/rest-client)* |
|
364
|
+
| Sequel | `sequel` | `>= 3.41` | `>= 3.41` | *[Link](#sequel)* | *[Link](https://github.com/jeremyevans/sequel)* |
|
365
|
+
| Shoryuken | `shoryuken` | `>= 3.2` | `>= 3.2` | *[Link](#shoryuken)* | *[Link](https://github.com/phstc/shoryuken)* |
|
366
|
+
| Sidekiq | `sidekiq` | `>= 3.5.4` | `>= 3.5.4` | *[Link](#sidekiq)* | *[Link](https://github.com/mperham/sidekiq)* |
|
367
|
+
| Sinatra | `sinatra` | `>= 1.4` | `>= 1.4` | *[Link](#sinatra)* | *[Link](https://github.com/sinatra/sinatra)* |
|
368
|
+
| Sneakers | `sneakers` | `>= 2.12.0` | `>= 2.12.0` | *[Link](#sneakers)* | *[Link](https://github.com/jondot/sneakers)* |
|
369
|
+
| Sucker Punch | `sucker_punch` | `>= 2.0` | `>= 2.0` | *[Link](#sucker-punch)* | *[Link](https://github.com/brandonhilkert/sucker_punch)* |
|
363
370
|
|
364
371
|
### Action Cable
|
365
372
|
|
@@ -470,7 +477,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
470
477
|
| Key | Description | Default |
|
471
478
|
| ---| --- | --- |
|
472
479
|
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to the global setting, `false` for off. | `false` |
|
473
|
-
| `orm_service_name` | Service name used for the
|
480
|
+
| `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'`) |
|
474
481
|
| `service_name` | Service name used for database portion of `active_record` instrumentation. | Name of database adapter (e.g. `'mysql2'`) |
|
475
482
|
|
476
483
|
**Configuring trace settings per database**
|
@@ -610,7 +617,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
610
617
|
|
611
618
|
### DelayedJob
|
612
619
|
|
613
|
-
The DelayedJob integration uses lifecycle hooks to trace the job executions.
|
620
|
+
The DelayedJob integration uses lifecycle hooks to trace the job executions and enqueues.
|
614
621
|
|
615
622
|
You can enable it through `Datadog.configure`:
|
616
623
|
|
@@ -628,6 +635,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
628
635
|
| --- | ----------- | ------- |
|
629
636
|
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
630
637
|
| `service_name` | Service name used for `DelayedJob` instrumentation | `'delayed_job'` |
|
638
|
+
| `client_service_name` | Service name used for client-side `DelayedJob` instrumentation | `'delayed_job-client'` |
|
631
639
|
|
632
640
|
### Elasticsearch
|
633
641
|
|
@@ -929,6 +937,56 @@ alternate_client = Demo::Echo::Service.rpc_stub_class.new(
|
|
929
937
|
|
930
938
|
The integration will ensure that the `configured_interceptor` establishes a unique tracing setup for that client instance.
|
931
939
|
|
940
|
+
### http.rb
|
941
|
+
|
942
|
+
The http.rb integration will trace any HTTP call using the Http.rb gem.
|
943
|
+
|
944
|
+
```ruby
|
945
|
+
require 'http'
|
946
|
+
require 'ddtrace'
|
947
|
+
Datadog.configure do |c|
|
948
|
+
c.use :httprb, options
|
949
|
+
# optionally, specify a different service name for hostnames matching a regex
|
950
|
+
c.use :httprb, describes: /user-[^.]+\.example\.com/ do |httprb|
|
951
|
+
httprb.service_name = 'user.example.com'
|
952
|
+
httprb.split_by_domain = false # Only necessary if split_by_domain is true by default
|
953
|
+
end
|
954
|
+
end
|
955
|
+
```
|
956
|
+
|
957
|
+
Where `options` is an optional `Hash` that accepts the following parameters:
|
958
|
+
|
959
|
+
| Key | Description | Default |
|
960
|
+
| --- | ----------- | ------- |
|
961
|
+
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
962
|
+
| `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
|
963
|
+
| `service_name` | Service name for `httprb` instrumentation. | `'httprb'` |
|
964
|
+
| `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
|
965
|
+
|
966
|
+
### Kafka
|
967
|
+
|
968
|
+
The Kafka integration provides tracing of the `ruby-kafka` gem:
|
969
|
+
|
970
|
+
You can enable it through `Datadog.configure`:
|
971
|
+
|
972
|
+
```ruby
|
973
|
+
require 'active_support/notifications' # required to enable 'ruby-kafka' instrumentation
|
974
|
+
require 'kafka'
|
975
|
+
require 'ddtrace'
|
976
|
+
|
977
|
+
Datadog.configure do |c|
|
978
|
+
c.use :kafka, options
|
979
|
+
end
|
980
|
+
```
|
981
|
+
|
982
|
+
Where `options` is an optional `Hash` that accepts the following parameters:
|
983
|
+
|
984
|
+
| Key | Description | Default |
|
985
|
+
| --- | ----------- | ------- |
|
986
|
+
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
987
|
+
| `service_name` | Service name used for `kafka` instrumentation | `'kafka'` |
|
988
|
+
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
989
|
+
|
932
990
|
### MongoDB
|
933
991
|
|
934
992
|
The integration traces any `Command` that is sent from the [MongoDB Ruby Driver](https://github.com/mongodb/mongo-ruby-driver) to a MongoDB cluster. By extension, Object Document Mappers (ODM) such as Mongoid are automatically instrumented if they use the official Ruby driver. To activate the integration, simply:
|
@@ -1055,6 +1113,30 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1055
1113
|
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
1056
1114
|
| `service_name` | Service name used for `presto` instrumentation | `'presto'` |
|
1057
1115
|
|
1116
|
+
### Que
|
1117
|
+
|
1118
|
+
The Que integration is a middleware which will trace job executions.
|
1119
|
+
|
1120
|
+
You can enable it through `Datadog.configure`:
|
1121
|
+
|
1122
|
+
```ruby
|
1123
|
+
require 'ddtrace'
|
1124
|
+
|
1125
|
+
Datadog.configure do |c|
|
1126
|
+
c.use :que, options
|
1127
|
+
end
|
1128
|
+
```
|
1129
|
+
|
1130
|
+
Where `options` is an optional `Hash` that accepts the following parameters:
|
1131
|
+
|
1132
|
+
| Key | Description | Default |
|
1133
|
+
| --- | ----------- | ------- |
|
1134
|
+
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
1135
|
+
| `enabled` | Defines whether Que should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
|
1136
|
+
| `service_name` | Service name used for `que` instrumentation | `'que'` |
|
1137
|
+
| `tag_args` | Enable tagging of a job's args field. `true` for on, `false` for off. | `false` |
|
1138
|
+
| `tag_data` | Enable tagging of a job's data field. `true` for on, `false` for off. | `false` |
|
1139
|
+
|
1058
1140
|
### Racecar
|
1059
1141
|
|
1060
1142
|
The Racecar integration provides tracing for Racecar jobs.
|
@@ -1117,7 +1199,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1117
1199
|
| `service_name` | Service name used for `rack` instrumentation | `'rack'` |
|
1118
1200
|
| `web_service_name` | Service name for frontend server request queuing spans. (e.g. `'nginx'`) | `'web-server'` |
|
1119
1201
|
|
1120
|
-
|
1121
1202
|
**Configuring URL quantization behavior**
|
1122
1203
|
|
1123
1204
|
```ruby
|
@@ -1177,17 +1258,18 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1177
1258
|
| `middleware_names` | Enables any short-circuited middleware requests to display the middleware name as a resource for the trace. | `false` |
|
1178
1259
|
| `service_name` | Service name used when tracing application requests (on the `rack` level) | `'<app_name>'` (inferred from your Rails application namespace) |
|
1179
1260
|
| `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/'` |
|
1261
|
+
| `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` |
|
1180
1262
|
|
1181
1263
|
**Supported versions**
|
1182
1264
|
|
1183
|
-
|
|
1184
|
-
| ------------- |
|
1185
|
-
| 2.0 | 3.0 - 3.2
|
1186
|
-
| 2.1 | 3.0 - 4.2
|
1187
|
-
| 2.2 - 2.3 | 3.0 - 5.2
|
1188
|
-
| 2.4 | 4.2.8 - 5.2
|
1189
|
-
| 2.5 | 4.2.8 - 6.0
|
1190
|
-
| 2.6 - 2.7 | 5.0 - 6.0
|
1265
|
+
| MRI Versions | JRuby Versions | Rails Versions |
|
1266
|
+
| ------------- | -------------- | -------------- |
|
1267
|
+
| 2.0 | | 3.0 - 3.2 |
|
1268
|
+
| 2.1 | | 3.0 - 4.2 |
|
1269
|
+
| 2.2 - 2.3 | | 3.0 - 5.2 |
|
1270
|
+
| 2.4 | | 4.2.8 - 5.2 |
|
1271
|
+
| 2.5 | | 4.2.8 - 6.0 |
|
1272
|
+
| 2.6 - 2.7 | 9.2 | 5.0 - 6.0 |
|
1191
1273
|
|
1192
1274
|
### Rake
|
1193
1275
|
|
@@ -1532,6 +1614,29 @@ Ensure you register `Datadog::Contrib::Sinatra::Tracer` as a middleware before y
|
|
1532
1614
|
| `resource_script_names` | Prepend resource names with script name | `false` |
|
1533
1615
|
| `service_name` | Service name used for `sinatra` instrumentation | `'sinatra'` |
|
1534
1616
|
|
1617
|
+
### Sneakers
|
1618
|
+
|
1619
|
+
The Sneakers integration is a server-side middleware which will trace job executions.
|
1620
|
+
|
1621
|
+
You can enable it through `Datadog.configure`:
|
1622
|
+
|
1623
|
+
```ruby
|
1624
|
+
require 'ddtrace'
|
1625
|
+
|
1626
|
+
Datadog.configure do |c|
|
1627
|
+
c.use :sneakers, options
|
1628
|
+
end
|
1629
|
+
```
|
1630
|
+
|
1631
|
+
Where `options` is an optional `Hash` that accepts the following parameters:
|
1632
|
+
|
1633
|
+
| Key | Description | Default |
|
1634
|
+
| --- | ----------- | ------- |
|
1635
|
+
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
1636
|
+
| `enabled` | Defines whether Sneakers should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
|
1637
|
+
| `service_name` | Service name used for `sneakers` instrumentation | `'sneakers'` |
|
1638
|
+
| `tag_body` | Enable tagging of job message. `true` for on, `false` for off. | `false` |
|
1639
|
+
|
1535
1640
|
### Sucker Punch
|
1536
1641
|
|
1537
1642
|
The `sucker_punch` integration traces all scheduled jobs:
|
@@ -1580,12 +1685,14 @@ end
|
|
1580
1685
|
|
1581
1686
|
Available options are:
|
1582
1687
|
|
1583
|
-
- `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.
|
1688
|
+
- `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`.
|
1584
1689
|
- `hostname`: set the hostname of the trace agent.
|
1585
1690
|
- `instance`: set to a custom `Datadog::Tracer` instance. If provided, other trace settings are ignored (you must configure it manually.)
|
1586
1691
|
- `partial_flush.enabled`: set to `true` to enable partial trace flushing (for long running traces.) Disabled by default. *Experimental.*
|
1587
1692
|
- `port`: set the port the trace agent is listening on.
|
1588
1693
|
- `sampler`: set to a custom `Datadog::Sampler` instance. If provided, the tracer will use this sampler to determine sampling behavior.
|
1694
|
+
- `diagnostics.startup_logs.enabled`: Startup configuration and diagnostic log. Defaults to `true`. Can be configured through the `DD_TRACE_STARTUP_LOGS` environment variable.
|
1695
|
+
- `diagnostics.debug`: set to true to enable debug logging. Can be configured through the `DD_TRACE_DEBUG` environment variable. Defaults to `false`.
|
1589
1696
|
|
1590
1697
|
#### Custom logging
|
1591
1698
|
|
@@ -1633,6 +1740,16 @@ This enables you to set this value on a per application basis, so you can have f
|
|
1633
1740
|
|
1634
1741
|
Tags can also be set directly on individual spans, which will supersede any conflicting tags defined at the application level.
|
1635
1742
|
|
1743
|
+
### Environment variables
|
1744
|
+
|
1745
|
+
Other Environment Variables:
|
1746
|
+
|
1747
|
+
- `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`.
|
1748
|
+
- `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.
|
1749
|
+
- `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`.
|
1750
|
+
- `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`.
|
1751
|
+
- `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`.
|
1752
|
+
|
1636
1753
|
### Sampling
|
1637
1754
|
|
1638
1755
|
`ddtrace` can perform trace sampling. While the trace agent already samples traces to reduce bandwidth usage, client sampling reduces the performance overhead.
|
@@ -1798,6 +1915,7 @@ For more details on how to activate distributed tracing for integrations, see th
|
|
1798
1915
|
- [Rack](#rack)
|
1799
1916
|
- [Rails](#rails)
|
1800
1917
|
- [Sinatra](#sinatra)
|
1918
|
+
- [http.rb](#http-rb)
|
1801
1919
|
|
1802
1920
|
**Using the HTTP propagator**
|
1803
1921
|
|
@@ -1911,34 +2029,28 @@ Datadog::Pipeline.before_flush(
|
|
1911
2029
|
|
1912
2030
|
### Trace correlation
|
1913
2031
|
|
1914
|
-
In many cases, such as logging, it may be useful to correlate trace IDs to other events or data streams, for easier cross-referencing.
|
2032
|
+
In many cases, such as logging, it may be useful to correlate trace IDs to other events or data streams, for easier cross-referencing.
|
2033
|
+
|
2034
|
+
#### For logging in Rails applications
|
2035
|
+
|
2036
|
+
##### Automatic
|
2037
|
+
|
2038
|
+
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`:
|
1915
2039
|
|
1916
2040
|
```ruby
|
1917
|
-
#
|
1918
|
-
|
1919
|
-
# Returns #<Datadog::Correlation::Identifier>
|
1920
|
-
correlation = Datadog.tracer.active_correlation
|
1921
|
-
correlation.trace_id # => 5963550561812073440
|
1922
|
-
correlation.span_id # => 2232727802607726424
|
1923
|
-
correlation.env # => 'production' (derived from DD_ENV)
|
1924
|
-
correlation.service # => 'billing-api' (derived from DD_SERVICE)
|
1925
|
-
correlation.version # => '2.5.17' (derived from DD_VERSION)
|
1926
|
-
end
|
2041
|
+
# config/initializers/datadog.rb
|
2042
|
+
require 'ddtrace'
|
1927
2043
|
|
1928
|
-
|
1929
|
-
|
1930
|
-
|
1931
|
-
correlation = Datadog.tracer.active_correlation
|
1932
|
-
correlation.trace_id # => 0
|
1933
|
-
correlation.span_id # => 0
|
1934
|
-
correlation.env # => 'production' (derived from DD_ENV)
|
1935
|
-
correlation.service # => 'billing-api' (derived from DD_SERVICE)
|
1936
|
-
correlation.version # => '2.5.17' (derived from DD_VERSION)
|
2044
|
+
Datadog.configure do |c|
|
2045
|
+
c.use :rails, log_injection: true
|
2046
|
+
end
|
1937
2047
|
```
|
1938
2048
|
|
1939
|
-
|
2049
|
+
_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.
|
2050
|
+
|
2051
|
+
##### Manual (Lograge)
|
1940
2052
|
|
1941
|
-
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
|
2053
|
+
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.
|
1942
2054
|
|
1943
2055
|
```ruby
|
1944
2056
|
config.lograge.custom_options = lambda do |event|
|
@@ -1961,11 +2073,9 @@ config.lograge.custom_options = lambda do |event|
|
|
1961
2073
|
end
|
1962
2074
|
```
|
1963
2075
|
|
1964
|
-
|
1965
|
-
|
1966
|
-
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.
|
2076
|
+
##### Manual (ActiveSupport::TaggedLogging)
|
1967
2077
|
|
1968
|
-
|
2078
|
+
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:
|
1969
2079
|
|
1970
2080
|
```ruby
|
1971
2081
|
Rails.application.configure do
|
@@ -2124,13 +2234,13 @@ end
|
|
2124
2234
|
|
2125
2235
|
See the [Dogstatsd documentation](https://www.rubydoc.info/github/DataDog/dogstatsd-ruby/master/frames) for more details about configuring `Datadog::Statsd`.
|
2126
2236
|
|
2127
|
-
The stats
|
2237
|
+
The stats are VM specific and will include:
|
2128
2238
|
|
2129
2239
|
| Name | Type | Description |
|
2130
2240
|
| -------------------------- | ------- | -------------------------------------------------------- |
|
2131
2241
|
| `runtime.ruby.class_count` | `gauge` | Number of classes in memory space. |
|
2132
2242
|
| `runtime.ruby.thread_count` | `gauge` | Number of threads. |
|
2133
|
-
| `runtime.ruby.gc.*`. | `gauge` | Garbage collection statistics
|
2243
|
+
| `runtime.ruby.gc.*`. | `gauge` | Garbage collection statistics: collected from `GC.stat`. |
|
2134
2244
|
|
2135
2245
|
In addition, all metrics include the following tags:
|
2136
2246
|
|