ddtrace 1.18.0 → 1.20.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +82 -1
  3. data/ext/ddtrace_profiling_native_extension/collectors_cpu_and_wall_time_worker.c +96 -66
  4. data/ext/ddtrace_profiling_native_extension/collectors_discrete_dynamic_sampler.c +349 -0
  5. data/ext/ddtrace_profiling_native_extension/collectors_discrete_dynamic_sampler.h +89 -0
  6. data/ext/ddtrace_profiling_native_extension/collectors_dynamic_sampling_rate.c +22 -14
  7. data/ext/ddtrace_profiling_native_extension/collectors_dynamic_sampling_rate.h +4 -0
  8. data/ext/ddtrace_profiling_native_extension/collectors_gc_profiling_helper.c +156 -0
  9. data/ext/ddtrace_profiling_native_extension/collectors_gc_profiling_helper.h +5 -0
  10. data/ext/ddtrace_profiling_native_extension/collectors_stack.c +43 -102
  11. data/ext/ddtrace_profiling_native_extension/collectors_stack.h +10 -3
  12. data/ext/ddtrace_profiling_native_extension/collectors_thread_context.c +159 -124
  13. data/ext/ddtrace_profiling_native_extension/collectors_thread_context.h +2 -1
  14. data/ext/ddtrace_profiling_native_extension/extconf.rb +19 -0
  15. data/ext/ddtrace_profiling_native_extension/heap_recorder.c +970 -0
  16. data/ext/ddtrace_profiling_native_extension/heap_recorder.h +155 -0
  17. data/ext/ddtrace_profiling_native_extension/helpers.h +6 -0
  18. data/ext/ddtrace_profiling_native_extension/libdatadog_helpers.c +20 -0
  19. data/ext/ddtrace_profiling_native_extension/libdatadog_helpers.h +11 -0
  20. data/ext/ddtrace_profiling_native_extension/private_vm_api_access.c +5 -0
  21. data/ext/ddtrace_profiling_native_extension/profiling.c +17 -0
  22. data/ext/ddtrace_profiling_native_extension/ruby_helpers.c +147 -0
  23. data/ext/ddtrace_profiling_native_extension/ruby_helpers.h +28 -0
  24. data/ext/ddtrace_profiling_native_extension/stack_recorder.c +329 -10
  25. data/ext/ddtrace_profiling_native_extension/stack_recorder.h +3 -0
  26. data/ext/ddtrace_profiling_native_extension/time_helpers.h +2 -0
  27. data/lib/datadog/appsec/contrib/rack/request_middleware.rb +2 -1
  28. data/lib/datadog/core/configuration/settings.rb +153 -21
  29. data/lib/datadog/core/environment/class_count.rb +6 -6
  30. data/lib/datadog/core/remote/component.rb +25 -12
  31. data/lib/datadog/core/remote/ext.rb +1 -0
  32. data/lib/datadog/core/remote/tie/tracing.rb +39 -0
  33. data/lib/datadog/core/remote/tie.rb +27 -0
  34. data/lib/datadog/core/telemetry/collector.rb +10 -0
  35. data/lib/datadog/core/telemetry/event.rb +2 -1
  36. data/lib/datadog/core/telemetry/ext.rb +3 -0
  37. data/lib/datadog/core/telemetry/v1/app_event.rb +8 -1
  38. data/lib/datadog/core/telemetry/v1/install_signature.rb +38 -0
  39. data/lib/datadog/opentelemetry/sdk/propagator.rb +3 -2
  40. data/lib/datadog/opentelemetry.rb +3 -0
  41. data/lib/datadog/profiling/collectors/cpu_and_wall_time_worker.rb +5 -12
  42. data/lib/datadog/profiling/component.rb +183 -13
  43. data/lib/datadog/profiling/scheduler.rb +4 -6
  44. data/lib/datadog/profiling/stack_recorder.rb +13 -2
  45. data/lib/datadog/tracing/configuration/ext.rb +0 -1
  46. data/lib/datadog/tracing/configuration/settings.rb +2 -1
  47. data/lib/datadog/tracing/contrib/action_cable/configuration/settings.rb +1 -0
  48. data/lib/datadog/tracing/contrib/action_cable/ext.rb +1 -0
  49. data/lib/datadog/tracing/contrib/action_mailer/configuration/settings.rb +1 -0
  50. data/lib/datadog/tracing/contrib/action_mailer/ext.rb +1 -0
  51. data/lib/datadog/tracing/contrib/action_pack/configuration/settings.rb +1 -0
  52. data/lib/datadog/tracing/contrib/action_pack/ext.rb +1 -0
  53. data/lib/datadog/tracing/contrib/action_view/configuration/settings.rb +1 -0
  54. data/lib/datadog/tracing/contrib/action_view/ext.rb +1 -0
  55. data/lib/datadog/tracing/contrib/active_job/configuration/settings.rb +1 -0
  56. data/lib/datadog/tracing/contrib/active_job/ext.rb +1 -0
  57. data/lib/datadog/tracing/contrib/active_model_serializers/configuration/settings.rb +1 -0
  58. data/lib/datadog/tracing/contrib/active_model_serializers/ext.rb +1 -0
  59. data/lib/datadog/tracing/contrib/active_record/configuration/settings.rb +1 -0
  60. data/lib/datadog/tracing/contrib/active_record/ext.rb +1 -0
  61. data/lib/datadog/tracing/contrib/active_support/configuration/settings.rb +1 -0
  62. data/lib/datadog/tracing/contrib/active_support/ext.rb +1 -0
  63. data/lib/datadog/tracing/contrib/analytics.rb +0 -1
  64. data/lib/datadog/tracing/contrib/aws/configuration/settings.rb +1 -0
  65. data/lib/datadog/tracing/contrib/aws/ext.rb +1 -0
  66. data/lib/datadog/tracing/contrib/dalli/configuration/settings.rb +1 -0
  67. data/lib/datadog/tracing/contrib/dalli/ext.rb +1 -0
  68. data/lib/datadog/tracing/contrib/delayed_job/configuration/settings.rb +1 -0
  69. data/lib/datadog/tracing/contrib/delayed_job/ext.rb +1 -0
  70. data/lib/datadog/tracing/contrib/elasticsearch/configuration/settings.rb +1 -0
  71. data/lib/datadog/tracing/contrib/elasticsearch/ext.rb +1 -0
  72. data/lib/datadog/tracing/contrib/ethon/configuration/settings.rb +1 -0
  73. data/lib/datadog/tracing/contrib/ethon/ext.rb +1 -0
  74. data/lib/datadog/tracing/contrib/excon/configuration/settings.rb +1 -0
  75. data/lib/datadog/tracing/contrib/excon/ext.rb +1 -0
  76. data/lib/datadog/tracing/contrib/faraday/configuration/settings.rb +7 -0
  77. data/lib/datadog/tracing/contrib/faraday/ext.rb +1 -0
  78. data/lib/datadog/tracing/contrib/faraday/middleware.rb +1 -1
  79. data/lib/datadog/tracing/contrib/grape/configuration/settings.rb +1 -0
  80. data/lib/datadog/tracing/contrib/grape/ext.rb +1 -0
  81. data/lib/datadog/tracing/contrib/graphql/configuration/settings.rb +1 -0
  82. data/lib/datadog/tracing/contrib/graphql/ext.rb +1 -0
  83. data/lib/datadog/tracing/contrib/grpc/configuration/settings.rb +1 -0
  84. data/lib/datadog/tracing/contrib/grpc/ext.rb +1 -0
  85. data/lib/datadog/tracing/contrib/http/configuration/settings.rb +1 -0
  86. data/lib/datadog/tracing/contrib/http/distributed/fetcher.rb +2 -2
  87. data/lib/datadog/tracing/contrib/http/ext.rb +1 -0
  88. data/lib/datadog/tracing/contrib/httpclient/configuration/settings.rb +1 -0
  89. data/lib/datadog/tracing/contrib/httpclient/ext.rb +1 -0
  90. data/lib/datadog/tracing/contrib/httprb/configuration/settings.rb +1 -0
  91. data/lib/datadog/tracing/contrib/httprb/ext.rb +1 -0
  92. data/lib/datadog/tracing/contrib/kafka/configuration/settings.rb +1 -0
  93. data/lib/datadog/tracing/contrib/kafka/ext.rb +1 -0
  94. data/lib/datadog/tracing/contrib/mongodb/configuration/settings.rb +1 -0
  95. data/lib/datadog/tracing/contrib/mongodb/ext.rb +1 -0
  96. data/lib/datadog/tracing/contrib/mysql2/configuration/settings.rb +5 -0
  97. data/lib/datadog/tracing/contrib/mysql2/ext.rb +1 -0
  98. data/lib/datadog/tracing/contrib/mysql2/instrumentation.rb +2 -1
  99. data/lib/datadog/tracing/contrib/opensearch/configuration/settings.rb +1 -0
  100. data/lib/datadog/tracing/contrib/opensearch/ext.rb +1 -0
  101. data/lib/datadog/tracing/contrib/pg/configuration/settings.rb +1 -0
  102. data/lib/datadog/tracing/contrib/pg/ext.rb +1 -0
  103. data/lib/datadog/tracing/contrib/presto/configuration/settings.rb +1 -0
  104. data/lib/datadog/tracing/contrib/presto/ext.rb +1 -0
  105. data/lib/datadog/tracing/contrib/qless/configuration/settings.rb +1 -0
  106. data/lib/datadog/tracing/contrib/qless/ext.rb +1 -0
  107. data/lib/datadog/tracing/contrib/que/configuration/settings.rb +1 -0
  108. data/lib/datadog/tracing/contrib/que/ext.rb +1 -0
  109. data/lib/datadog/tracing/contrib/racecar/configuration/settings.rb +1 -0
  110. data/lib/datadog/tracing/contrib/racecar/ext.rb +1 -0
  111. data/lib/datadog/tracing/contrib/rack/configuration/settings.rb +1 -0
  112. data/lib/datadog/tracing/contrib/rack/ext.rb +1 -0
  113. data/lib/datadog/tracing/contrib/rack/middlewares.rb +9 -2
  114. data/lib/datadog/tracing/contrib/rails/auto_instrument_railtie.rb +0 -2
  115. data/lib/datadog/tracing/contrib/rails/configuration/settings.rb +1 -0
  116. data/lib/datadog/tracing/contrib/rails/ext.rb +1 -0
  117. data/lib/datadog/tracing/contrib/rake/configuration/settings.rb +1 -0
  118. data/lib/datadog/tracing/contrib/rake/ext.rb +1 -0
  119. data/lib/datadog/tracing/contrib/redis/configuration/settings.rb +1 -0
  120. data/lib/datadog/tracing/contrib/redis/ext.rb +1 -0
  121. data/lib/datadog/tracing/contrib/redis/instrumentation.rb +2 -2
  122. data/lib/datadog/tracing/contrib/redis/patcher.rb +34 -21
  123. data/lib/datadog/tracing/contrib/resque/configuration/settings.rb +1 -0
  124. data/lib/datadog/tracing/contrib/resque/ext.rb +1 -0
  125. data/lib/datadog/tracing/contrib/rest_client/configuration/settings.rb +1 -0
  126. data/lib/datadog/tracing/contrib/rest_client/ext.rb +1 -0
  127. data/lib/datadog/tracing/contrib/roda/configuration/settings.rb +1 -0
  128. data/lib/datadog/tracing/contrib/roda/ext.rb +1 -0
  129. data/lib/datadog/tracing/contrib/sequel/configuration/settings.rb +1 -0
  130. data/lib/datadog/tracing/contrib/sequel/ext.rb +1 -0
  131. data/lib/datadog/tracing/contrib/shoryuken/configuration/settings.rb +1 -0
  132. data/lib/datadog/tracing/contrib/shoryuken/ext.rb +1 -0
  133. data/lib/datadog/tracing/contrib/sidekiq/configuration/settings.rb +1 -0
  134. data/lib/datadog/tracing/contrib/sidekiq/ext.rb +1 -0
  135. data/lib/datadog/tracing/contrib/sinatra/configuration/settings.rb +1 -0
  136. data/lib/datadog/tracing/contrib/sinatra/ext.rb +1 -0
  137. data/lib/datadog/tracing/contrib/sneakers/configuration/settings.rb +1 -0
  138. data/lib/datadog/tracing/contrib/sneakers/ext.rb +1 -0
  139. data/lib/datadog/tracing/contrib/stripe/configuration/settings.rb +1 -0
  140. data/lib/datadog/tracing/contrib/stripe/ext.rb +1 -0
  141. data/lib/datadog/tracing/contrib/sucker_punch/configuration/settings.rb +1 -0
  142. data/lib/datadog/tracing/contrib/sucker_punch/ext.rb +1 -0
  143. data/lib/datadog/tracing/contrib/trilogy/configuration/settings.rb +58 -0
  144. data/lib/datadog/tracing/contrib/trilogy/ext.rb +27 -0
  145. data/lib/datadog/tracing/contrib/trilogy/instrumentation.rb +94 -0
  146. data/lib/datadog/tracing/contrib/trilogy/integration.rb +43 -0
  147. data/lib/datadog/tracing/contrib/trilogy/patcher.rb +31 -0
  148. data/lib/datadog/tracing/contrib.rb +1 -0
  149. data/lib/datadog/tracing.rb +8 -2
  150. data/lib/ddtrace/version.rb +1 -1
  151. metadata +20 -6
