datadog 2.8.0 → 2.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +36 -1
  3. data/ext/datadog_profiling_native_extension/clock_id.h +2 -2
  4. data/ext/datadog_profiling_native_extension/collectors_cpu_and_wall_time_worker.c +64 -54
  5. data/ext/datadog_profiling_native_extension/collectors_discrete_dynamic_sampler.c +1 -1
  6. data/ext/datadog_profiling_native_extension/collectors_discrete_dynamic_sampler.h +1 -1
  7. data/ext/datadog_profiling_native_extension/collectors_idle_sampling_helper.c +16 -16
  8. data/ext/datadog_profiling_native_extension/collectors_stack.c +7 -7
  9. data/ext/datadog_profiling_native_extension/collectors_thread_context.c +219 -122
  10. data/ext/datadog_profiling_native_extension/heap_recorder.h +1 -1
  11. data/ext/datadog_profiling_native_extension/http_transport.c +4 -4
  12. data/ext/datadog_profiling_native_extension/private_vm_api_access.c +3 -0
  13. data/ext/datadog_profiling_native_extension/private_vm_api_access.h +3 -1
  14. data/ext/datadog_profiling_native_extension/profiling.c +10 -8
  15. data/ext/datadog_profiling_native_extension/ruby_helpers.c +8 -8
  16. data/ext/datadog_profiling_native_extension/stack_recorder.c +54 -54
  17. data/ext/datadog_profiling_native_extension/stack_recorder.h +1 -1
  18. data/ext/datadog_profiling_native_extension/time_helpers.h +1 -1
  19. data/ext/datadog_profiling_native_extension/unsafe_api_calls_check.c +47 -0
  20. data/ext/datadog_profiling_native_extension/unsafe_api_calls_check.h +31 -0
  21. data/ext/libdatadog_api/crashtracker.c +3 -0
  22. data/lib/datadog/appsec/assets/waf_rules/recommended.json +355 -157
  23. data/lib/datadog/appsec/assets/waf_rules/strict.json +62 -32
  24. data/lib/datadog/appsec/context.rb +54 -0
  25. data/lib/datadog/appsec/contrib/active_record/instrumentation.rb +7 -7
  26. data/lib/datadog/appsec/contrib/devise/patcher/authenticatable_patch.rb +6 -6
  27. data/lib/datadog/appsec/contrib/devise/patcher/registration_controller_patch.rb +4 -4
  28. data/lib/datadog/appsec/contrib/graphql/gateway/watcher.rb +19 -28
  29. data/lib/datadog/appsec/contrib/graphql/reactive/multiplex.rb +5 -5
  30. data/lib/datadog/appsec/contrib/rack/gateway/response.rb +3 -3
  31. data/lib/datadog/appsec/contrib/rack/gateway/watcher.rb +64 -96
  32. data/lib/datadog/appsec/contrib/rack/reactive/request.rb +10 -10
  33. data/lib/datadog/appsec/contrib/rack/reactive/request_body.rb +5 -5
  34. data/lib/datadog/appsec/contrib/rack/reactive/response.rb +6 -6
  35. data/lib/datadog/appsec/contrib/rack/request_body_middleware.rb +10 -11
  36. data/lib/datadog/appsec/contrib/rack/request_middleware.rb +43 -49
  37. data/lib/datadog/appsec/contrib/rails/gateway/watcher.rb +21 -32
  38. data/lib/datadog/appsec/contrib/rails/patcher.rb +1 -1
  39. data/lib/datadog/appsec/contrib/rails/reactive/action.rb +6 -6
  40. data/lib/datadog/appsec/contrib/sinatra/gateway/watcher.rb +41 -63
  41. data/lib/datadog/appsec/contrib/sinatra/patcher.rb +2 -2
  42. data/lib/datadog/appsec/contrib/sinatra/reactive/routed.rb +5 -5
  43. data/lib/datadog/appsec/event.rb +6 -6
  44. data/lib/datadog/appsec/ext.rb +3 -1
  45. data/lib/datadog/appsec/monitor/gateway/watcher.rb +22 -32
  46. data/lib/datadog/appsec/monitor/reactive/set_user.rb +5 -5
  47. data/lib/datadog/appsec/processor/rule_loader.rb +0 -3
  48. data/lib/datadog/appsec.rb +3 -3
  49. data/lib/datadog/auto_instrument.rb +3 -0
  50. data/lib/datadog/core/configuration/agent_settings_resolver.rb +39 -11
  51. data/lib/datadog/core/configuration/components.rb +4 -2
  52. data/lib/datadog/core/configuration.rb +1 -1
  53. data/lib/datadog/{tracing → core}/contrib/rails/utils.rb +1 -3
  54. data/lib/datadog/core/crashtracking/component.rb +1 -3
  55. data/lib/datadog/core/telemetry/event.rb +87 -3
  56. data/lib/datadog/core/telemetry/logging.rb +2 -2
  57. data/lib/datadog/core/telemetry/metric.rb +22 -0
  58. data/lib/datadog/core/telemetry/worker.rb +33 -0
  59. data/lib/datadog/di/base.rb +115 -0
  60. data/lib/datadog/di/code_tracker.rb +7 -4
  61. data/lib/datadog/di/component.rb +17 -11
  62. data/lib/datadog/di/configuration/settings.rb +11 -1
  63. data/lib/datadog/di/contrib/railtie.rb +15 -0
  64. data/lib/datadog/di/contrib.rb +26 -0
  65. data/lib/datadog/di/error.rb +5 -0
  66. data/lib/datadog/di/instrumenter.rb +39 -18
  67. data/lib/datadog/di/{init.rb → preload.rb} +2 -4
  68. data/lib/datadog/di/probe_manager.rb +4 -4
  69. data/lib/datadog/di/probe_notification_builder.rb +16 -2
  70. data/lib/datadog/di/probe_notifier_worker.rb +5 -6
  71. data/lib/datadog/di/remote.rb +4 -4
  72. data/lib/datadog/di/transport.rb +2 -4
  73. data/lib/datadog/di.rb +5 -108
  74. data/lib/datadog/kit/appsec/events.rb +3 -3
  75. data/lib/datadog/kit/identity.rb +4 -4
  76. data/lib/datadog/profiling/component.rb +55 -53
  77. data/lib/datadog/profiling/http_transport.rb +1 -26
  78. data/lib/datadog/tracing/contrib/action_cable/integration.rb +5 -2
  79. data/lib/datadog/tracing/contrib/action_mailer/integration.rb +6 -2
  80. data/lib/datadog/tracing/contrib/action_pack/integration.rb +5 -2
  81. data/lib/datadog/tracing/contrib/action_view/integration.rb +5 -2
  82. data/lib/datadog/tracing/contrib/active_job/integration.rb +5 -2
  83. data/lib/datadog/tracing/contrib/active_record/integration.rb +6 -2
  84. data/lib/datadog/tracing/contrib/active_support/cache/events/cache.rb +3 -1
  85. data/lib/datadog/tracing/contrib/active_support/cache/instrumentation.rb +3 -1
  86. data/lib/datadog/tracing/contrib/active_support/configuration/settings.rb +10 -0
  87. data/lib/datadog/tracing/contrib/active_support/integration.rb +5 -2
  88. data/lib/datadog/tracing/contrib/auto_instrument.rb +2 -2
  89. data/lib/datadog/tracing/contrib/aws/integration.rb +3 -0
  90. data/lib/datadog/tracing/contrib/concurrent_ruby/integration.rb +3 -0
  91. data/lib/datadog/tracing/contrib/httprb/integration.rb +3 -0
  92. data/lib/datadog/tracing/contrib/kafka/integration.rb +3 -0
  93. data/lib/datadog/tracing/contrib/mongodb/integration.rb +3 -0
  94. data/lib/datadog/tracing/contrib/opensearch/integration.rb +3 -0
  95. data/lib/datadog/tracing/contrib/presto/integration.rb +3 -0
  96. data/lib/datadog/tracing/contrib/rack/integration.rb +2 -2
  97. data/lib/datadog/tracing/contrib/rails/framework.rb +2 -2
  98. data/lib/datadog/tracing/contrib/rails/patcher.rb +1 -1
  99. data/lib/datadog/tracing/contrib/rest_client/integration.rb +3 -0
  100. data/lib/datadog/tracing/span.rb +12 -4
  101. data/lib/datadog/tracing/span_event.rb +123 -3
  102. data/lib/datadog/tracing/span_operation.rb +6 -0
  103. data/lib/datadog/tracing/transport/serializable_trace.rb +24 -6
  104. data/lib/datadog/version.rb +1 -1
  105. metadata +19 -10
  106. data/lib/datadog/appsec/reactive/operation.rb +0 -68
  107. data/lib/datadog/appsec/scope.rb +0 -58
  108. data/lib/datadog/core/crashtracking/agent_base_url.rb +0 -21
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datadog
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.0
4
+ version: 2.9.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: 2024-12-10 00:00:00.000000000 Z
11
+ date: 2025-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack
@@ -31,6 +31,9 @@ dependencies:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '3.3'
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: 3.3.7
34
37
  type: :runtime
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -38,6 +41,9 @@ dependencies:
38
41
  - - "~>"
