ddtrace 1.12.0 → 1.12.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 59174b63b257f636df60be99956c8e221fcf046ace610c57eb01192fac6560ad
4
- data.tar.gz: 647e8de04a54a65b40ad7b20061a015f510966f7643c192df30f3710a8335386
3
+ metadata.gz: 7755d42a1b84dda8386f13ce2edc3854f09e1e227d5786546b19ea31a60cc03b
4
+ data.tar.gz: 57ee6f72d29b72305c8272b98dc4b7d08a66f9463820d9963aa487723094d1f7
5
5
  SHA512:
6
- metadata.gz: b677b76e9e3b00df5e9c5b33bfe8c6007cd867053366364769391bb1b41457e9e380c5869bb85cc97071969e4e6164fcbe89148aaac11828bdc9de7957cc5d21
7
- data.tar.gz: 33d66238def0a52a491175d015bfe80e15b84e975abc974710d8b892fb76ffe4ff336a15f23341ecd94b5979d7015d75dc93587d7e227d0bd759c6fdb5c782c4
6
+ metadata.gz: e9c5d234fb1261e202bf8d4ae00417f31f325dbcc9ceb9081277ac96a04114316456fed6d21f3de343dbe6192e4a0ceccb4504e5b1a59bbb44fe2666042a7890
7
+ data.tar.gz: effa42b2181771676d69ea5efb946cd6bd4617853b36f75b9655a710d369f57a200dded1cdc8b86642eaf60174c20b44da3b3de29fbfddfd76c6845364927fe2
data/CHANGELOG.md CHANGED
@@ -2,6 +2,22 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [1.12.1] - 2023-06-14
6
+
7
+ ### Added
8
+ Appsec: Add `appsec.blocked` tag to span ([#2895][])
9
+ Profiling: Add workaround for legacy profiler incompatibility with ruby-cloud-profiler gem ([#2891][])
10
+ Core: Allow setting remote configuration service name ([#2853][])
11
+
12
+ ### Changed
13
+ Appsec: Change the value format for the WAF address `server.request.query` ([#2903][])
14
+ Profiling: Log pkg-config command when building profiling native extension
15
+
16
+ ### Fixed
17
+ Appsec: Update blocked response content_type resolution ([#2900][])
18
+ Appsec: Ensure to use service entry span. ([#2898][])
19
+ Tracing: Fix AWS integration constant loading ([#2896][])
20
+
5
21
  ## [1.12.0] - 2023-06-02
6
22
 
7
23
  ### Added
@@ -2438,7 +2454,8 @@ Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.3.1
2438
2454
 
2439
2455
  Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
2440
2456
 
2441
- [Unreleased]: https://github.com/DataDog/dd-trace-rb/compare/v1.12.0...master
2457
+ [Unreleased]: https://github.com/DataDog/dd-trace-rb/compare/v1.12.1...master
2458
+ [1.12.1]: https://github.com/DataDog/dd-trace-rb/compare/v1.12.0...v1.12.1
2442
2459
  [1.12.0]: https://github.com/DataDog/dd-trace-rb/compare/v1.11.1...v1.12.0
2443
2460
  [1.11.1]: https://github.com/DataDog/dd-trace-rb/compare/v1.10.1...v1.11.1
2444
2461
  [1.11.0]: https://github.com/DataDog/dd-trace-rb/compare/v1.10.1...v1.11.0
@@ -3504,6 +3521,7 @@ Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
3504
3521
  [#2829]: https://github.com/DataDog/dd-trace-rb/issues/2829
3505
3522
  [#2836]: https://github.com/DataDog/dd-trace-rb/issues/2836
3506
3523
  [#2840]: https://github.com/DataDog/dd-trace-rb/issues/2840
3524
+ [#2853]: https://github.com/DataDog/dd-trace-rb/issues/2853
3507
3525
  [#2854]: https://github.com/DataDog/dd-trace-rb/issues/2854
3508
3526
  [#2855]: https://github.com/DataDog/dd-trace-rb/issues/2855
3509
3527
  [#2856]: https://github.com/DataDog/dd-trace-rb/issues/2856
@@ -3517,6 +3535,12 @@ Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
3517
3535
  [#2875]: https://github.com/DataDog/dd-trace-rb/issues/2875
3518
3536
  [#2883]: https://github.com/DataDog/dd-trace-rb/issues/2883
3519
3537
  [#2890]: https://github.com/DataDog/dd-trace-rb/issues/2890
3538
+ [#2891]: https://github.com/DataDog/dd-trace-rb/issues/2891
3539
+ [#2895]: https://github.com/DataDog/dd-trace-rb/issues/2895
3540
+ [#2896]: https://github.com/DataDog/dd-trace-rb/issues/2896
3541
+ [#2898]: https://github.com/DataDog/dd-trace-rb/issues/2898
3542
+ [#2900]: https://github.com/DataDog/dd-trace-rb/issues/2900
3543
+ [#2903]: https://github.com/DataDog/dd-trace-rb/issues/2903
3520
3544
  [@AdrianLC]: https://github.com/AdrianLC
3521
3545
  [@Azure7111]: https://github.com/Azure7111
3522
3546
  [@BabyGroot]: https://github.com/BabyGroot
@@ -175,6 +175,8 @@ Logging.message("[ddtrace] PKG_CONFIG_PATH set to #{ENV['PKG_CONFIG_PATH'].inspe
175
175
  $stderr.puts("Using libdatadog #{Libdatadog::VERSION} from #{Libdatadog.pkgconfig_folder}")
176
176
 
177
177
  unless pkg_config('datadog_profiling_with_rpath')
178
+ Logging.message("[ddtrace] Ruby detected the pkg-config command is #{$PKGCONFIG.inspect}\n")
179
+
178
180
  skip_building_extension!(
179
181
  if Datadog::Profiling::NativeExtensionHelpers::Supported.pkg_config_missing?
180
182
  Datadog::Profiling::NativeExtensionHelpers::Supported::PKG_CONFIG_IS_MISSING
@@ -25,11 +25,13 @@ module Datadog
25
25
  def query
26
26
  # Downstream libddwaf expects keys and values to be extractable
27
27
  # separately so we can't use [[k, v], ...]. We also want to allow
28
- # duplicate keys, so we use [{k, v}, ...] instead.
29
- request.query_string.split('&').map do |e|
28
+ # duplicate keys, so we use {k => [v, ...], ...} instead, taking into
29
+ # account that {k => [v1, v2, ...], ...} is possible for duplicate keys.
30
+ request.query_string.split('&').each.with_object({}) do |e, hash|
30
31
  k, v = e.split('=').map { |s| CGI.unescape(s) }
32
+ hash[k] ||= []
31
33
 
32
- { k => v }
34
+ hash[k] << v
33
35
  end
34
36
  end
35
37
 
@@ -28,21 +28,21 @@ module Datadog
28
28
  scope = gateway_request.env[Datadog::AppSec::Ext::SCOPE_KEY]
29
29
 
30
30
  AppSec::Reactive::Operation.new('rack.request') do |op|
31
- trace = active_trace
32
- span = active_span
33
-
34
31
  Rack::Reactive::Request.subscribe(op, scope.processor_context) do |result, _block|
35
32
  if result.status == :match
36
33
  # TODO: should this hash be an Event instance instead?
37
34
  event = {
38
35
  waf_result: result,
39
- trace: trace,
40
- span: span,
36
+ trace: scope.trace,
37
+ span: scope.service_entry_span,
41
38
  request: gateway_request,
42
39
  actions: result.actions
43
40
  }
44
41
 
45
- span.set_tag('appsec.event', 'true') if span
42
+ if scope.service_entry_span
43
+ scope.service_entry_span.set_tag('appsec.blocked', 'true') if result.actions.include?('block')
44
+ scope.service_entry_span.set_tag('appsec.event', 'true')
45
+ end
46
46
 
47
47
  scope.processor_context.events << event
48
48
  end
@@ -71,21 +71,21 @@ module Datadog
71
71
  scope = gateway_response.scope
72
72
 
73
73
  AppSec::Reactive::Operation.new('rack.response') do |op|
74
- trace = active_trace
75
- span = active_span
76
-
77
74
  Rack::Reactive::Response.subscribe(op, scope.processor_context) do |result, _block|
78
75
  if result.status == :match
79
76
  # TODO: should this hash be an Event instance instead?
80
77
  event = {
81
78
  waf_result: result,
82
- trace: trace,
83
- span: span,
79
+ trace: scope.trace,
80
+ span: scope.service_entry_span,
84
81
  response: gateway_response,
85
82
  actions: result.actions
86
83
  }
87
84
 
88
- span.set_tag('appsec.event', 'true') if span
85
+ if scope.service_entry_span
86
+ scope.service_entry_span.set_tag('appsec.blocked', 'true') if result.actions.include?('block')
87
+ scope.service_entry_span.set_tag('appsec.event', 'true')
88
+ end
89
89
 
90
90
  scope.processor_context.events << event
91
91
  end
@@ -114,21 +114,21 @@ module Datadog
114
114
  scope = gateway_request.env[Datadog::AppSec::Ext::SCOPE_KEY]
115
115
 
116
116
  AppSec::Reactive::Operation.new('rack.request.body') do |op|
117
- trace = active_trace
118
- span = active_span
119
-
120
117
  Rack::Reactive::RequestBody.subscribe(op, scope.processor_context) do |result, _block|
121
118
  if result.status == :match
122
119
  # TODO: should this hash be an Event instance instead?
123
120
  event = {
124
121
  waf_result: result,
125
- trace: trace,
126
- span: span,
122
+ trace: scope.trace,
123
+ span: scope.service_entry_span,
127
124
  request: gateway_request,
128
125
  actions: result.actions
129
126
  }
130
127
 
131
- span.set_tag('appsec.event', 'true') if span
128
+ if scope.service_entry_span
129
+ scope.service_entry_span.set_tag('appsec.blocked', 'true') if result.actions.include?('block')
130
+ scope.service_entry_span.set_tag('appsec.event', 'true')
131
+ end
132
132
 
133
133
  scope.processor_context.events << event
134
134
  end
@@ -149,24 +149,6 @@ module Datadog
149
149
  [ret, res]
150
150
  end
151
151
  end
152
-
153
- private
154
-
155
- def active_trace
156
- # TODO: factor out tracing availability detection
157
-
158
- return unless defined?(Datadog::Tracing)
159
-
160
- Datadog::Tracing.active_trace
161
- end
162
-
163
- def active_span
164
- # TODO: factor out tracing availability detection
165
-
166
- return unless defined?(Datadog::Tracing)
167
-
168
- Datadog::Tracing.active_span
169
- end
170
152
  end
171
153
  end
172
154
  end
@@ -53,7 +53,7 @@ module Datadog
53
53
 
54
54
  gateway_request = Gateway::Request.new(env)
55
55
 
56
- add_appsec_tags(processor, active_trace, active_span, env)
56
+ add_appsec_tags(processor, scope.trace, scope.service_entry_span, env)
57
57
 
58
58
  request_return, request_response = catch(::Datadog::AppSec::Ext::INTERRUPT) do
59
59
  Instrumentation.gateway.push('rack.request', gateway_request) do
@@ -79,7 +79,7 @@ module Datadog
79
79
  e[:request] ||= gateway_request
80
80
  end
81
81
 
82
- AppSec::Event.record(active_span, *scope.processor_context.events)
82
+ AppSec::Event.record(scope.service_entry_span, *scope.processor_context.events)
83
83
 
84
84
  if response_response && response_response.any? { |action, _event| action == :block }
85
85
  request_return = AppSec::Response.negotiate(env).to_rack
@@ -88,7 +88,7 @@ module Datadog
88
88
  request_return
89
89
  ensure
90
90
  if scope
91
- add_waf_runtime_tags(active_span, scope.processor_context)
91
+ add_waf_runtime_tags(scope.service_entry_span, scope.processor_context)
92
92
  Datadog::AppSec::Scope.deactivate_scope
93
93
  end
94
94
  end
@@ -24,21 +24,21 @@ module Datadog
24
24
  scope = gateway_request.env[Datadog::AppSec::Ext::SCOPE_KEY]
25
25
 
26
26
  AppSec::Reactive::Operation.new('rails.request.action') do |op|
27
- trace = active_trace
28
- span = active_span
29
-
30
27
  Rails::Reactive::Action.subscribe(op, scope.processor_context) do |result, _block|
31
28
  if result.status == :match
32
29
  # TODO: should this hash be an Event instance instead?
33
30
  event = {
34
31
  waf_result: result,
35
- trace: trace,
36
- span: span,
32
+ trace: scope.trace,
33
+ span: scope.service_entry_span,
37
34
  request: gateway_request,
38
35
  actions: result.actions
39
36
  }
40
37
 
41
- span.set_tag('appsec.event', 'true') if span
38
+ if scope.service_entry_span
39
+ scope.service_entry_span.set_tag('appsec.blocked', 'true') if result.actions.include?('block')
40
+ scope.service_entry_span.set_tag('appsec.event', 'true')
41
+ end
42
42
 
43
43
  scope.processor_context.events << event
44
44
  end
@@ -59,24 +59,6 @@ module Datadog
59
59
  [ret, res]
60
60
  end
61
61
  end
62
-
63
- private
64
-
65
- def active_trace
66
- # TODO: factor out tracing availability detection
67
-
68
- return unless defined?(Datadog::Tracing)
69
-
70
- Datadog::Tracing.active_trace
71
- end
72
-
73
- def active_span
74
- # TODO: factor out tracing availability detection
75
-
76
- return unless defined?(Datadog::Tracing)
77
-
78
- Datadog::Tracing.active_span
79
- end
80
62
  end
81
63
  end
82
64
  end
@@ -26,21 +26,21 @@ module Datadog
26
26
  scope = gateway_request.env[Datadog::AppSec::Ext::SCOPE_KEY]
27
27
 
28
28
  AppSec::Reactive::Operation.new('sinatra.request.dispatch') do |op|
29
- trace = active_trace
30
- span = active_span
31
-
32
29
  Rack::Reactive::RequestBody.subscribe(op, scope.processor_context) do |result, _block|
33
30
  if result.status == :match
34
31
  # TODO: should this hash be an Event instance instead?
35
32
  event = {
36
33
  waf_result: result,
37
- trace: trace,
38
- span: span,
34
+ trace: scope.trace,
35
+ span: scope.service_entry_span,
39
36
  request: gateway_request,
40
37
  actions: result.actions
41
38
  }
42
39
 
43
- span.set_tag('appsec.event', 'true') if span
40
+ if scope.service_entry_span
41
+ scope.service_entry_span.set_tag('appsec.blocked', 'true') if result.actions.include?('block')
42
+ scope.service_entry_span.set_tag('appsec.event', 'true')
43
+ end
44
44
 
45
45
  scope.processor_context.events << event
46
46
  end
@@ -69,21 +69,21 @@ module Datadog
69
69
  scope = gateway_request.env[Datadog::AppSec::Ext::SCOPE_KEY]
70
70
 
71
71
  AppSec::Reactive::Operation.new('sinatra.request.routed') do |op|
72
- trace = active_trace
73
- span = active_span
74
-
75
72
  Sinatra::Reactive::Routed.subscribe(op, scope.processor_context) do |result, _block|
76
73
  if result.status == :match
77
74
  # TODO: should this hash be an Event instance instead?
78
75
  event = {
79
76
  waf_result: result,
80
- trace: trace,
81
- span: span,
77
+ trace: scope.trace,
78
+ span: scope.service_entry_span,
82
79
  request: gateway_request,
83
80
  actions: result.actions
84
81
  }
85
82
 
86
- span.set_tag('appsec.event', 'true') if span
83
+ if scope.service_entry_span
84
+ scope.service_entry_span.set_tag('appsec.blocked', 'true') if result.actions.include?('block')
85
+ scope.service_entry_span.set_tag('appsec.event', 'true')
86
+ end
87
87
 
88
88
  scope.processor_context.events << event
89
89
  end
@@ -104,24 +104,6 @@ module Datadog
104
104
  [ret, res]
105
105
  end
106
106
  end
107
-
108
- private
109
-
110
- def active_trace
111
- # TODO: factor out tracing availability detection
112
-
113
- return unless defined?(Datadog::Tracing)
114
-
115
- Datadog::Tracing.active_trace
116
- end
117
-
118
- def active_span
119
- # TODO: factor out tracing availability detection
120
-
121
- return unless defined?(Datadog::Tracing)
122
-
123
- Datadog::Tracing.active_span
124
- end
125
107
  end
126
108
  end
127
109
  end
@@ -47,7 +47,6 @@ module Datadog
47
47
  end
48
48
  end
49
49
 
50
- # rubocop:disable Metrics/MethodLength
51
50
  def self.record_via_span(span, *events)
52
51
  events.group_by { |e| e[:trace] }.each do |trace, event_group|
53
52
  unless trace
@@ -62,52 +61,53 @@ module Datadog
62
61
  )
63
62
 
64
63
  # prepare and gather tags to apply
65
- trace_tags = event_group.each_with_object({}) do |event, tags|
66
- # TODO: assume HTTP request context for now
64
+ service_entry_tags = build_service_entry_tags(event_group)
65
+ # complex types are unsupported, we need to serialize to a string
66
+ triggers = service_entry_tags.delete('_dd.appsec.triggers')
67
+ span.set_tag('_dd.appsec.json', JSON.dump({ triggers: triggers }))
67
68
 
68
- if (request = event[:request])
69
- request_headers = request.headers.select do |k, _|
70
- ALLOWED_REQUEST_HEADERS.include?(k.downcase)
71
- end
69
+ # apply tags to service entry span
70
+ service_entry_tags.each do |key, value|
71
+ span.set_tag(key, value)
72
+ end
73
+ end
74
+ end
72
75
 
73
- request_headers.each do |header, value|
74
- tags["http.request.headers.#{header}"] = value
75
- end
76
+ def self.build_service_entry_tags(event_group)
77
+ event_group.each_with_object({}) do |event, tags|
78
+ # TODO: assume HTTP request context for now
76
79
 
77
- tags['http.host'] = request.host
78
- tags['http.useragent'] = request.user_agent
79
- tags['network.client.ip'] = request.remote_addr
80
+ if (request = event[:request])
81
+ request_headers = request.headers.select do |k, _|
82
+ ALLOWED_REQUEST_HEADERS.include?(k.downcase)
80
83
  end
81
84
 
82
- if (response = event[:response])
83
- response_headers = response.headers.select do |k, _|
84
- ALLOWED_RESPONSE_HEADERS.include?(k.downcase)
85
- end
86
-
87
- response_headers.each do |header, value|
88
- tags["http.response.headers.#{header}"] = value
89
- end
85
+ request_headers.each do |header, value|
86
+ tags["http.request.headers.#{header}"] = value
90
87
  end
91
88
 
92
- tags['_dd.origin'] = 'appsec'
93
-
94
- # accumulate triggers
95
- tags['_dd.appsec.triggers'] ||= []
96
- tags['_dd.appsec.triggers'] += event[:waf_result].data
89
+ tags['http.host'] = request.host
90
+ tags['http.useragent'] = request.user_agent
91
+ tags['network.client.ip'] = request.remote_addr
97
92
  end
98
93
 
99
- # apply tags to root span
100
-
101
- # complex types are unsupported, we need to serialize to a string
102
- triggers = trace_tags.delete('_dd.appsec.triggers')
103
- span.set_tag('_dd.appsec.json', JSON.dump({ triggers: triggers }))
94
+ if (response = event[:response])
95
+ response_headers = response.headers.select do |k, _|
96
+ ALLOWED_RESPONSE_HEADERS.include?(k.downcase)
97
+ end
104
98
 
105
- trace_tags.each do |key, value|
106
- span.set_tag(key, value)
99
+ response_headers.each do |header, value|
100
+ tags["http.response.headers.#{header}"] = value
101
+ end
107
102
  end
103
+
104
+ tags['_dd.origin'] = 'appsec'
105
+
106
+ # accumulate triggers
107
+ tags['_dd.appsec.triggers'] ||= []
108
+ tags['_dd.appsec.triggers'] += event[:waf_result].data
108
109
  end
109
110
  end
110
- # rubocop:enable Metrics/MethodLength
111
111
  end
112
112
  end
113
113
  end
@@ -24,21 +24,21 @@ module Datadog
24
24
  scope = Datadog::AppSec.active_scope
25
25
 
26
26
  AppSec::Reactive::Operation.new('identity.set_user') do |op|
27
- trace = active_trace
28
- span = active_span
29
-
30
27
  Monitor::Reactive::SetUser.subscribe(op, scope.processor_context) do |result, _block|
31
28
  if result.status == :match
32
29
  # TODO: should this hash be an Event instance instead?
33
30
  event = {
34
31
  waf_result: result,
35
- trace: trace,
36
- span: span,
32
+ trace: scope.trace,
33
+ span: scope.service_entry_span,
37
34
  user: user,
38
35
  actions: result.actions
39
36
  }
40
37
 
41
- span.set_tag('appsec.event', 'true') if span
38
+ if scope.service_entry_span
39
+ scope.service_entry_span.set_tag('appsec.blocked', 'true') if result.actions.include?('block')
40
+ scope.service_entry_span.set_tag('appsec.event', 'true')
41
+ end
42
42
 
43
43
  scope.processor_context.events << event
44
44
  end
@@ -59,24 +59,6 @@ module Datadog
59
59
  [ret, res]
60
60
  end
61
61
  end
62
-
63
- private
64
-
65
- def active_trace
66
- # TODO: factor out tracing availability detection
67
-
68
- return unless defined?(Datadog::Tracing)
69
-
70
- Datadog::Tracing.active_trace
71
- end
72
-
73
- def active_span
74
- # TODO: factor out tracing availability detection
75
-
76
- return unless defined?(Datadog::Tracing)
77
-
78
- Datadog::Tracing.active_span
79
- end
80
62
  end
81
63
  end
82
64
  end
@@ -36,30 +36,34 @@ module Datadog
36
36
  Response.new(
37
37
  status: 403,
38
38
  headers: { 'Content-Type' => content_type },
39
- body: [Datadog::AppSec::Assets.blocked(format: FORMAT_MAP[content_type])]
39
+ body: [Datadog::AppSec::Assets.blocked(format: CONTENT_TYPE_TO_FORMAT[content_type])]
40
40
  )
41
41
  end
42
42
 
43
43
  private
44
44
 
45
- FORMAT_MAP = {
46
- 'text/plain' => :text,
47
- 'text/html' => :html,
45
+ CONTENT_TYPE_TO_FORMAT = {
48
46
  'application/json' => :json,
47
+ 'text/html' => :html,
48
+ 'text/plain' => :text,
49
49
  }.freeze
50
50
 
51
- DEFAULT_CONTENT_TYPE = 'text/plain'
51
+ DEFAULT_CONTENT_TYPE = 'application/json'
52
52
 
53
53
  def content_type(env)
54
54
  return DEFAULT_CONTENT_TYPE unless env.key?('HTTP_ACCEPT')
55
55
 
56
- accepted = env['HTTP_ACCEPT'].split(',').map { |m| Utils::HTTP::MediaRange.new(m) }.sort!.reverse!
56
+ accept_types = env['HTTP_ACCEPT'].split(',').map(&:strip)
57
57
 
58
- accepted.each_with_object(DEFAULT_CONTENT_TYPE) do |range, _default|
59
- match = FORMAT_MAP.keys.find { |type| range === type }
58
+ accepted = accept_types.map { |m| Utils::HTTP::MediaRange.new(m) }.sort!.reverse!
60
59
 
61
- return match if match
60
+ accepted.each do |range|
61
+ type_match = CONTENT_TYPE_TO_FORMAT.keys.find { |type| range === type }
62
+
63
+ return type_match if type_match
62
64
  end
65
+
66
+ DEFAULT_CONTENT_TYPE
63
67
  rescue Datadog::AppSec::Utils::HTTP::MediaRange::ParseError
64
68
  DEFAULT_CONTENT_TYPE
65
69
  end
@@ -549,6 +549,14 @@ module Datadog
549
549
  o.default { env_to_float(Core::Remote::Ext::ENV_POLL_INTERVAL_SECONDS, 5.0) }
550
550
  o.lazy
551
551
  end
552
+
553
+ # Declare service name to bind to remote configuration. Use when
554
+ # DD_SERVICE does not match the correct integration for which remote
555
+ # configuration applies.
556
+ #
557
+ # @default `nil`.
558
+ # @return [String,nil]
559
+ option :service
552
560
  end
553
561
 
554
562
  # TODO: Tracing should manage its own settings.
@@ -136,7 +136,7 @@ module Datadog
136
136
  runtime_id: Core::Environment::Identity.id,
137
137
  language: Core::Environment::Identity.lang,
138
138
  tracer_version: tracer_version_semver2,
139
- service: Datadog.configuration.service,
139
+ service: service_name,
140
140
  env: Datadog.configuration.env,
141
141
  tags: client_tracer_tags,
142
142
  }
@@ -167,6 +167,10 @@ module Datadog
167
167
  }
168
168
  end
169
169
 
170
+ def service_name
171
+ Datadog.configuration.remote.service || Datadog.configuration.service
172
+ end
173
+
170
174
  def tracer_version_semver2
171
175
  @tracer_version_semver2 ||= Core::Environment::Identity.tracer_version_semver2
172
176
  end
@@ -79,6 +79,8 @@ module Datadog
79
79
  no_signals_workaround_enabled: no_signals_workaround_enabled?(settings),
80
80
  )
81
81
  else
82
+ load_pprof_support
83
+
82
84
  recorder = build_profiler_old_recorder(settings)
83
85
  collector = build_profiler_oldstack_collector(settings, recorder, optional_tracer)
84
86
  end
@@ -255,6 +257,19 @@ module Datadog
255
257
  true
256
258
  end
257
259
  end
260
+
261
+ # The old profiler's pprof support conflicts with the ruby-cloud-profiler gem.
262
+ #
263
+ # This is not a problem for almost all customers, since we now default everyone to use the new CPU Profiling 2.0
264
+ # profiler. But the issue was still triggered, because currently we still _load_ both the old and new profiling
265
+ # code paths.
266
+ #
267
+ # To work around this issue, and because we plan on deleting the old profiler soon, rather than poking at the
268
+ # pprof support code, we only load the conflicting file when the old profiler is in use. This way customers using
269
+ # the new profiler will not be affected by the issue any longer.
270
+ private_class_method def self.load_pprof_support
271
+ require_relative 'pprof/pprof_pb'
272
+ end
258
273
  end
259
274
  end
260
275
  end
@@ -197,7 +197,8 @@ module Datadog
197
197
  require_relative 'profiling/profiler'
198
198
  require_relative 'profiling/native_extension'
199
199
  require_relative 'profiling/trace_identifiers/helper'
200
- require_relative 'profiling/pprof/pprof_pb'
200
+ # This file is loaded in Profiling::Component#load_pprof_support; see notes there for why
201
+ # require_relative 'profiling/pprof/pprof_pb'
201
202
  require_relative 'profiling/tag_builder'
202
203
  require_relative 'profiling/http_transport'
203
204
 
@@ -1,5 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative './base'
4
+ require_relative '../ext'
5
+
3
6
  module Datadog
4
7
  module Tracing
5
8
  module Contrib
@@ -1,5 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative './base'
4
+ require_relative '../ext'
5
+
3
6
  module Datadog
4
7
  module Tracing
5
8
  module Contrib
@@ -1,5 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative './base'
4
+ require_relative '../ext'
5
+
3
6
  module Datadog
4
7
  module Tracing
5
8
  module Contrib
@@ -1,5 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative './base'
4
+ require_relative '../ext'
5
+
3
6
  module Datadog
4
7
  module Tracing
5
8
  module Contrib
@@ -1,5 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative './base'
4
+ require_relative '../ext'
5
+
3
6
  module Datadog
4
7
  module Tracing
5
8
  module Contrib
@@ -1,5 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative './base'
4
+ require_relative '../ext'
5
+
3
6
  module Datadog
4
7
  module Tracing
5
8
  module Contrib
@@ -1,5 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative './base'
4
+ require_relative '../ext'
5
+
3
6
  module Datadog
4
7
  module Tracing
5
8
  module Contrib
@@ -1,3 +1,11 @@
1
+ require_relative './service/sqs'
2
+ require_relative './service/sns'
3
+ require_relative './service/dynamodb'
4
+ require_relative './service/kinesis'
5
+ require_relative './service/eventbridge'
6
+ require_relative './service/states'
7
+ require_relative './service/s3'
8
+
1
9
  module Datadog
2
10
  module Tracing
3
11
  module Contrib
@@ -4,7 +4,7 @@ module DDTrace
4
4
  module VERSION
5
5
  MAJOR = 1
6
6
  MINOR = 12
7
- PATCH = 0
7
+ PATCH = 1
8
8
  PRE = nil
9
9
  BUILD = nil
10
10
  # PRE and BUILD above are modified for dev gems during gem build GHA workflow
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.12.0
4
+ version: 1.12.1
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-06-02 00:00:00.000000000 Z
11
+ date: 2023-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack
@@ -495,7 +495,7 @@ files:
495
495
  - lib/datadog/tracing/contrib/aws/service/s3.rb
496
496
  - lib/datadog/tracing/contrib/aws/service/sns.rb
497
497
  - lib/datadog/tracing/contrib/aws/service/sqs.rb
498
- - lib/datadog/tracing/contrib/aws/service/stepfunctions.rb
498
+ - lib/datadog/tracing/contrib/aws/service/states.rb
499
499
  - lib/datadog/tracing/contrib/aws/services.rb
500
500
  - lib/datadog/tracing/contrib/concurrent_ruby/configuration/settings.rb
501
501
  - lib/datadog/tracing/contrib/concurrent_ruby/context_composite_executor_service.rb