@@ -18,6 +18,7 @@ module Datadog
18
18
  o.default true
19
19
  end
20
20
 
21
+ # @!visibility private
21
22
  option :analytics_enabled do |o|
22
23
  o.type :bool
23
24
  o.env Ext::ENV_ANALYTICS_ENABLED
@@ -9,6 +9,7 @@ module Datadog
9
9
  module Ext
10
10
  CLIENT_SERVICE_NAME = 'sidekiq-client'
11
11
  ENV_ENABLED = 'DD_TRACE_SIDEKIQ_ENABLED'
12
+ # @!visibility private
12
13
  ENV_ANALYTICS_ENABLED = 'DD_TRACE_SIDEKIQ_ANALYTICS_ENABLED'
13
14
  ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_SIDEKIQ_ANALYTICS_SAMPLE_RATE'
14
15
  ENV_TAG_JOB_ARGS = 'DD_SIDEKIQ_TAG_JOB_ARGS'
@@ -19,6 +19,7 @@ module Datadog
19
19
  o.default true
20
20
  end
21
21
 
22
+ # @!visibility private
22
23
  option :analytics_enabled do |o|
23
24
  o.type :bool, nilable: true
24
25
  o.env Ext::ENV_ANALYTICS_ENABLED
@@ -8,6 +8,7 @@ module Datadog
8
8
  # @public_api Changing resource names, tag names, or environment variables creates breaking changes.
