ddtrace 0.35.0 → 0.38.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 +3 -1
- data/.gitignore +2 -0
- data/.gitlab-ci.yml +26 -0
- data/.rubocop.yml +4 -0
- data/Appraisals +23 -6
- data/CHANGELOG.md +116 -1
- data/Rakefile +43 -12
- data/ddtrace.gemspec +5 -0
- data/docker-compose.yml +37 -2
- data/docs/GettingStarted.md +63 -34
- data/lib/ddtrace.rb +2 -0
- data/lib/ddtrace/configuration/base.rb +1 -1
- data/lib/ddtrace/configuration/components.rb +2 -2
- data/lib/ddtrace/configuration/options.rb +1 -1
- data/lib/ddtrace/configuration/pin_setup.rb +3 -2
- data/lib/ddtrace/configuration/settings.rb +18 -0
- data/lib/ddtrace/contrib/active_support/cache/redis.rb +1 -1
- data/lib/ddtrace/contrib/active_support/notifications/event.rb +3 -1
- data/lib/ddtrace/contrib/active_support/notifications/subscription.rb +1 -1
- data/lib/ddtrace/contrib/concurrent_ruby/context_composite_executor_service.rb +9 -3
- data/lib/ddtrace/contrib/configuration/settings.rb +19 -1
- data/lib/ddtrace/contrib/dalli/patcher.rb +1 -5
- data/lib/ddtrace/contrib/elasticsearch/patcher.rb +1 -2
- data/lib/ddtrace/contrib/extensions.rb +38 -4
- data/lib/ddtrace/contrib/faraday/middleware.rb +5 -3
- data/lib/ddtrace/contrib/faraday/patcher.rb +4 -5
- data/lib/ddtrace/contrib/grape/patcher.rb +1 -1
- data/lib/ddtrace/contrib/graphql/patcher.rb +6 -3
- data/lib/ddtrace/contrib/grpc/datadog_interceptor.rb +1 -1
- data/lib/ddtrace/contrib/grpc/datadog_interceptor/client.rb +1 -3
- data/lib/ddtrace/contrib/grpc/patcher.rb +1 -5
- data/lib/ddtrace/contrib/http/circuit_breaker.rb +8 -32
- data/lib/ddtrace/contrib/http/instrumentation.rb +13 -8
- data/lib/ddtrace/contrib/httprb/configuration/settings.rb +27 -0
- data/lib/ddtrace/contrib/httprb/ext.rb +14 -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 +25 -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 +38 -0
- data/lib/ddtrace/contrib/kafka/integration.rb +39 -0
- data/lib/ddtrace/contrib/kafka/patcher.rb +26 -0
- data/lib/ddtrace/contrib/mongodb/instrumentation.rb +1 -2
- data/lib/ddtrace/contrib/mysql2/instrumentation.rb +1 -1
- data/lib/ddtrace/contrib/patcher.rb +14 -8
- data/lib/ddtrace/contrib/rack/middlewares.rb +15 -12
- data/lib/ddtrace/contrib/rails/configuration/settings.rb +13 -11
- data/lib/ddtrace/contrib/rails/framework.rb +52 -46
- data/lib/ddtrace/contrib/rails/integration.rb +1 -1
- data/lib/ddtrace/contrib/redis/patcher.rb +1 -1
- data/lib/ddtrace/contrib/rest_client/request_patch.rb +2 -2
- data/lib/ddtrace/contrib/sequel/database.rb +1 -1
- data/lib/ddtrace/contrib/sidekiq/ext.rb +1 -0
- data/lib/ddtrace/contrib/sidekiq/patcher.rb +8 -1
- data/lib/ddtrace/contrib/sidekiq/server_tracer.rb +1 -0
- data/lib/ddtrace/contrib/sucker_punch/patcher.rb +1 -1
- data/lib/ddtrace/diagnostics/environment_logger.rb +278 -0
- data/lib/ddtrace/environment.rb +5 -1
- data/lib/ddtrace/ext/diagnostics.rb +2 -0
- data/lib/ddtrace/ext/environment.rb +2 -0
- data/lib/ddtrace/pin.rb +39 -15
- data/lib/ddtrace/pipeline/span_filter.rb +15 -15
- data/lib/ddtrace/sampler.rb +2 -0
- data/lib/ddtrace/span.rb +10 -0
- data/lib/ddtrace/tracer.rb +15 -8
- data/lib/ddtrace/transport/http/adapters/net.rb +8 -0
- data/lib/ddtrace/transport/http/adapters/test.rb +4 -0
- data/lib/ddtrace/transport/http/adapters/unix_socket.rb +4 -0
- data/lib/ddtrace/transport/response.rb +11 -0
- data/lib/ddtrace/version.rb +1 -1
- data/lib/ddtrace/workers/trace_writer.rb +3 -0
- data/lib/ddtrace/writer.rb +33 -12
- metadata +98 -3
data/ddtrace.gemspec
CHANGED
@@ -46,6 +46,8 @@ Gem::Specification.new do |spec|
|
|
46
46
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
47
47
|
spec.add_development_dependency 'rspec-collection_matchers', '~> 1.1'
|
48
48
|
spec.add_development_dependency 'minitest', '= 5.10.1'
|
49
|
+
spec.add_development_dependency 'minitest-around', '0.5.0'
|
50
|
+
spec.add_development_dependency 'minitest-stub_any_instance', '1.0.2'
|
49
51
|
spec.add_development_dependency 'appraisal', '~> 2.2'
|
50
52
|
spec.add_development_dependency 'yard', '~> 0.9'
|
51
53
|
spec.add_development_dependency 'webmock', '~> 2.0'
|
@@ -59,6 +61,9 @@ Gem::Specification.new do |spec|
|
|
59
61
|
|
60
62
|
# locking transitive dependency of webmock
|
61
63
|
spec.add_development_dependency 'addressable', '~> 2.4.0'
|
64
|
+
spec.add_development_dependency 'benchmark-ips', '~> 2.8'
|
65
|
+
spec.add_development_dependency 'benchmark-memory', '~> 0.1'
|
66
|
+
spec.add_development_dependency 'memory_profiler', '~> 0.9'
|
62
67
|
spec.add_development_dependency 'redcarpet', '~> 3.4' if RUBY_PLATFORM != 'java'
|
63
68
|
spec.add_development_dependency 'pry', '~> 0.10.4'
|
64
69
|
spec.add_development_dependency 'pry-stack_explorer', '~> 0.4.9.2'
|
data/docker-compose.yml
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
version: '3.2'
|
2
2
|
services:
|
3
|
+
# MRI
|
3
4
|
tracer-2.0:
|
4
5
|
image: palazzem/docker-library:ddtrace_rb_2_0_0
|
5
6
|
command: /bin/bash
|
@@ -247,12 +248,44 @@ services:
|
|
247
248
|
- .:/app
|
248
249
|
- bundle-2.7:/usr/local/bundle
|
249
250
|
- gemfiles-2.7:/app/gemfiles
|
251
|
+
# JRuby
|
252
|
+
tracer-jruby-9.2:
|
253
|
+
image: marcotc/docker-library:ddtrace_rb_jruby_9_2
|
254
|
+
command: /bin/bash
|
255
|
+
depends_on:
|
256
|
+
- ddagent
|
257
|
+
- elasticsearch
|
258
|
+
- memcached
|
259
|
+
- mongodb
|
260
|
+
- mysql
|
261
|
+
- postgres
|
262
|
+
- presto
|
263
|
+
- redis
|
264
|
+
env_file: ./.env
|
265
|
+
environment:
|
266
|
+
- BUNDLE_GEMFILE=/app/Gemfile
|
267
|
+
- DD_AGENT_HOST=ddagent
|
268
|
+
- TEST_DATADOG_INTEGRATION=1
|
269
|
+
- TEST_ELASTICSEARCH_HOST=elasticsearch
|
270
|
+
- TEST_MEMCACHED_HOST=memcached
|
271
|
+
- TEST_MONGODB_HOST=mongodb
|
272
|
+
- TEST_MYSQL_HOST=mysql
|
273
|
+
- TEST_POSTGRES_HOST=postgres
|
274
|
+
- TEST_PRESTO_HOST=presto
|
275
|
+
- TEST_PRESTO_PORT=8080
|
276
|
+
- TEST_REDIS_HOST=redis
|
277
|
+
stdin_open: true
|
278
|
+
tty: true
|
279
|
+
volumes:
|
280
|
+
- .:/app
|
281
|
+
- bundle-jruby-9.2:/usr/local/bundle
|
282
|
+
- gemfiles-jruby-9.2:/app/gemfiles
|
250
283
|
ddagent:
|
251
|
-
image: datadog/
|
284
|
+
image: datadog/agent
|
252
285
|
environment:
|
253
286
|
- DD_APM_ENABLED=true
|
254
287
|
- DD_BIND_HOST=0.0.0.0
|
255
|
-
- DD_API_KEY=
|
288
|
+
- DD_API_KEY=00000000000000000000000000000000
|
256
289
|
expose:
|
257
290
|
- "8125/udp"
|
258
291
|
- "8126"
|
@@ -325,6 +358,7 @@ volumes:
|
|
325
358
|
bundle-2.5:
|
326
359
|
bundle-2.6:
|
327
360
|
bundle-2.7:
|
361
|
+
bundle-jruby-9.2:
|
328
362
|
gemfiles-2.0:
|
329
363
|
gemfiles-2.1:
|
330
364
|
gemfiles-2.2:
|
@@ -333,3 +367,4 @@ volumes:
|
|
333
367
|
gemfiles-2.5:
|
334
368
|
gemfiles-2.6:
|
335
369
|
gemfiles-2.7:
|
370
|
+
gemfiles-jruby-9.2:
|
data/docs/GettingStarted.md
CHANGED
@@ -43,6 +43,7 @@ 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)
|
@@ -344,6 +345,8 @@ For a list of available integrations, and their configuration options, please re
|
|
344
345
|
| Grape | `grape` | `>= 1.0` | *[Link](#grape)* | *[Link](https://github.com/ruby-grape/grape)* |
|
345
346
|
| GraphQL | `graphql` | `>= 1.7.9` | *[Link](#graphql)* | *[Link](https://github.com/rmosolgo/graphql-ruby)* |
|
346
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)* | |
|
347
350
|
| MongoDB | `mongo` | `>= 2.1` | *[Link](#mongodb)* | *[Link](https://github.com/mongodb/mongo-ruby-driver)* |
|
348
351
|
| MySQL2 | `mysql2` | `>= 0.3.21` | *[Link](#mysql2)* | *[Link](https://github.com/brianmario/mysql2)* |
|
349
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)* |
|
@@ -381,7 +384,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
381
384
|
| --- | ----------- | ------- |
|
382
385
|
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
383
386
|
| `service_name` | Service name used for `action_cable` instrumentation | `'action_cable'` |
|
384
|
-
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
385
387
|
|
386
388
|
### Action View
|
387
389
|
|
@@ -402,7 +404,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
402
404
|
| ---| --- | --- |
|
403
405
|
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
404
406
|
| `service_name` | Service name used for rendering instrumentation. | `action_view` |
|
405
|
-
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
406
407
|
| `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/'` |
|
407
408
|
|
408
409
|
### Active Model Serializers
|
@@ -425,7 +426,6 @@ ActiveModelSerializers::SerializableResource.new(test_obj).serializable_hash
|
|
425
426
|
| --- | ----------- | ------- |
|
426
427
|
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
427
428
|
| `service_name` | Service name used for `active_model_serializers` instrumentation. | `'active_model_serializers'` |
|
428
|
-
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
429
429
|
|
430
430
|
### Action Pack
|
431
431
|
|
@@ -446,7 +446,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
446
446
|
| ---| --- | --- |
|
447
447
|
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
448
448
|
| `service_name` | Service name used for rendering instrumentation. | `action_pack` |
|
449
|
-
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
450
449
|
|
451
450
|
### Active Record
|
452
451
|
|
@@ -476,7 +475,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
476
475
|
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to the global setting, `false` for off. | `false` |
|
477
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'` |
|
478
477
|
| `service_name` | Service name used for database portion of `active_record` instrumentation. | Name of database adapter (e.g. `'mysql2'`) |
|
479
|
-
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually, you don't need to set this. | `Datadog.tracer` |
|
480
478
|
|
481
479
|
**Configuring trace settings per database**
|
482
480
|
|
@@ -538,7 +536,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
538
536
|
| ---| --- | --- |
|
539
537
|
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
540
538
|
| `cache_service` | Service name used for caching with `active_support` instrumentation. | `active_support-cache` |
|
541
|
-
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
542
539
|
|
543
540
|
### AWS
|
544
541
|
|
@@ -562,7 +559,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
562
559
|
| --- | ----------- | ------- |
|
563
560
|
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
564
561
|
| `service_name` | Service name used for `aws` instrumentation | `'aws'` |
|
565
|
-
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
566
562
|
|
567
563
|
### Concurrent Ruby
|
568
564
|
|
@@ -589,7 +585,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
589
585
|
| Key | Description | Default |
|
590
586
|
| --- | ----------- | ------- |
|
591
587
|
| `service_name` | Service name used for `concurrent-ruby` instrumentation | `'concurrent-ruby'` |
|
592
|
-
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
593
588
|
|
594
589
|
### Dalli
|
595
590
|
|
@@ -615,7 +610,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
615
610
|
| --- | ----------- | ------- |
|
616
611
|
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
617
612
|
| `service_name` | Service name used for `dalli` instrumentation | `'memcached'` |
|
618
|
-
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
619
613
|
|
620
614
|
### DelayedJob
|
621
615
|
|
@@ -637,7 +631,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
637
631
|
| --- | ----------- | ------- |
|
638
632
|
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
639
633
|
| `service_name` | Service name used for `DelayedJob` instrumentation | `'delayed_job'` |
|
640
|
-
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
641
634
|
|
642
635
|
### Elasticsearch
|
643
636
|
|
@@ -663,7 +656,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
663
656
|
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
664
657
|
| `quantize` | Hash containing options for quantization. May include `:show` with an Array of keys to not quantize (or `:all` to skip quantization), or `:exclude` with Array of keys to exclude entirely. | `{}` |
|
665
658
|
| `service_name` | Service name used for `elasticsearch` instrumentation | `'elasticsearch'` |
|
666
|
-
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
667
659
|
|
668
660
|
### Ethon
|
669
661
|
|
@@ -691,7 +683,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
691
683
|
| `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
|
692
684
|
| `service_name` | Service name for `ethon` instrumentation. | `'ethon'` |
|
693
685
|
| `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
|
694
|
-
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
695
686
|
|
696
687
|
### Excon
|
697
688
|
|
@@ -725,7 +716,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
725
716
|
| `error_handler` | A `Proc` that accepts a `response` parameter. If it evaluates to a *truthy* value, the trace span is marked as an error. By default only sets 5XX responses as errors. | `nil` |
|
726
717
|
| `service_name` | Service name for Excon instrumentation. When provided to middleware for a specific connection, it applies only to that connection object. | `'excon'` |
|
727
718
|
| `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
|
728
|
-
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
729
719
|
|
730
720
|
**Configuring connections to use different settings**
|
731
721
|
|
@@ -789,7 +779,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
789
779
|
| `error_handler` | A `Proc` that accepts a `response` parameter. If it evaluates to a *truthy* value, the trace span is marked as an error. By default only sets 5XX responses as errors. | `nil` |
|
790
780
|
| `service_name` | Service name for Faraday instrumentation. When provided to middleware for a specific connection, it applies only to that connection object. | `'faraday'` |
|
791
781
|
| `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
|
792
|
-
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually, you don't need to set this. | `Datadog.tracer` |
|
793
782
|
|
794
783
|
### Grape
|
795
784
|
|
@@ -822,7 +811,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
822
811
|
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `nil` |
|
823
812
|
| `enabled` | Defines whether Grape should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
|
824
813
|
| `service_name` | Service name used for `grape` instrumentation | `'grape'` |
|
825
|
-
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
826
814
|
|
827
815
|
### GraphQL
|
828
816
|
|
@@ -847,7 +835,6 @@ The `use :graphql` method accepts the following parameters. Additional options c
|
|
847
835
|
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `nil` |
|
848
836
|
| `service_name` | Service name used for `graphql` instrumentation | `'ruby-graphql'` |
|
849
837
|
| `schemas` | Required. Array of `GraphQL::Schema` objects which to trace. Tracing will be added to all the schemas listed, using the options provided to this configuration. If you do not provide any, then tracing will not be activated. | `[]` |
|
850
|
-
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
851
838
|
|
852
839
|
**Manually configuring GraphQL schemas**
|
853
840
|
|
@@ -926,7 +913,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
926
913
|
| --- | ----------- | ------- |
|
927
914
|
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
928
915
|
| `service_name` | Service name used for `grpc` instrumentation | `'grpc'` |
|
929
|
-
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
930
916
|
|
931
917
|
**Configuring clients to use different settings**
|
932
918
|
|
@@ -946,6 +932,56 @@ alternate_client = Demo::Echo::Service.rpc_stub_class.new(
|
|
946
932
|
|
947
933
|
The integration will ensure that the `configured_interceptor` establishes a unique tracing setup for that client instance.
|
948
934
|
|
935
|
+
### http.rb
|
936
|
+
|
937
|
+
The http.rb integration will trace any HTTP call using the Http.rb gem.
|
938
|
+
|
939
|
+
```ruby
|
940
|
+
require 'http'
|
941
|
+
require 'ddtrace'
|
942
|
+
Datadog.configure do |c|
|
943
|
+
c.use :httprb, options
|
944
|
+
# optionally, specify a different service name for hostnames matching a regex
|
945
|
+
c.use :httprb, describes: /user-[^.]+\.example\.com/ do |httprb|
|
946
|
+
httprb.service_name = 'user.example.com'
|
947
|
+
httprb.split_by_domain = false # Only necessary if split_by_domain is true by default
|
948
|
+
end
|
949
|
+
end
|
950
|
+
```
|
951
|
+
|
952
|
+
Where `options` is an optional `Hash` that accepts the following parameters:
|
953
|
+
|
954
|
+
| Key | Description | Default |
|
955
|
+
| --- | ----------- | ------- |
|
956
|
+
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
957
|
+
| `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
|
958
|
+
| `service_name` | Service name for `httprb` instrumentation. | `'httprb'` |
|
959
|
+
| `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
|
960
|
+
|
961
|
+
### Kafka
|
962
|
+
|
963
|
+
The Kafka integration provides tracing of the `ruby-kafka` gem:
|
964
|
+
|
965
|
+
You can enable it through `Datadog.configure`:
|
966
|
+
|
967
|
+
```ruby
|
968
|
+
require 'active_support/notifications' # required to enable 'ruby-kafka' instrumentation
|
969
|
+
require 'kafka'
|
970
|
+
require 'ddtrace'
|
971
|
+
|
972
|
+
Datadog.configure do |c|
|
973
|
+
c.use :kafka, options
|
974
|
+
end
|
975
|
+
```
|
976
|
+
|
977
|
+
Where `options` is an optional `Hash` that accepts the following parameters:
|
978
|
+
|
979
|
+
| Key | Description | Default |
|
980
|
+
| --- | ----------- | ------- |
|
981
|
+
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
982
|
+
| `service_name` | Service name used for `kafka` instrumentation | `'kafka'` |
|
983
|
+
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
984
|
+
|
949
985
|
### MongoDB
|
950
986
|
|
951
987
|
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:
|
@@ -974,7 +1010,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
974
1010
|
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
975
1011
|
| `quantize` | Hash containing options for quantization. May include `:show` with an Array of keys to not quantize (or `:all` to skip quantization), or `:exclude` with Array of keys to exclude entirely. | `{ show: [:collection, :database, :operation] }` |
|
976
1012
|
| `service_name` | Service name used for `mongo` instrumentation | `'mongodb'` |
|
977
|
-
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
978
1013
|
|
979
1014
|
### MySQL2
|
980
1015
|
|
@@ -998,7 +1033,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
998
1033
|
| --- | ----------- | ------- |
|
999
1034
|
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
1000
1035
|
| `service_name` | Service name used for `mysql2` instrumentation | `'mysql2'` |
|
1001
|
-
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
1002
1036
|
|
1003
1037
|
### Net/HTTP
|
1004
1038
|
|
@@ -1034,7 +1068,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1034
1068
|
| `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
|
1035
1069
|
| `service_name` | Service name used for `http` instrumentation | `'net/http'` |
|
1036
1070
|
| `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
|
1037
|
-
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
1038
1071
|
|
1039
1072
|
If you wish to configure each connection object individually, you may use the `Datadog.configure` as it follows:
|
1040
1073
|
|
@@ -1074,7 +1107,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1074
1107
|
| --- | ----------- | ------- |
|
1075
1108
|
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
1076
1109
|
| `service_name` | Service name used for `presto` instrumentation | `'presto'` |
|
1077
|
-
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
1078
1110
|
|
1079
1111
|
### Racecar
|
1080
1112
|
|
@@ -1096,7 +1128,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1096
1128
|
| --- | ----------- | ------- |
|
1097
1129
|
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
1098
1130
|
| `service_name` | Service name used for `racecar` instrumentation | `'racecar'` |
|
1099
|
-
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
1100
1131
|
|
1101
1132
|
### Rack
|
1102
1133
|
|
@@ -1137,7 +1168,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1137
1168
|
| `quantize.fragment` | Defines behavior for URL fragments. Removes fragments by default. May be `:show` to show URL fragments. Option must be nested inside the `quantize` option. | `nil` |
|
1138
1169
|
| `request_queuing` | Track HTTP request time spent in the queue of the frontend server. See [HTTP request queuing](#http-request-queuing) for setup details. Set to `true` to enable. | `false` |
|
1139
1170
|
| `service_name` | Service name used for `rack` instrumentation | `'rack'` |
|
1140
|
-
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
1141
1171
|
| `web_service_name` | Service name for frontend server request queuing spans. (e.g. `'nginx'`) | `'web-server'` |
|
1142
1172
|
|
1143
1173
|
|
@@ -1200,7 +1230,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1200
1230
|
| `middleware_names` | Enables any short-circuited middleware requests to display the middleware name as a resource for the trace. | `false` |
|
1201
1231
|
| `service_name` | Service name used when tracing application requests (on the `rack` level) | `'<app_name>'` (inferred from your Rails application namespace) |
|
1202
1232
|
| `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/'` |
|
1203
|
-
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually, you don't need to set this. | `Datadog.tracer` |
|
1204
1233
|
|
1205
1234
|
**Supported versions**
|
1206
1235
|
|
@@ -1243,7 +1272,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1243
1272
|
| `enabled` | Defines whether Rake tasks should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
|
1244
1273
|
| `quantize` | Hash containing options for quantization of task arguments. See below for more details and examples. | `{}` |
|
1245
1274
|
| `service_name` | Service name used for `rake` instrumentation | `'rake'` |
|
1246
|
-
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually, you don't need to set this. | `Datadog.tracer` |
|
1247
1275
|
|
1248
1276
|
**Configuring task quantization behavior**
|
1249
1277
|
|
@@ -1302,11 +1330,17 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1302
1330
|
| --- | ----------- | ------- |
|
1303
1331
|
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
1304
1332
|
| `service_name` | Service name used for `redis` instrumentation | `'redis'` |
|
1305
|
-
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
1306
1333
|
|
1307
1334
|
You can also set *per-instance* configuration as it follows:
|
1308
1335
|
|
1309
1336
|
```ruby
|
1337
|
+
require 'redis'
|
1338
|
+
require 'ddtrace'
|
1339
|
+
|
1340
|
+
Datadog.configure do |c|
|
1341
|
+
c.use :redis # Enabling integration instrumentation is still required
|
1342
|
+
end
|
1343
|
+
|
1310
1344
|
customer_cache = Redis.new
|
1311
1345
|
invoice_cache = Redis.new
|
1312
1346
|
|
@@ -1372,7 +1406,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1372
1406
|
| --- | ----------- | ------- |
|
1373
1407
|
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to the global setting, `false` for off. | `false` |
|
1374
1408
|
| `service_name` | Service name used for `resque` instrumentation | `'resque'` |
|
1375
|
-
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually, you don't need to set this. | `Datadog.tracer` |
|
1376
1409
|
| `workers` | An array including all worker classes you want to trace (e.g. `[MyJob]`) | `[]` |
|
1377
1410
|
|
1378
1411
|
### Rest Client
|
@@ -1395,7 +1428,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1395
1428
|
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
1396
1429
|
| `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
|
1397
1430
|
| `service_name` | Service name for `rest_client` instrumentation. | `'rest_client'` |
|
1398
|
-
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
1399
1431
|
|
1400
1432
|
### Sequel
|
1401
1433
|
|
@@ -1429,7 +1461,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1429
1461
|
| --- | ----------- | ------- |
|
1430
1462
|
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
1431
1463
|
| `service_name` | Service name for `sequel` instrumentation | Name of database adapter (e.g. `'mysql2'`) |
|
1432
|
-
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
1433
1464
|
|
1434
1465
|
Only Ruby 2.0+ is supported.
|
1435
1466
|
|
@@ -1466,7 +1497,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1466
1497
|
| --- | ----------- | ------- |
|
1467
1498
|
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
1468
1499
|
| `service_name` | Service name used for `shoryuken` instrumentation | `'shoryuken'` |
|
1469
|
-
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
1470
1500
|
|
1471
1501
|
### Sidekiq
|
1472
1502
|
|
@@ -1490,7 +1520,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1490
1520
|
| `client_service_name` | Service name used for client-side `sidekiq` instrumentation | `'sidekiq-client'` |
|
1491
1521
|
| `service_name` | Service name used for server-side `sidekiq` instrumentation | `'sidekiq'` |
|
1492
1522
|
| `tag_args` | Enable tagging of job arguments. `true` for on, `false` for off. | `false` |
|
1493
|
-
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
1494
1523
|
|
1495
1524
|
### Sinatra
|
1496
1525
|
|
@@ -1555,7 +1584,6 @@ Ensure you register `Datadog::Contrib::Sinatra::Tracer` as a middleware before y
|
|
1555
1584
|
| `headers` | Hash of HTTP request or response headers to add as tags to the `sinatra.request`. Accepts `request` and `response` keys with Array values e.g. `['Last-Modified']`. Adds `http.request.headers.*` and `http.response.headers.*` tags respectively. | `{ response: ['Content-Type', 'X-Request-ID'] }` |
|
1556
1585
|
| `resource_script_names` | Prepend resource names with script name | `false` |
|
1557
1586
|
| `service_name` | Service name used for `sinatra` instrumentation | `'sinatra'` |
|
1558
|
-
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
1559
1587
|
|
1560
1588
|
### Sucker Punch
|
1561
1589
|
|
@@ -1578,7 +1606,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1578
1606
|
| --- | ----------- | ------- |
|
1579
1607
|
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
1580
1608
|
| `service_name` | Service name used for `sucker_punch` instrumentation | `'sucker_punch'` |
|
1581
|
-
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
1582
1609
|
|
1583
1610
|
## Advanced configuration
|
1584
1611
|
|
@@ -1612,6 +1639,7 @@ Available options are:
|
|
1612
1639
|
- `partial_flush.enabled`: set to `true` to enable partial trace flushing (for long running traces.) Disabled by default. *Experimental.*
|
1613
1640
|
- `port`: set the port the trace agent is listening on.
|
1614
1641
|
- `sampler`: set to a custom `Datadog::Sampler` instance. If provided, the tracer will use this sampler to determine sampling behavior.
|
1642
|
+
- `diagnostics.startup_logs.enabled`: Startup configuration and diagnostic log. Defaults to `true`. Can be configured through the `DD_TRACE_STARTUP_LOGS` environment variable.
|
1615
1643
|
|
1616
1644
|
#### Custom logging
|
1617
1645
|
|
@@ -1809,7 +1837,7 @@ Service C:
|
|
1809
1837
|
|
1810
1838
|
**Activating distributed tracing for integrations**
|
1811
1839
|
|
1812
|
-
Many integrations included in `ddtrace` support distributed tracing. Distributed tracing is enabled by default,
|
1840
|
+
Many integrations included in `ddtrace` support distributed tracing. Distributed tracing is enabled by default in Agent v7 and most versions of Agent v6. If needed, you can activate distributed tracing with configuration settings.
|
1813
1841
|
|
1814
1842
|
- If your application receives requests from services with distributed tracing activated, you must activate distributed tracing on the integrations that handle these requests (e.g. Rails)
|
1815
1843
|
- If your application send requests to services with distributed tracing activated, you must activate distributed tracing on the integrations that send these requests (e.g. Faraday)
|
@@ -1824,6 +1852,7 @@ For more details on how to activate distributed tracing for integrations, see th
|
|
1824
1852
|
- [Rack](#rack)
|
1825
1853
|
- [Rails](#rails)
|
1826
1854
|
- [Sinatra](#sinatra)
|
1855
|
+
- [http.rb](#http.rb)
|
1827
1856
|
|
1828
1857
|
**Using the HTTP propagator**
|
1829
1858
|
|
data/lib/ddtrace.rb
CHANGED
@@ -55,7 +55,9 @@ require 'ddtrace/contrib/grape/integration'
|
|
55
55
|
require 'ddtrace/contrib/graphql/integration'
|
56
56
|
require 'ddtrace/contrib/grpc/integration'
|
57
57
|
require 'ddtrace/contrib/http/integration'
|
58
|
+
require 'ddtrace/contrib/httprb/integration'
|
58
59
|
require 'ddtrace/contrib/integration'
|
60
|
+
require 'ddtrace/contrib/kafka/integration'
|
59
61
|
require 'ddtrace/contrib/presto/integration'
|
60
62
|
require 'ddtrace/contrib/mysql2/integration'
|
61
63
|
require 'ddtrace/contrib/mongodb/integration'
|