39
42
  - !ruby/object:Gem::Version
40
43
  version: '3.3'
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 3.3.7
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: libddwaf
43
49
  requirement: !ruby/object:Gem::Requirement
@@ -130,6 +136,8 @@ files:
130
136
  - ext/datadog_profiling_native_extension/stack_recorder.h
131
137
  - ext/datadog_profiling_native_extension/time_helpers.c
132
138
  - ext/datadog_profiling_native_extension/time_helpers.h
139
+ - ext/datadog_profiling_native_extension/unsafe_api_calls_check.c
140
+ - ext/datadog_profiling_native_extension/unsafe_api_calls_check.h
133
141
  - ext/libdatadog_api/crashtracker.c
134
142
  - ext/libdatadog_api/datadog_ruby_common.c
135
143
  - ext/libdatadog_api/datadog_ruby_common.h
@@ -151,6 +159,7 @@ files:
151
159
  - lib/datadog/appsec/component.rb
152
160
  - lib/datadog/appsec/configuration.rb
153
161
  - lib/datadog/appsec/configuration/settings.rb
162
+ - lib/datadog/appsec/context.rb
154
163
  - lib/datadog/appsec/contrib/active_record/instrumentation.rb
155
164
  - lib/datadog/appsec/contrib/active_record/integration.rb