9
9
  module Ext
10
10
  ENV_ENABLED = 'DD_TRACE_SINATRA_ENABLED'
11
+ # @!visibility private
11
12
  ENV_ANALYTICS_ENABLED = 'DD_TRACE_SINATRA_ANALYTICS_ENABLED'
12
13
  ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_SINATRA_ANALYTICS_SAMPLE_RATE'
13
14
  RACK_ENV_SINATRA_REQUEST_SPAN = 'datadog.sinatra_request_span'
@@ -16,6 +16,7 @@ module Datadog
16
16
  o.default true
17
17
  end
18
18
 
19
+ # @!visibility private
19
20
  option :analytics_enabled do |o|
20
21
  o.type :bool
21
22
  o.env Ext::ENV_ANALYTICS_ENABLED
@@ -8,6 +8,7 @@ module Datadog
8
8
  # @public_api Changing resource names, tag names, or environment variables creates breaking changes.
9
9
  module Ext
10
10
  ENV_ENABLED = 'DD_TRACE_SNEAKERS_ENABLED'
11
+ # @!visibility private
11
12
  ENV_ANALYTICS_ENABLED = 'DD_TRACE_SNEAKERS_ANALYTICS_ENABLED'
12
13
  ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_SNEAKERS_ANALYTICS_SAMPLE_RATE'
