ddtrace 0.20.0 → 0.21.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +24 -3
  3. data/Rakefile +1 -1
  4. data/docs/GettingStarted.md +25 -7
  5. data/lib/ddtrace.rb +4 -31
  6. data/lib/ddtrace/configuration.rb +13 -46
  7. data/lib/ddtrace/configuration/{resolver.rb → dependency_resolver.rb} +2 -2
  8. data/lib/ddtrace/configuration/option.rb +32 -0
  9. data/lib/ddtrace/configuration/option_definition.rb +27 -0
  10. data/lib/ddtrace/configuration/option_definition_set.rb +18 -0
  11. data/lib/ddtrace/configuration/option_set.rb +6 -0
  12. data/lib/ddtrace/configuration/options.rb +93 -0
  13. data/lib/ddtrace/configuration/pin_setup.rb +1 -1
  14. data/lib/ddtrace/configuration/settings.rb +47 -0
  15. data/lib/ddtrace/contrib/active_model_serializers/configuration/settings.rb +8 -0
  16. data/lib/ddtrace/contrib/active_model_serializers/event.rb +6 -0
  17. data/lib/ddtrace/contrib/active_model_serializers/ext.rb +2 -2
  18. data/lib/ddtrace/contrib/active_record/configuration/settings.rb +8 -0
  19. data/lib/ddtrace/contrib/active_record/events/instantiation.rb +7 -0
  20. data/lib/ddtrace/contrib/active_record/events/sql.rb +6 -0
  21. data/lib/ddtrace/contrib/active_record/ext.rb +2 -3
  22. data/lib/ddtrace/contrib/analytics.rb +3 -4
  23. data/lib/ddtrace/contrib/aws/configuration/settings.rb +8 -0
  24. data/lib/ddtrace/contrib/aws/ext.rb +5 -6
  25. data/lib/ddtrace/contrib/aws/instrumentation.rb +7 -0
  26. data/lib/ddtrace/contrib/configuration/settings.rb +4 -14
  27. data/lib/ddtrace/contrib/dalli/configuration/settings.rb +8 -0
  28. data/lib/ddtrace/contrib/dalli/ext.rb +3 -2
  29. data/lib/ddtrace/contrib/dalli/instrumentation.rb +7 -0
  30. data/lib/ddtrace/contrib/delayed_job/configuration/settings.rb +1 -1
  31. data/lib/ddtrace/contrib/delayed_job/ext.rb +1 -1
  32. data/lib/ddtrace/contrib/elasticsearch/configuration/settings.rb +8 -0
  33. data/lib/ddtrace/contrib/elasticsearch/ext.rb +2 -2
  34. data/lib/ddtrace/contrib/elasticsearch/patcher.rb +11 -1
  35. data/lib/ddtrace/contrib/excon/configuration/settings.rb +8 -0
  36. data/lib/ddtrace/contrib/excon/ext.rb +2 -1
  37. data/lib/ddtrace/contrib/excon/middleware.rb +15 -0
  38. data/lib/ddtrace/contrib/extensions.rb +62 -0
  39. data/lib/ddtrace/contrib/faraday/configuration/settings.rb +8 -0
  40. data/lib/ddtrace/contrib/faraday/ext.rb +2 -1
  41. data/lib/ddtrace/contrib/faraday/middleware.rb +15 -0
  42. data/lib/ddtrace/contrib/grape/configuration/settings.rb +8 -0
  43. data/lib/ddtrace/contrib/grape/endpoint.rb +19 -0
  44. data/lib/ddtrace/contrib/grape/ext.rb +2 -2
  45. data/lib/ddtrace/contrib/graphql/configuration/settings.rb +8 -0
  46. data/lib/ddtrace/contrib/graphql/ext.rb +2 -0
  47. data/lib/ddtrace/contrib/graphql/patcher.rb +8 -2
  48. data/lib/ddtrace/contrib/grpc/configuration/settings.rb +8 -0
  49. data/lib/ddtrace/contrib/grpc/datadog_interceptor.rb +9 -0
  50. data/lib/ddtrace/contrib/grpc/datadog_interceptor/client.rb +4 -0
  51. data/lib/ddtrace/contrib/grpc/datadog_interceptor/server.rb +4 -0
  52. data/lib/ddtrace/contrib/grpc/ext.rb +2 -1
  53. data/lib/ddtrace/contrib/http/configuration/settings.rb +8 -0
  54. data/lib/ddtrace/contrib/http/ext.rb +2 -1
  55. data/lib/ddtrace/contrib/http/instrumentation.rb +54 -19
  56. data/lib/ddtrace/contrib/mongodb/configuration/settings.rb +8 -0
  57. data/lib/ddtrace/contrib/mongodb/ext.rb +2 -2
  58. data/lib/ddtrace/contrib/mongodb/subscribers.rb +18 -0
  59. data/lib/ddtrace/contrib/mysql2/configuration/settings.rb +8 -0
  60. data/lib/ddtrace/contrib/mysql2/ext.rb +2 -2
  61. data/lib/ddtrace/contrib/mysql2/{client.rb → instrumentation.rb} +32 -12
  62. data/lib/ddtrace/contrib/mysql2/patcher.rb +2 -2
  63. data/lib/ddtrace/contrib/racecar/configuration/settings.rb +1 -1
  64. data/lib/ddtrace/contrib/racecar/ext.rb +1 -1
  65. data/lib/ddtrace/contrib/rack/configuration/settings.rb +1 -1
  66. data/lib/ddtrace/contrib/rack/ext.rb +1 -1
  67. data/lib/ddtrace/contrib/rails/action_controller.rb +3 -0
  68. data/lib/ddtrace/contrib/rails/active_support.rb +1 -0
  69. data/lib/ddtrace/contrib/rails/configuration/settings.rb +8 -0
  70. data/lib/ddtrace/contrib/rails/ext.rb +2 -5
  71. data/lib/ddtrace/contrib/rails/utils.rb +17 -1
  72. data/lib/ddtrace/contrib/rake/configuration/settings.rb +1 -1
  73. data/lib/ddtrace/contrib/rake/ext.rb +1 -1
  74. data/lib/ddtrace/contrib/redis/configuration/settings.rb +8 -0
  75. data/lib/ddtrace/contrib/redis/ext.rb +4 -5
  76. data/lib/ddtrace/contrib/redis/tags.rb +24 -6
  77. data/lib/ddtrace/contrib/registerable.rb +1 -1
  78. data/lib/ddtrace/contrib/registry.rb +42 -0
  79. data/lib/ddtrace/contrib/resque/configuration/settings.rb +1 -1
  80. data/lib/ddtrace/contrib/resque/ext.rb +1 -1
  81. data/lib/ddtrace/contrib/rest_client/configuration/settings.rb +8 -0
  82. data/lib/ddtrace/contrib/rest_client/ext.rb +2 -1
  83. data/lib/ddtrace/contrib/rest_client/request_patch.rb +14 -0
  84. data/lib/ddtrace/contrib/sequel/configuration/settings.rb +7 -1
  85. data/lib/ddtrace/contrib/sequel/database.rb +2 -0
  86. data/lib/ddtrace/contrib/sequel/dataset.rb +2 -0
  87. data/lib/ddtrace/contrib/sequel/ext.rb +2 -2
  88. data/lib/ddtrace/contrib/sequel/utils.rb +32 -14
  89. data/lib/ddtrace/contrib/shoryuken/configuration/settings.rb +1 -1
  90. data/lib/ddtrace/contrib/shoryuken/ext.rb +1 -1
  91. data/lib/ddtrace/contrib/sidekiq/configuration/settings.rb +1 -1
  92. data/lib/ddtrace/contrib/sidekiq/ext.rb +1 -1
  93. data/lib/ddtrace/contrib/sinatra/configuration/settings.rb +8 -0
  94. data/lib/ddtrace/contrib/sinatra/ext.rb +3 -4
  95. data/lib/ddtrace/contrib/sinatra/tracer.rb +1 -0
  96. data/lib/ddtrace/contrib/sinatra/tracer_middleware.rb +12 -0
  97. data/lib/ddtrace/contrib/sucker_punch/configuration/settings.rb +1 -1
  98. data/lib/ddtrace/contrib/sucker_punch/ext.rb +1 -1
  99. data/lib/ddtrace/environment.rb +15 -0
  100. data/lib/ddtrace/ext/analytics.rb +1 -0
  101. data/lib/ddtrace/opentracer/global_tracer.rb +1 -1
  102. data/lib/ddtrace/propagation/distributed_headers.rb +14 -4
  103. data/lib/ddtrace/span.rb +4 -0
  104. data/lib/ddtrace/tracer.rb +6 -1
  105. data/lib/ddtrace/version.rb +1 -1
  106. metadata +14 -15
  107. data/lib/ddtrace/configurable.rb +0 -83
  108. data/lib/ddtrace/configuration/proxy.rb +0 -25
  109. data/lib/ddtrace/contrib/base.rb +0 -16
  110. data/lib/ddtrace/contrib/configuration/option.rb +0 -33
  111. data/lib/ddtrace/contrib/configuration/option_definition.rb +0 -29
  112. data/lib/ddtrace/contrib/configuration/option_definition_set.rb +0 -20
  113. data/lib/ddtrace/contrib/configuration/option_set.rb +0 -8
  114. data/lib/ddtrace/contrib/configuration/options.rb +0 -95
  115. data/lib/ddtrace/registry.rb +0 -42
  116. data/lib/ddtrace/registry/registerable.rb +0 -20
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 322681c6b2dc4d316585930d64dc984961f75c55
4
- data.tar.gz: '054413496e1f32d496080df59241c19b8cea74d8'
3
+ metadata.gz: ddab3a41c741e4d490ee6d078c40a953a9095b18
4
+ data.tar.gz: 6853021a4383b29e7ae678a809a5697ea5619456
5
5
  SHA512:
6
- metadata.gz: 2e1b3b90d17149e9cd06ed4ca065d8384de3083918a2ca7c9fdc5f32d65d1481e93079b397274ac768d4622df2a1219a85017d69cc13c5d4f07fb87033fb0eb6
7
- data.tar.gz: e3960a60e5a62542f5e9135bc5c42b7025d8352179ff5ec15e35b39399b5d3f0108f9e9fe689d1e2588b56172ff5a33b95b5a9163ea123116c6c01ad910e19c2
6
+ metadata.gz: aaacd674bf8f46df992234b9a8b72a5d8d53b0d73eaf2a89ad5f0c92a94d8632381402389ca1ee3c3353c6618a94c39db9597a40e3b48ec006122f5023d7b158
7
+ data.tar.gz: 95785d1b6ec7472301aa0c5d386edbcadc9ff60c4bf65effedbd130b91bfb1149b1e736d982282b3565d78c9253d0deda998b612cec2ced66c7f373bd691ba72
@@ -4,6 +4,26 @@
4
4
 
5
5
  ## [Unreleased (beta)]
6
6
 
7
+ ## [0.21.0] - 2019-03-20
8
+
9
+ Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.21.0
10
+
11
+ Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.20.0...v0.21.0
12
+
13
+ ### Added
14
+
15
+ - Trace analytics support (#697, #715)
16
+ - HTTP after_request span hook (#716, #724)
17
+
18
+ ### Fixed
19
+
20
+ - Distributed traces with IDs in 2^64 range being dropped (#719)
21
+ - Custom logger level forced to warning (#681, #721) (@blaines, @ericmustin)
22
+
23
+ ### Refactored
24
+
25
+ - Global configuration for tracing into configuration API (#714)
26
+
7
27
  ## [0.20.0] - 2019-03-07
8
28
 
9
29
  Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.20.0
@@ -21,7 +41,7 @@ These changes are backwards compatible, but all integration configuration should
21
41
 
22
42
  - Enable distributed tracing by default (#701)
23
43
 
24
- ### Fixes
44
+ ### Fixed
25
45
 
26
46
  - Fix Rack http_server.queue spans missing from distributed traces (#709)
27
47
 
@@ -711,8 +731,9 @@ Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.3.1
711
731
 
712
732
  Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
713
733
 
714
- [Unreleased (stable)]: https://github.com/DataDog/dd-trace-rb/compare/v0.20.0...master
715
- [Unreleased (beta)]: https://github.com/DataDog/dd-trace-rb/compare/v0.20.0...0.21-dev
734
+ [Unreleased (stable)]: https://github.com/DataDog/dd-trace-rb/compare/v0.21.0...master
735
+ [Unreleased (beta)]: https://github.com/DataDog/dd-trace-rb/compare/v0.21.0...0.22-dev
736
+ [0.21.0]: https://github.com/DataDog/dd-trace-rb/compare/v0.20.0...v0.21.0
716
737
  [0.20.0]: https://github.com/DataDog/dd-trace-rb/compare/v0.19.1...v0.20.0
717
738
  [0.19.1]: https://github.com/DataDog/dd-trace-rb/compare/v0.19.0...v0.19.1
718
739
  [0.19.0]: https://github.com/DataDog/dd-trace-rb/compare/v0.18.3...v0.19.0
data/Rakefile CHANGED
@@ -47,7 +47,7 @@ namespace :spec do
47
47
 
48
48
  RSpec::Core::RakeTask.new(:contrib) do |t|
49
49
  # rubocop:disable Metrics/LineLength
50
- t.pattern = 'spec/**/contrib/{analytics,configurable,integration,patchable,patcher,registerable,sampling,configuration/*}_spec.rb'
50
+ t.pattern = 'spec/**/contrib/{analytics,configurable,integration,patchable,patcher,registerable,registry,configuration/*}_spec.rb'
51
51
  end
52
52
 
53
53
  [
@@ -355,6 +355,7 @@ ActiveModelSerializers::SerializableResource.new(test_obj).serializable_hash
355
355
 
356
356
  | Key | Description | Default |
357
357
  | --- | ----------- | ------- |
358
+ | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
358
359
  | `service_name` | Service name used for `active_model_serializers` instrumentation. | `'active_model_serializers'` |
359
360
  | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
360
361
 
@@ -383,6 +384,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
383
384
 
384
385
  | Key | Description | Default |
385
386
  | ---| --- | --- |
387
+ | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
386
388
  | `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'` |
387
389
  | `service_name` | Service name used for database portion of `active_record` instrumentation. | Name of database adapter (e.g. `'mysql2'`) |
388
390
  | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
@@ -445,6 +447,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
445
447
 
446
448
  | Key | Description | Default |
447
449
  | --- | ----------- | ------- |
450
+ | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
448
451
  | `service_name` | Service name used for `aws` instrumentation | `'aws'` |
449
452
  | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
450
453
 
@@ -497,6 +500,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
497
500
 
498
501
  | Key | Description | Default |
499
502
  | --- | ----------- | ------- |
503
+ | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
500
504
  | `service_name` | Service name used for `dalli` instrumentation | `'memcached'` |
501
505
  | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
502
506
 
@@ -518,7 +522,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
518
522
 
519
523
  | Key | Description | Default |
520
524
  | --- | ----------- | ------- |
521
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `nil` |
525
+ | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
522
526
  | `service_name` | Service name used for `DelayedJob` instrumentation | `'delayed_job'` |
523
527
  | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
524
528
 
@@ -543,6 +547,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
543
547
 
544
548
  | Key | Description | Default |
545
549
  | --- | ----------- | ------- |
550
+ | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
546
551
  | `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. | `{}` |
547
552
  | `service_name` | Service name used for `elasticsearch` instrumentation | `'elasticsearch'` |
548
553
  | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
@@ -568,6 +573,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
568
573
 
569
574
  | Key | Description | Default |
570
575
  | --- | ----------- | ------- |
576
+ | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
571
577
  | `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
572
578
  | `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` |
573
579
  | `service_name` | Service name for Excon instrumentation. When provided to middleware for a specific connection, it applies only to that connection object. | `'excon'` |
@@ -625,6 +631,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
625
631
 
626
632
  | Key | Description | Default |
627
633
  | --- | ----------- | ------- |
634
+ | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
628
635
  | `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
629
636
  | `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` |
630
637
  | `service_name` | Service name for Faraday instrumentation. When provided to middleware for a specific connection, it applies only to that connection object. | `'faraday'` |
@@ -659,6 +666,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
659
666
 
660
667
  | Key | Description | Default |
661
668
  | --- | ----------- | ------- |
669
+ | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `nil` |
662
670
  | `enabled` | Defines whether Grape should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
663
671
  | `service_name` | Service name used for `grape` instrumentation | `'grape'` |
664
672
  | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
@@ -683,6 +691,7 @@ The `use :graphql` method accepts the following parameters. Additional options c
683
691
 
684
692
  | Key | Description | Default |
685
693
  | --- | ----------- | ------- |
694
+ | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `nil` |
686
695
  | `service_name` | Service name used for `graphql` instrumentation | `'ruby-graphql'` |
687
696
  | `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. | `[]` |
688
697
  | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
@@ -742,6 +751,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
742
751
 
743
752
  | Key | Description | Default |
744
753
  | --- | ----------- | ------- |
754
+ | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
745
755
  | `service_name` | Service name used for `grpc` instrumentation | `'grpc'` |
746
756
  | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
747
757
 
@@ -788,6 +798,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
788
798
 
789
799
  | Key | Description | Default |
790
800
  | --- | ----------- | ------- |
801
+ | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
791
802
  | `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] }` |
792
803
  | `service_name` | Service name used for `mongo` instrumentation | `'mongodb'` |
793
804
  | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
@@ -812,6 +823,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
812
823
 
813
824
  | Key | Description | Default |
814
825
  | --- | ----------- | ------- |
826
+ | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
815
827
  | `service_name` | Service name used for `mysql2` instrumentation | `'mysql2'` |
816
828
  | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
817
829
 
@@ -839,6 +851,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
839
851
 
840
852
  | Key | Description | Default |
841
853
  | --- | ----------- | ------- |
854
+ | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
842
855
  | `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
843
856
  | `service_name` | Service name used for `http` instrumentation | `'net/http'` |
844
857
  | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
@@ -868,7 +881,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
868
881
 
869
882
  | Key | Description | Default |
870
883
  | --- | ----------- | ------- |
871
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `nil` |
884
+ | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
872
885
  | `service_name` | Service name used for `racecar` instrumentation | `'racecar'` |
873
886
  | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
874
887
 
@@ -964,6 +977,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
964
977
 
965
978
  | Key | Description | Default |
966
979
  | --- | ----------- | ------- |
980
+ | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `nil` |
967
981
  | `cache_service` | Cache service name used when tracing cache activity | `'<app_name>-cache'` |
968
982
  | `controller_service` | Service name used when tracing a Rails action controller | `'<app_name>'` |
969
983
  | `database_service` | Database service name used when tracing database activity | `'<app_name>-<adapter_name>'` |
@@ -1010,7 +1024,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1010
1024
 
1011
1025
  | Key | Description | Default |
1012
1026
  | --- | ----------- | ------- |
1013
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `nil` |
1027
+ | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1014
1028
  | `enabled` | Defines whether Rake tasks should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
1015
1029
  | `quantize` | Hash containing options for quantization of task arguments. See below for more details and examples. | `{}` |
1016
1030
  | `service_name` | Service name used for `rake` instrumentation | `'rake'` |
@@ -1071,6 +1085,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1071
1085
 
1072
1086
  | Key | Description | Default |
1073
1087
  | --- | ----------- | ------- |
1088
+ | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1074
1089
  | `service_name` | Service name used for `redis` instrumentation | `'redis'` |
1075
1090
  | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
1076
1091
 
@@ -1113,7 +1128,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1113
1128
 
1114
1129
  | Key | Description | Default |
1115
1130
  | --- | ----------- | ------- |
1116
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `nil` |
1131
+ | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1117
1132
  | `service_name` | Service name used for `resque` instrumentation | `'resque'` |
1118
1133
  | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
1119
1134
  | `workers` | An array including all worker classes you want to trace (eg `[MyJob]`) | `[]` |
@@ -1135,6 +1150,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1135
1150
 
1136
1151
  | Key | Description | Default |
1137
1152
  | --- | ----------- | ------- |
1153
+ | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1138
1154
  | `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
1139
1155
  | `service_name` | Service name for `rest_client` instrumentation. | `'rest_client'` |
1140
1156
  | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
@@ -1169,6 +1185,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1169
1185
 
1170
1186
  | Key | Description | Default |
1171
1187
  | --- | ----------- | ------- |
1188
+ | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1172
1189
  | `service_name` | Service name for `sequel` instrumentation | Name of database adapter (e.g. `'mysql2'`) |
1173
1190
  | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
1174
1191
 
@@ -1205,7 +1222,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1205
1222
 
1206
1223
  | Key | Description | Default |
1207
1224
  | --- | ----------- | ------- |
1208
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `nil` |
1225
+ | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1209
1226
  | `service_name` | Service name used for `shoryuken` instrumentation | `'shoryuken'` |
1210
1227
  | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
1211
1228
 
@@ -1227,7 +1244,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1227
1244
 
1228
1245
  | Key | Description | Default |
1229
1246
  | --- | ----------- | ------- |
1230
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `nil` |
1247
+ | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1231
1248
  | `client_service_name` | Service name used for client-side `sidekiq` instrumentation | `'sidekiq-client'` |
1232
1249
  | `service_name` | Service name used for server-side `sidekiq` instrumentation | `'sidekiq'` |
1233
1250
  | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
@@ -1255,6 +1272,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1255
1272
 
1256
1273
  | Key | Description | Default |
1257
1274
  | --- | ----------- | ------- |
1275
+ | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `nil` |
1258
1276
  | `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) so that this service trace is connected with a trace of another service if tracing headers are received | `true` |
1259
1277
  | `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'] }` |
1260
1278
  | `resource_script_names` | Prepend resource names with script name | `false` |
@@ -1280,7 +1298,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1280
1298
 
1281
1299
  | Key | Description | Default |
1282
1300
  | --- | ----------- | ------- |
1283
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `nil` |
1301
+ | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1284
1302
  | `service_name` | Service name used for `sucker_punch` instrumentation | `'sucker_punch'` |
1285
1303
  | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
1286
1304
 
@@ -1,6 +1,5 @@
1
1
  require 'thread'
2
2
 
3
- require 'ddtrace/registry'
4
3
  require 'ddtrace/pin'
5
4
  require 'ddtrace/tracer'
6
5
  require 'ddtrace/error'
@@ -14,39 +13,13 @@ require 'ddtrace/augmentation'
14
13
  # \Datadog global namespace that includes all tracing functionality for Tracer and Span classes.
15
14
  module Datadog
16
15
  extend Augmentation
16
+ extend Configuration
17
17
 
18
- @tracer = Tracer.new
19
- @registry = Registry.new
20
- @configuration = Configuration.new(registry: @registry)
21
-
22
- # Default tracer that can be used as soon as +ddtrace+ is required:
23
- #
24
- # require 'ddtrace'
25
- #
26
- # span = Datadog.tracer.trace('web.request')
27
- # span.finish()
28
- #
29
- # If you want to override the default tracer, the recommended way
30
- # is to "pin" your own tracer onto your traced component:
31
- #
32
- # tracer = Datadog::Tracer.new
33
- # pin = Datadog::Pin.get_from(mypatchcomponent)
34
- # pin.tracer = tracer
35
- class << self
36
- attr_reader :tracer, :registry
37
- attr_accessor :configuration
38
-
39
- def configure(target = configuration, opts = {})
40
- if target.is_a?(Configuration)
41
- yield(target)
42
- else
43
- Configuration::PinSetup.new(target, opts).call
44
- end
45
- end
46
- end
18
+ # Load and extend Contrib by default
19
+ require 'ddtrace/contrib/extensions'
20
+ extend Contrib::Extensions
47
21
  end
48
22
 
49
- require 'ddtrace/contrib/base'
50
23
  require 'ddtrace/contrib/active_model_serializers/integration'
51
24
  require 'ddtrace/contrib/active_record/integration'
52
25
  require 'ddtrace/contrib/aws/integration'
@@ -1,59 +1,26 @@
1
- require_relative 'configuration/proxy'
2
- require_relative 'configuration/resolver'
3
- require_relative 'configuration/pin_setup'
1
+ require 'ddtrace/configuration/pin_setup'
2
+ require 'ddtrace/configuration/settings'
4
3
 
5
4
  module Datadog
6
5
  # Configuration provides a unique access point for configurations
7
- class Configuration
8
- InvalidIntegrationError = Class.new(StandardError)
6
+ module Configuration
7
+ attr_writer :configuration
9
8
 
10
- def initialize(options = {})
11
- @registry = options.fetch(:registry) { Datadog.registry }
12
- @wrapped_registry = {}
9
+ def configuration
10
+ @configuration ||= Settings.new
13
11
  end
14
12
 
15
- def [](integration_name, configuration_name = :default)
16
- integration = fetch_integration(integration_name)
17
-
18
- if integration.class <= Datadog::Contrib::Integration
19
- integration.configuration(configuration_name)
13
+ def configure(target = configuration, opts = {})
14
+ if target.is_a?(Settings)
15
+ yield(target)
20
16
  else
21
- @wrapped_registry[integration_name] ||= Proxy.new(integration)
17
+ PinSetup.new(target, opts).call
22
18
  end
23
19
  end
24
20
 
25
- def use(integration_name, options = {}, &block)
26
- integration = fetch_integration(integration_name)
27
-
28
- if integration.class <= Datadog::Contrib::Integration
29
- configuration_name = options[:describes] || :default
30
- filtered_options = options.reject { |k, _v| k == :describes }
31
- integration.configure(configuration_name, filtered_options, &block)
32
- else
33
- settings = Proxy.new(integration)
34
- integration.sorted_options.each do |name|
35
- settings[name] = options.fetch(name, settings[name])
36
- end
37
- end
38
-
39
- integration.patch if integration.respond_to?(:patch)
40
- end
41
-
42
- def tracer(options = {})
43
- instance = options.fetch(:instance, Datadog.tracer)
44
-
45
- instance.configure(options)
46
- instance.class.log = options[:log] if options[:log]
47
- instance.set_tags(options[:tags]) if options[:tags]
48
- instance.set_tags(env: options[:env]) if options[:env]
49
- instance.class.debug_logging = options.fetch(:debug, false)
50
- end
51
-
52
- private
53
-
54
- def fetch_integration(name)
55
- @registry[name] ||
56
- raise(InvalidIntegrationError, "'#{name}' is not a valid integration.")
21
+ # Helper methods
22
+ def tracer
23
+ configuration.tracer
57
24
  end
58
25
  end
59
26
  end
@@ -1,9 +1,9 @@
1
1
  require 'tsort'
2
2
 
3
3
  module Datadog
4
- class Configuration
4
+ module Configuration
5
5
  # Resolver performs a topological sort over the dependency graph
6
- class Resolver
6
+ class DependencyResolver
7
7
  include TSort
8
8
 
9
9
  def initialize(dependency_graph = {})
@@ -0,0 +1,32 @@
1
+ module Datadog
2
+ module Configuration
3
+ # Represents an instance of an integration configuration option
4
+ class Option
5
+ attr_reader \
6
+ :definition
7
+
8
+ def initialize(definition, context)
9
+ @definition = definition
10
+ @context = context
11
+ @value = nil
12
+ @is_set = false
13
+ end
14
+
15
+ def set(value)
16
+ @value = @context.instance_exec(value, &definition.setter).tap do
17
+ @is_set = true
18
+ end
19
+ end
20
+
21
+ def get
22
+ return definition.default_value unless @is_set
23
+ @value
24
+ end
25
+
26
+ def reset
27
+ @is_set = false
28
+ @value = nil
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,27 @@
1
+ module Datadog
2
+ module Configuration
3
+ # Represents a definition for an integration configuration option
4
+ class OptionDefinition
5
+ IDENTITY = ->(x) { x }
6
+
7
+ attr_reader \
8
+ :default,
9
+ :depends_on,
10
+ :lazy,
11
+ :name,
12
+ :setter
13
+
14
+ def initialize(name, meta = {}, &block)
15
+ @default = meta[:default]
16
+ @depends_on = meta[:depends_on] || []
17
+ @lazy = meta[:lazy] || false
18
+ @name = name.to_sym
19
+ @setter = meta[:setter] || block || IDENTITY
20
+ end
21
+
22
+ def default_value
23
+ lazy ? @default.call : @default
24
+ end
25
+ end
26
+ end
27
+ end