156
165
  - lib/datadog/appsec/contrib/active_record/patcher.rb
@@ -217,12 +226,10 @@ files:
217
226
  - lib/datadog/appsec/rate_limiter.rb
218
227
  - lib/datadog/appsec/reactive/address_hash.rb
219
228
  - lib/datadog/appsec/reactive/engine.rb
220
- - lib/datadog/appsec/reactive/operation.rb
221
229
  - lib/datadog/appsec/reactive/subscriber.rb
222
230
  - lib/datadog/appsec/remote.rb
223
231
  - lib/datadog/appsec/response.rb
224
232
  - lib/datadog/appsec/sample_rate.rb
225
- - lib/datadog/appsec/scope.rb
226
233
  - lib/datadog/appsec/utils.rb
227
234
  - lib/datadog/appsec/utils/http.rb
228
235
  - lib/datadog/appsec/utils/http/media_range.rb
@@ -244,7 +251,7 @@ files:
244
251
  - lib/datadog/core/configuration/option_definition.rb
245
252
  - lib/datadog/core/configuration/options.rb
246
253
  - lib/datadog/core/configuration/settings.rb
247
- - lib/datadog/core/crashtracking/agent_base_url.rb
254
+ - lib/datadog/core/contrib/rails/utils.rb
248
255
  - lib/datadog/core/crashtracking/component.rb
249
256
  - lib/datadog/core/crashtracking/tag_builder.rb
250
257
  - lib/datadog/core/deprecations.rb
@@ -365,15 +372,18 @@ files:
365
372
  - lib/datadog/core/workers/queue.rb
366
373
  - lib/datadog/core/workers/runtime_metrics.rb
367
374
  - lib/datadog/di.rb
375
+ - lib/datadog/di/base.rb
368
376
  - lib/datadog/di/code_tracker.rb
369
377
  - lib/datadog/di/component.rb
370
378
  - lib/datadog/di/configuration.rb
371
379
  - lib/datadog/di/configuration/settings.rb
380
+ - lib/datadog/di/contrib.rb
372
381
  - lib/datadog/di/contrib/active_record.rb
382
+ - lib/datadog/di/contrib/railtie.rb
373
383
  - lib/datadog/di/error.rb
374
384
  - lib/datadog/di/extensions.rb
375
- - lib/datadog/di/init.rb
376
385
  - lib/datadog/di/instrumenter.rb
386
+ - lib/datadog/di/preload.rb
377
387
  - lib/datadog/di/probe.rb
378
388
  - lib/datadog/di/probe_builder.rb
379
389
  - lib/datadog/di/probe_manager.rb
@@ -726,7 +736,6 @@ files:
726
736
  - lib/datadog/tracing/contrib/rails/patcher.rb
727
737
  - lib/datadog/tracing/contrib/rails/railtie.rb
728
738
  - lib/datadog/tracing/contrib/rails/runner.rb
729
- - lib/datadog/tracing/contrib/rails/utils.rb
730
739
  - lib/datadog/tracing/contrib/rake/configuration/settings.rb
731
740
  - lib/datadog/tracing/contrib/rake/ext.rb
732
741
  - lib/datadog/tracing/contrib/rake/instrumentation.rb
@@ -902,8 +911,8 @@ licenses:
902
911
  - Apache-2.0
903
912
  metadata:
904
913
  allowed_push_host: https://rubygems.org
905
- changelog_uri: https://github.com/DataDog/dd-trace-rb/blob/v2.8.0/CHANGELOG.md
906
- source_code_uri: https://github.com/DataDog/dd-trace-rb/tree/v2.8.0
914
+ changelog_uri: https://github.com/DataDog/dd-trace-rb/blob/v2.9.0/CHANGELOG.md
915
+ source_code_uri: https://github.com/DataDog/dd-trace-rb/tree/v2.9.0
907
916
  post_install_message:
908
917
  rdoc_options: []
909
918
  require_paths:
@@ -922,7 +931,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
922
931
  - !ruby/object:Gem::Version
923
932
  version: 2.0.0
924
933
  requirements: []
925
- rubygems_version: 3.4.10
934
+ rubygems_version: 3.5.11
926
935
  signing_key:
927
936
  specification_version: 4
928
937
  summary: Datadog tracing code for your Ruby applications
@@ -1,68 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'engine'
4
-
5
- module Datadog
6
- module AppSec
7
- module Reactive
8
- # Reactive Engine nested operation tracking
9
- class Operation
10
- attr_reader :reactive,
11
- :parent,
12
- :name
13
-
14
- def initialize(name, parent = nil, reactive_engine = nil)
15
- Datadog.logger.debug { "operation: #{name} initialize" }
16
- @name = name
17
- @parent = parent
18
- @reactive = select_reactive_engine(reactive_engine, parent)
19
-
20
- # TODO: concurrent store
21
- # TODO: constant
22
- Thread.current[:datadog_security_active_operation] = self
23
-
24
- yield self if block_given?
25
- ensure
26
- finalize
27
- end
28
-
29
- # TODO: use structs instead of an arg splat
30
- def subscribe(*addresses, &block)
31
- reactive.subscribe(*addresses, &block)
32
- end
33
-
34
- def publish(address, data)
35
- reactive.publish(address, data)
36
- end
37
-
38
- def finalize
39
- Datadog.logger.debug { "operation: #{name} finalize" }
40
- Thread.current[:datadog_security_active_operation] = parent
41
- end
42
-
43
- private
44
-
45
- def select_reactive_engine(reactive, parent)
46
- return reactive if reactive
47
-
48
- return parent.reactive unless parent.nil?
49
-
50
- Reactive::Engine.new
51
- end
52
-
53
- class << self
54
- def active
55
- Thread.current[:datadog_security_active_operation]
56
- end
57
-
58
- private
59
-
60
- # For testing only.
61
- def reset!
62
- Thread.current[:datadog_security_active_operation] = nil
63
- end
64
- end
65
- end
66
- end
67
- end
68
- end
@@ -1,58 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Datadog
4
- module AppSec
5
- # Capture context essential to consistently call processor and report via traces
6
- class Scope
7
- attr_reader :trace, :service_entry_span, :processor_context
8
-
9
- def initialize(trace, service_entry_span, processor_context)
10
- @trace = trace
11
- @service_entry_span = service_entry_span
12
- @processor_context = processor_context
13
- end
14
-
15
- def finalize
16
- @processor_context.finalize
17
- end
18
-
19
- class << self
20
- def activate_scope(trace, service_entry_span, processor)
21
- raise ActiveScopeError, 'another scope is active, nested scopes are not supported' if active_scope
22
-
23
- context = processor.new_context
24
- self.active_scope = new(trace, service_entry_span, context)
25
- end
26
-
27
- def deactivate_scope
28
- raise InactiveScopeError, 'no scope is active, nested scopes are not supported' unless active_scope
29
-
30
- scope = active_scope
31
-
32
- reset_active_scope
33
-
34
- scope.finalize
35
- end
36
-
37
- def active_scope
38
- Thread.current[:datadog_appsec_active_scope]
39
- end
40
-
41
- private
42
-
43
- def active_scope=(scope)
44
- raise ArgumentError, 'not a Datadog::AppSec::Scope' unless scope.instance_of?(Scope)
45
-
46
- Thread.current[:datadog_appsec_active_scope] = scope
47
- end
48
-
49
- def reset_active_scope
50
- Thread.current[:datadog_appsec_active_scope] = nil
51
- end
52
- end
53
-
54
- class InactiveScopeError < StandardError; end
55
- class ActiveScopeError < StandardError; end
56
- end
57
- end
58
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../configuration/ext'
4
-
5
- module Datadog
6
- module Core
7
- module Crashtracking
8
- # This module provides a method to resolve the base URL of the agent
9
- module AgentBaseUrl
10
- def self.resolve(agent_settings)
11
- case agent_settings.adapter
12
- when Datadog::Core::Configuration::Ext::Agent::HTTP::ADAPTER
13
- "#{agent_settings.ssl ? 'https' : 'http'}://#{agent_settings.hostname}:#{agent_settings.port}/"
14
- when Datadog::Core::Configuration::Ext::Agent::UnixSocket::ADAPTER
15
- "unix://#{agent_settings.uds_path}"
16
- end
17
- end
18
- end
19
- end
20
- end
21
- end