13
14
  SERVICE_NAME = 'sneakers'
@@ -17,6 +17,7 @@ module Datadog
17
17
  o.default true
18
18
  end
19
19
 
20
+ # @!visibility private
20
21
  option :analytics_enabled do |o|
21
22
  o.type :bool
22
23
  o.env Ext::ENV_ANALYTICS_ENABLED
@@ -8,6 +8,7 @@ module Datadog
8
8
  # @public_api Changing resource names, tag names, or environment variables creates breaking changes.
9
9
  module Ext
10
10
  ENV_ENABLED = 'DD_TRACE_STRIPE_ENABLED'
11
+ # @!visibility private
11
12
  ENV_ANALYTICS_ENABLED = 'DD_TRACE_STRIPE_ANALYTICS_ENABLED'
12
13
  ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_STRIPE_ANALYTICS_SAMPLE_RATE'
13
14
  SPAN_REQUEST = 'stripe.request'
@@ -17,6 +17,7 @@ module Datadog
17
17
  o.default true
18
18
  end
19
19
 
20
+ # @!visibility private
20
21
  option :analytics_enabled do |o|
21
22
  o.type :bool
22
23
  o.env Ext::ENV_ANALYTICS_ENABLED
@@ -8,6 +8,7 @@ module Datadog
8
8
  # @public_api Changing resource names, tag names, or environment variables creates breaking changes.
