datadog 2.2.0 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (196) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +87 -2
  3. data/ext/datadog_profiling_loader/datadog_profiling_loader.c +9 -1
  4. data/ext/datadog_profiling_loader/extconf.rb +14 -26
  5. data/ext/datadog_profiling_native_extension/clock_id.h +1 -0
  6. data/ext/datadog_profiling_native_extension/clock_id_from_pthread.c +1 -2
  7. data/ext/datadog_profiling_native_extension/clock_id_noop.c +1 -2
  8. data/ext/datadog_profiling_native_extension/collectors_cpu_and_wall_time_worker.c +257 -69
  9. data/ext/datadog_profiling_native_extension/collectors_discrete_dynamic_sampler.c +53 -28
  10. data/ext/datadog_profiling_native_extension/collectors_discrete_dynamic_sampler.h +34 -4
  11. data/ext/datadog_profiling_native_extension/collectors_idle_sampling_helper.c +4 -0
  12. data/ext/datadog_profiling_native_extension/collectors_stack.c +136 -81
  13. data/ext/datadog_profiling_native_extension/collectors_stack.h +2 -2
  14. data/ext/datadog_profiling_native_extension/collectors_thread_context.c +661 -48
  15. data/ext/datadog_profiling_native_extension/collectors_thread_context.h +10 -1
  16. data/ext/datadog_profiling_native_extension/datadog_ruby_common.c +83 -0
  17. data/ext/datadog_profiling_native_extension/datadog_ruby_common.h +53 -0
  18. data/ext/datadog_profiling_native_extension/extconf.rb +91 -69
  19. data/ext/datadog_profiling_native_extension/gvl_profiling_helper.c +50 -0
  20. data/ext/datadog_profiling_native_extension/gvl_profiling_helper.h +75 -0
  21. data/ext/datadog_profiling_native_extension/heap_recorder.c +54 -12
  22. data/ext/datadog_profiling_native_extension/heap_recorder.h +3 -1
  23. data/ext/datadog_profiling_native_extension/helpers.h +6 -17
  24. data/ext/datadog_profiling_native_extension/http_transport.c +41 -9
  25. data/ext/datadog_profiling_native_extension/libdatadog_helpers.c +0 -86
  26. data/ext/datadog_profiling_native_extension/libdatadog_helpers.h +2 -23
  27. data/ext/datadog_profiling_native_extension/native_extension_helpers.rb +61 -172
  28. data/ext/datadog_profiling_native_extension/private_vm_api_access.c +116 -139
  29. data/ext/datadog_profiling_native_extension/private_vm_api_access.h +20 -11
  30. data/ext/datadog_profiling_native_extension/profiling.c +1 -3
  31. data/ext/datadog_profiling_native_extension/ruby_helpers.c +0 -33
  32. data/ext/datadog_profiling_native_extension/ruby_helpers.h +1 -26
  33. data/ext/datadog_profiling_native_extension/setup_signal_handler.h +1 -0
  34. data/ext/datadog_profiling_native_extension/stack_recorder.c +14 -2
  35. data/ext/datadog_profiling_native_extension/stack_recorder.h +2 -0
  36. data/ext/datadog_profiling_native_extension/time_helpers.c +0 -15
  37. data/ext/datadog_profiling_native_extension/time_helpers.h +36 -6
  38. data/ext/{datadog_profiling_native_extension → libdatadog_api}/crashtracker.c +37 -22
  39. data/ext/libdatadog_api/datadog_ruby_common.c +83 -0
  40. data/ext/libdatadog_api/datadog_ruby_common.h +53 -0
  41. data/ext/libdatadog_api/extconf.rb +108 -0
  42. data/ext/libdatadog_api/macos_development.md +26 -0
  43. data/ext/libdatadog_extconf_helpers.rb +130 -0
  44. data/lib/datadog/appsec/assets/waf_rules/recommended.json +2184 -108
  45. data/lib/datadog/appsec/assets/waf_rules/strict.json +1430 -2
  46. data/lib/datadog/appsec/component.rb +29 -8
  47. data/lib/datadog/appsec/configuration/settings.rb +2 -2
  48. data/lib/datadog/appsec/contrib/devise/patcher/authenticatable_patch.rb +1 -0
  49. data/lib/datadog/appsec/contrib/devise/patcher/rememberable_patch.rb +21 -0
  50. data/lib/datadog/appsec/contrib/devise/patcher.rb +12 -2
  51. data/lib/datadog/appsec/contrib/graphql/appsec_trace.rb +35 -0
  52. data/lib/datadog/appsec/contrib/graphql/gateway/multiplex.rb +109 -0
  53. data/lib/datadog/appsec/contrib/graphql/gateway/watcher.rb +71 -0
  54. data/lib/datadog/appsec/contrib/graphql/integration.rb +54 -0
  55. data/lib/datadog/appsec/contrib/graphql/patcher.rb +37 -0
  56. data/lib/datadog/appsec/contrib/graphql/reactive/multiplex.rb +59 -0
  57. data/lib/datadog/appsec/contrib/rack/gateway/request.rb +3 -6
  58. data/lib/datadog/appsec/event.rb +1 -1
  59. data/lib/datadog/appsec/processor/actions.rb +1 -1
  60. data/lib/datadog/appsec/processor/rule_loader.rb +3 -1
  61. data/lib/datadog/appsec/processor/rule_merger.rb +33 -15
  62. data/lib/datadog/appsec/processor.rb +36 -37
  63. data/lib/datadog/appsec/rate_limiter.rb +25 -40
  64. data/lib/datadog/appsec/remote.rb +7 -3
  65. data/lib/datadog/appsec/response.rb +15 -1
  66. data/lib/datadog/appsec.rb +3 -2
  67. data/lib/datadog/core/configuration/components.rb +18 -15
  68. data/lib/datadog/core/configuration/settings.rb +135 -9
  69. data/lib/datadog/core/crashtracking/agent_base_url.rb +21 -0
  70. data/lib/datadog/core/crashtracking/component.rb +111 -0
  71. data/lib/datadog/core/crashtracking/tag_builder.rb +39 -0
  72. data/lib/datadog/core/diagnostics/environment_logger.rb +8 -11
  73. data/lib/datadog/core/environment/execution.rb +5 -5
  74. data/lib/datadog/core/metrics/client.rb +7 -0
  75. data/lib/datadog/core/rate_limiter.rb +183 -0
  76. data/lib/datadog/core/remote/client/capabilities.rb +4 -3
  77. data/lib/datadog/core/remote/component.rb +4 -2
  78. data/lib/datadog/core/remote/negotiation.rb +4 -4
  79. data/lib/datadog/core/remote/tie.rb +2 -0
  80. data/lib/datadog/core/runtime/metrics.rb +1 -1
  81. data/lib/datadog/core/telemetry/component.rb +51 -2
  82. data/lib/datadog/core/telemetry/emitter.rb +9 -11
  83. data/lib/datadog/core/telemetry/event.rb +37 -1
  84. data/lib/datadog/core/telemetry/ext.rb +1 -0
  85. data/lib/datadog/core/telemetry/http/adapters/net.rb +10 -12
  86. data/lib/datadog/core/telemetry/http/ext.rb +3 -0
  87. data/lib/datadog/core/telemetry/http/transport.rb +38 -9
  88. data/lib/datadog/core/telemetry/logger.rb +51 -0
  89. data/lib/datadog/core/telemetry/logging.rb +71 -0
  90. data/lib/datadog/core/telemetry/request.rb +13 -1
  91. data/lib/datadog/core/utils/at_fork_monkey_patch.rb +102 -0
  92. data/lib/datadog/core/utils/time.rb +12 -0
  93. data/lib/datadog/di/code_tracker.rb +168 -0
  94. data/lib/datadog/di/configuration/settings.rb +163 -0
  95. data/lib/datadog/di/configuration.rb +11 -0
  96. data/lib/datadog/di/error.rb +31 -0
  97. data/lib/datadog/di/extensions.rb +16 -0
  98. data/lib/datadog/di/probe.rb +133 -0
  99. data/lib/datadog/di/probe_builder.rb +41 -0
  100. data/lib/datadog/di/redactor.rb +188 -0
  101. data/lib/datadog/di/serializer.rb +193 -0
  102. data/lib/datadog/di.rb +14 -0
  103. data/lib/datadog/kit/appsec/events.rb +2 -4
  104. data/lib/datadog/opentelemetry/sdk/propagator.rb +2 -0
  105. data/lib/datadog/opentelemetry/sdk/span_processor.rb +10 -0
  106. data/lib/datadog/opentelemetry/sdk/trace/span.rb +23 -0
  107. data/lib/datadog/profiling/collectors/code_provenance.rb +7 -7
  108. data/lib/datadog/profiling/collectors/cpu_and_wall_time_worker.rb +28 -26
  109. data/lib/datadog/profiling/collectors/idle_sampling_helper.rb +11 -13
  110. data/lib/datadog/profiling/collectors/info.rb +15 -6
  111. data/lib/datadog/profiling/collectors/thread_context.rb +30 -2
  112. data/lib/datadog/profiling/component.rb +89 -95
  113. data/lib/datadog/profiling/exporter.rb +3 -3
  114. data/lib/datadog/profiling/ext/dir_monkey_patches.rb +3 -3
  115. data/lib/datadog/profiling/ext.rb +21 -21
  116. data/lib/datadog/profiling/flush.rb +1 -1
  117. data/lib/datadog/profiling/http_transport.rb +14 -7
  118. data/lib/datadog/profiling/load_native_extension.rb +5 -5
  119. data/lib/datadog/profiling/preload.rb +1 -1
  120. data/lib/datadog/profiling/profiler.rb +5 -8
  121. data/lib/datadog/profiling/scheduler.rb +33 -25
  122. data/lib/datadog/profiling/stack_recorder.rb +3 -0
  123. data/lib/datadog/profiling/tag_builder.rb +2 -2
  124. data/lib/datadog/profiling/tasks/exec.rb +5 -5
  125. data/lib/datadog/profiling/tasks/setup.rb +16 -35
  126. data/lib/datadog/profiling.rb +4 -5
  127. data/lib/datadog/single_step_instrument.rb +12 -0
  128. data/lib/datadog/tracing/contrib/action_cable/instrumentation.rb +8 -12
  129. data/lib/datadog/tracing/contrib/action_pack/action_controller/instrumentation.rb +5 -0
  130. data/lib/datadog/tracing/contrib/action_pack/action_dispatch/instrumentation.rb +78 -0
  131. data/lib/datadog/tracing/contrib/action_pack/action_dispatch/patcher.rb +33 -0
  132. data/lib/datadog/tracing/contrib/action_pack/patcher.rb +2 -0
  133. data/lib/datadog/tracing/contrib/active_record/configuration/resolver.rb +4 -0
  134. data/lib/datadog/tracing/contrib/active_record/events/instantiation.rb +3 -1
  135. data/lib/datadog/tracing/contrib/active_record/events/sql.rb +4 -1
  136. data/lib/datadog/tracing/contrib/active_support/cache/events/cache.rb +5 -1
  137. data/lib/datadog/tracing/contrib/aws/instrumentation.rb +5 -0
  138. data/lib/datadog/tracing/contrib/elasticsearch/patcher.rb +6 -1
  139. data/lib/datadog/tracing/contrib/ext.rb +14 -0
  140. data/lib/datadog/tracing/contrib/faraday/middleware.rb +9 -0
  141. data/lib/datadog/tracing/contrib/grape/endpoint.rb +19 -0
  142. data/lib/datadog/tracing/contrib/graphql/patcher.rb +9 -12
  143. data/lib/datadog/tracing/contrib/graphql/trace_patcher.rb +3 -3
  144. data/lib/datadog/tracing/contrib/graphql/tracing_patcher.rb +3 -3
  145. data/lib/datadog/tracing/contrib/graphql/unified_trace.rb +14 -10
  146. data/lib/datadog/tracing/contrib/graphql/unified_trace_patcher.rb +10 -4
  147. data/lib/datadog/tracing/contrib/http/instrumentation.rb +18 -15
  148. data/lib/datadog/tracing/contrib/httpclient/instrumentation.rb +6 -5
  149. data/lib/datadog/tracing/contrib/httpclient/patcher.rb +1 -14
  150. data/lib/datadog/tracing/contrib/httprb/instrumentation.rb +5 -0
  151. data/lib/datadog/tracing/contrib/httprb/patcher.rb +1 -14
  152. data/lib/datadog/tracing/contrib/lograge/patcher.rb +15 -0
  153. data/lib/datadog/tracing/contrib/mongodb/subscribers.rb +2 -0
  154. data/lib/datadog/tracing/contrib/mysql2/configuration/settings.rb +5 -0
  155. data/lib/datadog/tracing/contrib/mysql2/instrumentation.rb +17 -13
  156. data/lib/datadog/tracing/contrib/opensearch/patcher.rb +13 -6
  157. data/lib/datadog/tracing/contrib/patcher.rb +2 -1
  158. data/lib/datadog/tracing/contrib/pg/configuration/settings.rb +5 -0
  159. data/lib/datadog/tracing/contrib/pg/instrumentation.rb +4 -1
  160. data/lib/datadog/tracing/contrib/presto/patcher.rb +1 -13
  161. data/lib/datadog/tracing/contrib/propagation/sql_comment/ext.rb +28 -0
  162. data/lib/datadog/tracing/contrib/propagation/sql_comment/mode.rb +5 -1
  163. data/lib/datadog/tracing/contrib/propagation/sql_comment.rb +22 -10
  164. data/lib/datadog/tracing/contrib/rack/middlewares.rb +27 -0
  165. data/lib/datadog/tracing/contrib/redis/tags.rb +4 -0
  166. data/lib/datadog/tracing/contrib/sinatra/tracer.rb +4 -0
  167. data/lib/datadog/tracing/contrib/stripe/request.rb +3 -2
  168. data/lib/datadog/tracing/contrib/trilogy/configuration/settings.rb +5 -0
  169. data/lib/datadog/tracing/contrib/trilogy/instrumentation.rb +4 -1
  170. data/lib/datadog/tracing/diagnostics/environment_logger.rb +14 -16
  171. data/lib/datadog/tracing/distributed/propagation.rb +7 -0
  172. data/lib/datadog/tracing/metadata/errors.rb +9 -1
  173. data/lib/datadog/tracing/metadata/ext.rb +6 -0
  174. data/lib/datadog/tracing/pipeline/span_filter.rb +2 -2
  175. data/lib/datadog/tracing/remote.rb +5 -2
  176. data/lib/datadog/tracing/sampling/matcher.rb +6 -1
  177. data/lib/datadog/tracing/sampling/rate_sampler.rb +1 -1
  178. data/lib/datadog/tracing/sampling/rule.rb +2 -0
  179. data/lib/datadog/tracing/sampling/rule_sampler.rb +9 -5
  180. data/lib/datadog/tracing/sampling/span/ext.rb +1 -1
  181. data/lib/datadog/tracing/sampling/span/rule.rb +2 -2
  182. data/lib/datadog/tracing/span.rb +9 -2
  183. data/lib/datadog/tracing/span_event.rb +41 -0
  184. data/lib/datadog/tracing/span_operation.rb +6 -2
  185. data/lib/datadog/tracing/trace_operation.rb +26 -2
  186. data/lib/datadog/tracing/tracer.rb +14 -12
  187. data/lib/datadog/tracing/transport/http/client.rb +1 -0
  188. data/lib/datadog/tracing/transport/io/client.rb +1 -0
  189. data/lib/datadog/tracing/transport/serializable_trace.rb +3 -0
  190. data/lib/datadog/tracing/workers/trace_writer.rb +1 -1
  191. data/lib/datadog/tracing/workers.rb +1 -1
  192. data/lib/datadog/version.rb +1 -1
  193. metadata +46 -11
  194. data/lib/datadog/profiling/crashtracker.rb +0 -91
  195. data/lib/datadog/profiling/ext/forking.rb +0 -98
  196. data/lib/datadog/tracing/sampling/rate_limiter.rb +0 -185
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 895fe8f9fdd8391d5c6c86e8d39d0a8e241c85bbce42b35c9744e1f94095853f
4
- data.tar.gz: d5a6e88ec35816de59a5d080f66896a4c85656216d2853b46bb1268dfa64df35
3
+ metadata.gz: ba1dc00d9afe70c54ea0918673e832793bb7c7a629618dc3d36e066fd121ea56
4
+ data.tar.gz: 9818bf0ba8dbd989451b7b0492efe848a9cdf97239acac3637aaa9d17937b541
5
5
  SHA512:
6
- metadata.gz: fef3c78c7835c47507a1f09d87c2ee84ddcc97303f9b9d7c6b4d601381ac62a47133f3450ddbc888cf54c56353ef4417ff337009a1e60d2ae239fb19093d721b
7
- data.tar.gz: 061154162ab97a6e1cdc87f53c18d98fd0eea75b6cb7e71fd1e4e5c4a536ff7722c4e1202258760113ce5a7f0ce3838622e700858103fa97dddc33d0322275cc
6
+ metadata.gz: 419ac80497f45159d199d2b9d3b16c70c46903d65d828c6e5ab52029758c9b38e11b243e112d52e3e9d45f05d5e1acf814bcb3f7582496f1e5be120c13f0f685
7
+ data.tar.gz: ce8f36e974b194fbdedd40fdf634e49115c0bd6befb350092dfc4cb94185a173a7d3325b6adc9cf50e060b05a4968ca7858a52082748a4979090a7eb32aa96ba
data/CHANGELOG.md CHANGED
@@ -2,6 +2,57 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [2.4.0] - 2024-10-11
6
+
7
+ ### Added
8
+
9
+ * Core: Allow changing sampling rate for customer defined tags and resources ([#3956][])
10
+ * Profiling: Add GVL profiling for Ruby 3.2+ as a preview feature ([#3929][])
11
+ * Profiling: Otel: Add preview support for correlating profiling with otel ruby gem ([#3984][])
12
+ * Tracing: AppSec: Add http.route tag to Rails, Grape, and Sinatra integrations ([#3849][])
13
+ * Tracing: Add capabilities to remote config: tracing sample rate, tracing logs injection, tracing http header tags ([#3888][])
14
+ * AppSec: Add a force disable of AppSec feature when using Ruby >= 3.3 with old FFI gem version ([#3969][])
15
+
16
+ ### Changed
17
+
18
+ * AppSec: Improve PII compliance ([#3857][])
19
+ * AppSec: Integrations: Improve accuracy of login tracking for Devise ([#3867][])
20
+ * Crashtracking feature is now disabled by default ([#3970][])
21
+
22
+ ### Fixed
23
+
24
+ * AppSec: Integrations: Fix GraphQL instrumentation for query fragments ([#3887][])
25
+ * Bug: Profiling: Fix (small) memory leak in profiler when forking ([#3852][])
26
+ * Tracing: Integrations: Fix GraphQL integration reconfiguration ([#3859][])
27
+
28
+ ## [2.3.0] - 2024-08-22
29
+
30
+ ### Added
31
+
32
+ * Core: Support agentless telemetry ([#3779][])
33
+ * Tracing: Add support for span events ([#3776][])
34
+ * Tracing: Add tags to enable inferred service dependencies for databases ([#3789][])
35
+ * Tracing: Emit log message and instructions for incompatible Lograge setup ([#3812][], [#3839][])
36
+ * Tracing: Add `append_comment` option to append SQL comment propagation for `mysql`, `pg` and `trilogy` ([#3809][])
37
+ * AppSec: Add threat detection and protection for `graphql` ([#3769][], [#3814][])
38
+
39
+ ### Changed
40
+
41
+ * Core: Enable crashtracking by default ([#3826][])
42
+ * Profiling: Reduce allocation overhead ([#3805][], [#3797][])
43
+ * Profiling: Speed up stack sampling ([#3837][])
44
+ * Profiling: Upgrade to libdatadog 11 ([#3799][])
45
+ * Profiling: Disable allocation counting feature by default ([#3798][])
46
+ * Profiling: Reduce the maximum biased result for allocation samples ([#3793][])
47
+ * Tracing: Reduce noisy integration logs ([#3785][])
48
+
49
+ ### Fixed
50
+
51
+ * Tracing: Fix `require` issue for `graphql` ([#3813][])
52
+ * AppSec: Fix an error when parsing http headers with integer value ([#3790][])
53
+ * AppSec: Fix an error when tracking login failure without `user_id` ([#3841][])
54
+ * Fix a syntax error for Ruby < 2.4 during single step instrumentation ([#3795][])
55
+
5
56
  ## [2.2.0] - 2024-07-11
6
57
 
7
58
  ### Added
@@ -2934,7 +2985,9 @@ Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.3.1
2934
2985
  Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
2935
2986
 
2936
2987
 
2937
- [Unreleased]: https://github.com/DataDog/dd-trace-rb/compare/v2.2.0...master
2988
+ [Unreleased]: https://github.com/DataDog/dd-trace-rb/compare/v2.4.0...master
2989
+ [2.4.0]: https://github.com/DataDog/dd-trace-rb/compare/v2.3.0...v2.4.0
2990
+ [2.3.0]: https://github.com/DataDog/dd-trace-rb/compare/v2.2.0...v2.3.0
2938
2991
  [2.2.0]: https://github.com/DataDog/dd-trace-rb/compare/v2.1.0...v2.2.0
2939
2992
  [2.1.0]: https://github.com/DataDog/dd-trace-rb/compare/v2.0.0...v2.1.0
2940
2993
  [2.0.0]: https://github.com/DataDog/dd-trace-rb/compare/v2.0.0.rc1...v2.0.0
@@ -4331,9 +4384,41 @@ Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
4331
4384
  [#3753]: https://github.com/DataDog/dd-trace-rb/issues/3753
4332
4385
  [#3757]: https://github.com/DataDog/dd-trace-rb/issues/3757
4333
4386
  [#3759]: https://github.com/DataDog/dd-trace-rb/issues/3759
4387
+ [#3769]: https://github.com/DataDog/dd-trace-rb/issues/3769
4334
4388
  [#3770]: https://github.com/DataDog/dd-trace-rb/issues/3770
4335
4389
  [#3772]: https://github.com/DataDog/dd-trace-rb/issues/3772
4336
4390
  [#3774]: https://github.com/DataDog/dd-trace-rb/issues/3774
4391
+ [#3776]: https://github.com/DataDog/dd-trace-rb/issues/3776
4392
+ [#3779]: https://github.com/DataDog/dd-trace-rb/issues/3779
4393
+ [#3785]: https://github.com/DataDog/dd-trace-rb/issues/3785
4394
+ [#3789]: https://github.com/DataDog/dd-trace-rb/issues/3789
4395
+ [#3790]: https://github.com/DataDog/dd-trace-rb/issues/3790
4396
+ [#3793]: https://github.com/DataDog/dd-trace-rb/issues/3793
4397
+ [#3795]: https://github.com/DataDog/dd-trace-rb/issues/3795
4398
+ [#3797]: https://github.com/DataDog/dd-trace-rb/issues/3797
4399
+ [#3798]: https://github.com/DataDog/dd-trace-rb/issues/3798
4400
+ [#3799]: https://github.com/DataDog/dd-trace-rb/issues/3799
4401
+ [#3805]: https://github.com/DataDog/dd-trace-rb/issues/3805
4402
+ [#3809]: https://github.com/DataDog/dd-trace-rb/issues/3809
4403
+ [#3812]: https://github.com/DataDog/dd-trace-rb/issues/3812
4404
+ [#3813]: https://github.com/DataDog/dd-trace-rb/issues/3813
4405
+ [#3814]: https://github.com/DataDog/dd-trace-rb/issues/3814
4406
+ [#3826]: https://github.com/DataDog/dd-trace-rb/issues/3826
4407
+ [#3837]: https://github.com/DataDog/dd-trace-rb/issues/3837
4408
+ [#3839]: https://github.com/DataDog/dd-trace-rb/issues/3839
4409
+ [#3841]: https://github.com/DataDog/dd-trace-rb/issues/3841
4410
+ [#3849]: https://github.com/DataDog/dd-trace-rb/issues/3849
4411
+ [#3852]: https://github.com/DataDog/dd-trace-rb/issues/3852
4412
+ [#3857]: https://github.com/DataDog/dd-trace-rb/issues/3857
4413
+ [#3859]: https://github.com/DataDog/dd-trace-rb/issues/3859
4414
+ [#3867]: https://github.com/DataDog/dd-trace-rb/issues/3867
4415
+ [#3887]: https://github.com/DataDog/dd-trace-rb/issues/3887
4416
+ [#3888]: https://github.com/DataDog/dd-trace-rb/issues/3888
4417
+ [#3929]: https://github.com/DataDog/dd-trace-rb/issues/3929
4418
+ [#3956]: https://github.com/DataDog/dd-trace-rb/issues/3956
4419
+ [#3969]: https://github.com/DataDog/dd-trace-rb/issues/3969
4420
+ [#3970]: https://github.com/DataDog/dd-trace-rb/issues/3970
4421
+ [#3984]: https://github.com/DataDog/dd-trace-rb/issues/3984
4337
4422
  [@AdrianLC]: https://github.com/AdrianLC
4338
4423
  [@Azure7111]: https://github.com/Azure7111
4339
4424
  [@BabyGroot]: https://github.com/BabyGroot
@@ -4485,4 +4570,4 @@ Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
4485
4570
  [@y-yagi]: https://github.com/y-yagi
4486
4571
  [@yujideveloper]: https://github.com/yujideveloper
4487
4572
  [@yukimurasawa]: https://github.com/yukimurasawa
4488
- [@zachmccormick]: https://github.com/zachmccormick
4573
+ [@zachmccormick]: https://github.com/zachmccormick
@@ -65,7 +65,15 @@ static VALUE _native_load(DDTRACE_UNUSED VALUE self, VALUE ruby_path, VALUE ruby
65
65
  char *path = StringValueCStr(ruby_path);
66
66
  char *init_name = StringValueCStr(ruby_init_name);
67
67
 
68
- void *handle = dlopen(path, RTLD_LAZY | RTLD_LOCAL | RTLD_DEEPBIND);
68
+ int dlopen_flags = RTLD_LAZY | RTLD_LOCAL | RTLD_DEEPBIND;
69
+
70
+ #if defined(__has_feature)
71
+ #if __has_feature(address_sanitizer)
72
+ dlopen_flags &= ~RTLD_DEEPBIND; // Not supported by ASAN
73
+ #endif
74
+ #endif
75
+
76
+ void *handle = dlopen(path, dlopen_flags);
69
77
 
70
78
  VALUE failure_details = Qnil;
71
79
 
@@ -1,49 +1,38 @@
1
1
  # rubocop:disable Style/StderrPuts
2
- # rubocop:disable Style/GlobalVars
3
2
 
4
- if RUBY_ENGINE != 'ruby' || Gem.win_platform?
3
+ if RUBY_ENGINE != "ruby" || Gem.win_platform?
5
4
  $stderr.puts(
6
- 'WARN: Skipping build of Datadog profiling loader. See Datadog profiling native extension note for details.'
5
+ "WARN: Skipping build of Datadog profiling loader. See Datadog profiling native extension note for details."
7
6
  )
8
7
 
9
- File.write('Makefile', 'all install clean: # dummy makefile that does nothing')
8
+ File.write("Makefile", "all install clean: # dummy makefile that does nothing")
10
9
  exit
11
10
  end
12
11
 
13
- require 'mkmf'
14
-
15
- # mkmf on modern Rubies actually has an append_cflags that does something similar
16
- # (see https://github.com/ruby/ruby/pull/5760), but as usual we need a bit more boilerplate to deal with legacy Rubies
17
- def add_compiler_flag(flag)
18
- if try_cflags(flag)
19
- $CFLAGS << ' ' << flag
20
- else
21
- $stderr.puts("WARNING: '#{flag}' not accepted by compiler, skipping it")
22
- end
23
- end
12
+ require "mkmf"
24
13
 
25
14
  # Because we can't control what compiler versions our customers use, shipping with -Werror by default is a no-go.
26
15
  # But we can enable it in CI, so that we quickly spot any new warnings that just got introduced.
27
- add_compiler_flag '-Werror' if ENV['DATADOG_GEM_CI'] == 'true'
16
+ append_cflags "-Werror" if ENV["DATADOG_GEM_CI"] == "true"
28
17
 
29
18
  # Older gcc releases may not default to C99 and we need to ask for this. This is also used:
30
19
  # * by upstream Ruby -- search for gnu99 in the codebase
31
20
  # * by msgpack, another datadog gem dependency
32
21
  # (https://github.com/msgpack/msgpack-ruby/blob/18ce08f6d612fe973843c366ac9a0b74c4e50599/ext/msgpack/extconf.rb#L8)
33
- add_compiler_flag '-std=gnu99'
22
+ append_cflags "-std=gnu99"
34
23
 
35
24
  # Gets really noisy when we include the MJIT header, let's omit it (TODO: Use #pragma GCC diagnostic instead?)
36
- add_compiler_flag '-Wno-unused-function'
25
+ append_cflags "-Wno-unused-function"
37
26
 
38
27
  # Allow defining variables at any point in a function
39
- add_compiler_flag '-Wno-declaration-after-statement'
28
+ append_cflags "-Wno-declaration-after-statement"
40
29
 
41
30
  # If we forget to include a Ruby header, the function call may still appear to work, but then
42
31
  # cause a segfault later. Let's ensure that never happens.
43
- add_compiler_flag '-Werror-implicit-function-declaration'
32
+ append_cflags "-Werror-implicit-function-declaration"
44
33
 
45
34
  # Warn on unused parameters to functions. Use `DDTRACE_UNUSED` to mark things as known-to-not-be-used.
46
- add_compiler_flag '-Wunused-parameter'
35
+ append_cflags "-Wunused-parameter"
47
36
 
48
37
  # The native extension is not intended to expose any symbols/functions for other native libraries to use;
49
38
  # the sole exception being `Init_datadog_profiling_loader` which needs to be visible for Ruby to call it when
@@ -51,14 +40,14 @@ add_compiler_flag '-Wunused-parameter'
51
40
  #
52
41
  # By setting this compiler flag, we tell it to assume that everything is private unless explicitly stated.
53
42
  # For more details see https://gcc.gnu.org/wiki/Visibility
54
- add_compiler_flag '-fvisibility=hidden'
43
+ append_cflags "-fvisibility=hidden"
55
44
 
56
45
  # Avoid legacy C definitions
57
- add_compiler_flag '-Wold-style-definition'
46
+ append_cflags "-Wold-style-definition"
58
47
 
59
48
  # Enable all other compiler warnings
60
- add_compiler_flag '-Wall'
61
- add_compiler_flag '-Wextra'
49
+ append_cflags "-Wall"
50
+ append_cflags "-Wextra"
62
51
 
63
52
  # Tag the native extension library with the Ruby version and Ruby platform.
64
53
  # This makes it easier for development (avoids "oops I forgot to rebuild when I switched my Ruby") and ensures that
@@ -68,5 +57,4 @@ EXTENSION_NAME = "datadog_profiling_loader.#{RUBY_VERSION}_#{RUBY_PLATFORM}".fre
68
57
 
69
58
  create_makefile(EXTENSION_NAME)
70
59
 
71
- # rubocop:enable Style/GlobalVars
72
60
  # rubocop:enable Style/StderrPuts
@@ -2,6 +2,7 @@
2
2
 
3
3
  #include <stdbool.h>
4
4
  #include <time.h>
5
+ #include <ruby.h>
5
6
 
6
7
  // Contains the operating-system specific identifier needed to fetch CPU-time, and a flag to indicate if we failed to fetch it
7
8
  typedef struct thread_cpu_time_id {
@@ -7,11 +7,10 @@
7
7
  #include <pthread.h>
8
8
  #include <time.h>
9
9
  #include <errno.h>
10
- #include <ruby.h>
11
10
 
11
+ #include "clock_id.h"
12
12
  #include "helpers.h"
13
13
  #include "private_vm_api_access.h"
14
- #include "clock_id.h"
15
14
  #include "time_helpers.h"
16
15
 
17
16
  // Validate that our home-cooked pthread_id_for() matches pthread_self() for the current thread
@@ -4,10 +4,9 @@
4
4
  // is not available.
5
5
  #ifndef HAVE_PTHREAD_GETCPUCLOCKID
6
6
 
7
- #include <ruby.h>
8
-
9
7
  #include "clock_id.h"
10
8
  #include "helpers.h"
9
+ #include "datadog_ruby_common.h"
11
10
 
12
11
  void self_test_clock_id(void) { } // Nothing to check
13
12