9
9
  module Ext
10
10
  ENV_ENABLED = 'DD_TRACE_SUCKER_PUNCH_ENABLED'
11
+ # @!visibility private
11
12
  ENV_ANALYTICS_ENABLED = 'DD_TRACE_SUCKER_PUNCH_ANALYTICS_ENABLED'
12
13
  ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_SUCKER_PUNCH_ANALYTICS_SAMPLE_RATE'
13
14
  SERVICE_NAME = 'sucker_punch'
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../configuration/settings'
4
+ require_relative '../ext'
5
+
6
+ require_relative '../../propagation/sql_comment'
7
+
8
+ module Datadog
9
+ module Tracing
10
+ module Contrib
11
+ module Trilogy
12
+ module Configuration
13
+ # Custom settings for the Trilogy integration
14
+ # @public_api
15
+ class Settings < Contrib::Configuration::Settings
16
+ option :enabled do |o|
17
+ o.type :bool
18
+ o.env Ext::ENV_ENABLED
19
+ o.default true
20
+ end
21
+
22
+ option :analytics_enabled do |o|
23
+ o.type :bool
24
+ o.env Ext::ENV_ANALYTICS_ENABLED
25
+ o.default false
26
+ end
27
+
28
+ option :analytics_sample_rate do |o|
29
+ o.type :float
30
+ o.env Ext::ENV_ANALYTICS_SAMPLE_RATE
31
+ o.default 1.0
32
+ end
33
+
34
+ option :service_name do |o|
35
+ o.default do
36
+ Contrib::SpanAttributeSchema.fetch_service_name(
37
+ Ext::ENV_SERVICE_NAME,
38
+ Ext::DEFAULT_PEER_SERVICE_NAME
39
+ )
40
+ end
41
+ end
42
+
43
+ option :comment_propagation do |o|
44
+ o.type :string
45
+ o.env Contrib::Propagation::SqlComment::Ext::ENV_DBM_PROPAGATION_MODE
46
+ o.default Contrib::Propagation::SqlComment::Ext::DISABLED
47
+ end
48
+
49
+ option :peer_service do |o|
50
+ o.type :string, nilable: true
51
+ o.env Ext::ENV_PEER_SERVICE
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Datadog
4
+ module Tracing
5
+ module Contrib
6
+ module Trilogy
7
+ # Trilogy integration constants
8
+ # @public_api Changing resource names, tag names, or environment variables creates breaking changes.
9
+ module Ext
10
+ ENV_ENABLED = 'DD_TRACE_TRILOGY_ENABLED'
11
+ ENV_SERVICE_NAME = 'DD_TRACE_TRILOGY_SERVICE_NAME'
12
+ ENV_PEER_SERVICE = 'DD_TRACE_TRILOGY_PEER_SERVICE'
13
+
14
+ ENV_ANALYTICS_ENABLED = 'DD_TRACE_TRILOGY_ANALYTICS_ENABLED'
15
+ ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_TRILOGY_ANALYTICS_SAMPLE_RATE'
16
+ DEFAULT_PEER_SERVICE_NAME = 'trilogy'
17
+ SPAN_QUERY = 'trilogy.query'
18
+ TAG_DB_NAME = 'trilogy.db.name'
19
+ TAG_COMPONENT = 'trilogy'
20
+ TAG_OPERATION_QUERY = 'query'
21
+ TAG_SYSTEM = 'mysql'
22
+ PEER_SERVICE_SOURCES = (Array[Ext::TAG_DB_NAME] + Contrib::Ext::DB::PEER_SERVICE_SOURCES).freeze
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,94 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../metadata/ext'
4
+ require_relative '../analytics'
5
+ require_relative 'ext'
6
+ require_relative '../ext'
7
+ require_relative '../propagation/sql_comment'
8
+ require_relative '../propagation/sql_comment/mode'
9
+
10
+ module Datadog
11
+ module Tracing
12
+ module Contrib
13
+ module Trilogy
14
+ # Trilogy patch module
15
+ module Instrumentation
16
+ def self.included(base)
17
+ base.prepend(InstanceMethods)
18
+ end
19
+
20
+ # Trilogy patch instance methods
21
+ module InstanceMethods
22
+ def query(sql)
23
+ service = Datadog.configuration_for(self, :service_name) || datadog_configuration[:service_name]
24
+
25
+ Tracing.trace(Ext::SPAN_QUERY, service: service) do |span, trace_op|
26
+ span.resource = sql
27
+ span.span_type = Tracing::Metadata::Ext::SQL::TYPE
28
+
29
+ if datadog_configuration[:peer_service]
30
+ span.set_tag(
31
+ Tracing::Metadata::Ext::TAG_PEER_SERVICE,
32
+ datadog_configuration[:peer_service]
33
+ )
34
+ end
35
+
36
+ # Tag original global service name if not used
37
+ if span.service != Datadog.configuration.service
38
+ span.set_tag(Tracing::Contrib::Ext::Metadata::TAG_BASE_SERVICE, Datadog.configuration.service)
39
+ end
40
+
41
+ span.set_tag(Contrib::Ext::DB::TAG_SYSTEM, Ext::TAG_SYSTEM)
42
+ span.set_tag(Tracing::Metadata::Ext::TAG_KIND, Tracing::Metadata::Ext::SpanKind::TAG_CLIENT)
43
+
44
+ span.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT)
45
+ span.set_tag(Tracing::Metadata::Ext::TAG_OPERATION, Ext::TAG_OPERATION_QUERY)
46
+
47
+ span.set_tag(Tracing::Metadata::Ext::TAG_PEER_HOSTNAME, connection_options[:host])
48
+
49
+ # Set analytics sample rate
50
+ Contrib::Analytics.set_sample_rate(span, analytics_sample_rate) if analytics_enabled?
51
+
52
+ span.set_tag(Ext::TAG_DB_NAME, connection_options[:database])
53
+ span.set_tag(Tracing::Metadata::Ext::NET::TAG_TARGET_HOST, connection_options[:host])
54
+ span.set_tag(Tracing::Metadata::Ext::NET::TAG_TARGET_PORT, connection_options[:port])
55
+
56
+ Contrib::SpanAttributeSchema.set_peer_service!(span, Ext::PEER_SERVICE_SOURCES)
57
+
58
+ propagation_mode = Contrib::Propagation::SqlComment::Mode.new(comment_propagation)
59
+
60
+ Contrib::Propagation::SqlComment.annotate!(span, propagation_mode)
61
+ sql = Contrib::Propagation::SqlComment.prepend_comment(
62
+ sql,
63
+ span,
64
+ trace_op,
65
+ propagation_mode
66
+ )
67
+
68
+ super(sql)
69
+ end
70
+ end
71
+
72
+ private
73
+
74
+ def datadog_configuration
75
+ Datadog.configuration.tracing[:trilogy]
76
+ end
77
+
78
+ def analytics_enabled?
79
+ datadog_configuration[:analytics_enabled]
80
+ end
81
+
82
+ def analytics_sample_rate
83
+ datadog_configuration[:analytics_sample_rate]
84
+ end
85
+
86
+ def comment_propagation
87
+ datadog_configuration[:comment_propagation]
88
+ end
89
+ end
90
+ end
91
+ end
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../integration'
4
+ require_relative 'configuration/settings'
5
+ require_relative 'patcher'
6
+
7
+ module Datadog
8
+ module Tracing
9
+ module Contrib
10
+ module Trilogy
11
+ # Description of Trilogy integration
12
+ class Integration
13
+ include Contrib::Integration
14
+
15
+ MINIMUM_VERSION = Gem::Version.new('2.0.0')
16
+
17
+ # @public_api Changing the integration name or integration options can cause breaking changes
18
+ register_as :trilogy
19
+
20
+ def self.version
21
+ Gem.loaded_specs['trilogy'] && Gem.loaded_specs['trilogy'].version
22
+ end
23
+
24
+ def self.loaded?
25
+ !defined?(::Trilogy).nil?
26
+ end
27
+
28
+ def self.compatible?
29
+ super && version >= MINIMUM_VERSION
30
+ end
31
+
32
+ def new_configuration
33
+ Configuration::Settings.new
34
+ end
35
+
36
+ def patcher
37
+ Patcher
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../patcher'
4
+ require_relative 'instrumentation'
5
+
6
+ module Datadog
7
+ module Tracing
8
+ module Contrib
9
+ module Trilogy
10
+ # Patcher enables patching of 'trilogy' module.
11
+ module Patcher
12
+ include Contrib::Patcher
13
+
14
+ module_function
15
+
16
+ def target_version
17
+ Integration.version
18
+ end
19
+
20
+ def patch
21
+ patch_trilogy_client
22
+ end
23
+
24
+ def patch_trilogy_client
25
+ ::Trilogy.include(Instrumentation)
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -79,3 +79,4 @@ require_relative 'contrib/sinatra/integration'
79
79
  require_relative 'contrib/sneakers/integration'
80
80
  require_relative 'contrib/stripe/integration'
81
81
  require_relative 'contrib/sucker_punch/integration'
82
+ require_relative 'contrib/trilogy/integration'
@@ -73,8 +73,14 @@ module Datadog
73
73
  # (see Datadog::Tracing::Tracer#active_correlation)
74
74
  # @public_api
75
75
  def correlation
76
- current_tracer = tracer
77
- return unless current_tracer
76
+ # We access this in this way as:
77
+ # * If the components have not been initialized, it doesn't make sense to initialize ddtrace just to say
78
+ # 'nil' here
79
+ # * It prevents recursive initialization attempts, see https://github.com/DataDog/dd-trace-rb/issues/3385
80
+ components = Datadog.send(:components, allow_initialization: false)
81
+ current_tracer = components.tracer if components
82
+
83
+ return Datadog::Tracing::Correlation::Identifier.new unless current_tracer
78
84
 
79
85
  current_tracer.active_correlation
80
86
  end
@@ -3,7 +3,7 @@
3
3
  module DDTrace
4
4
  module VERSION
5
5
  MAJOR = 1
6
- MINOR = 18
6
+ MINOR = 20
7
7
  PATCH = 0
8
8
  PRE = nil
9
9
  BUILD = nil
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ddtrace
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.18.0
4
+ version: 1.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Datadog, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-07 00:00:00.000000000 Z
11
+ date: 2024-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 3.2.3
33
+ version: 3.3.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 3.2.3
40
+ version: 3.3.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: libddwaf
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 0.5.0
75
+ version: 0.7.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 0.5.0
82
+ version: 0.7.0
83
83
  description: |
84
84
  ddtrace is Datadog's tracing client for Ruby. It is used to trace requests
85
85
  as they flow across web servers, databases and microservices so that developers
@@ -108,8 +108,12 @@ files:
108
108
  - ext/ddtrace_profiling_native_extension/clock_id_from_pthread.c
109
109
  - ext/ddtrace_profiling_native_extension/clock_id_noop.c
110
110
  - ext/ddtrace_profiling_native_extension/collectors_cpu_and_wall_time_worker.c
111
+ - ext/ddtrace_profiling_native_extension/collectors_discrete_dynamic_sampler.c
112
+ - ext/ddtrace_profiling_native_extension/collectors_discrete_dynamic_sampler.h
111
113
  - ext/ddtrace_profiling_native_extension/collectors_dynamic_sampling_rate.c
112
114
  - ext/ddtrace_profiling_native_extension/collectors_dynamic_sampling_rate.h
115
+ - ext/ddtrace_profiling_native_extension/collectors_gc_profiling_helper.c
116
+ - ext/ddtrace_profiling_native_extension/collectors_gc_profiling_helper.h
113
117
  - ext/ddtrace_profiling_native_extension/collectors_idle_sampling_helper.c
114
118
  - ext/ddtrace_profiling_native_extension/collectors_idle_sampling_helper.h
115
119
  - ext/ddtrace_profiling_native_extension/collectors_stack.c
@@ -117,6 +121,8 @@ files:
117
121
  - ext/ddtrace_profiling_native_extension/collectors_thread_context.c
118
122
  - ext/ddtrace_profiling_native_extension/collectors_thread_context.h
119
123
  - ext/ddtrace_profiling_native_extension/extconf.rb
124
+ - ext/ddtrace_profiling_native_extension/heap_recorder.c
125
+ - ext/ddtrace_profiling_native_extension/heap_recorder.h
120
126
  - ext/ddtrace_profiling_native_extension/helpers.h
121
127
  - ext/ddtrace_profiling_native_extension/http_transport.c
122
128
  - ext/ddtrace_profiling_native_extension/libdatadog_helpers.c
@@ -272,6 +278,8 @@ files:
272
278
  - lib/datadog/core/remote/dispatcher.rb
273
279
  - lib/datadog/core/remote/ext.rb
274
280
  - lib/datadog/core/remote/negotiation.rb
281
+ - lib/datadog/core/remote/tie.rb
282
+ - lib/datadog/core/remote/tie/tracing.rb
275
283
  - lib/datadog/core/remote/transport/config.rb
276
284
  - lib/datadog/core/remote/transport/http.rb
277
285
  - lib/datadog/core/remote/transport/http/api.rb
@@ -301,6 +309,7 @@ files:
301
309
  - lib/datadog/core/telemetry/v1/configuration.rb
302
310
  - lib/datadog/core/telemetry/v1/dependency.rb
303
311
  - lib/datadog/core/telemetry/v1/host.rb
312
+ - lib/datadog/core/telemetry/v1/install_signature.rb
304
313
  - lib/datadog/core/telemetry/v1/integration.rb
305
314
  - lib/datadog/core/telemetry/v1/product.rb
306
315
  - lib/datadog/core/telemetry/v1/telemetry_request.rb
@@ -787,6 +796,11 @@ files:
787
796
  - lib/datadog/tracing/contrib/sucker_punch/instrumentation.rb
788
797
  - lib/datadog/tracing/contrib/sucker_punch/integration.rb
789
798
  - lib/datadog/tracing/contrib/sucker_punch/patcher.rb
799
+ - lib/datadog/tracing/contrib/trilogy/configuration/settings.rb
800
+ - lib/datadog/tracing/contrib/trilogy/ext.rb
801
+ - lib/datadog/tracing/contrib/trilogy/instrumentation.rb
802
+ - lib/datadog/tracing/contrib/trilogy/integration.rb
803
+ - lib/datadog/tracing/contrib/trilogy/patcher.rb
790
804
  - lib/datadog/tracing/contrib/utils/database.rb
791
805
  - lib/datadog/tracing/contrib/utils/quantization/hash.rb
792
806
  - lib/datadog/tracing/contrib/utils/quantization/http.rb