datadog 2.0.0.beta1 → 2.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +181 -1
- data/ext/datadog_profiling_native_extension/NativeExtensionDesign.md +1 -1
- data/ext/datadog_profiling_native_extension/collectors_cpu_and_wall_time_worker.c +40 -32
- data/ext/datadog_profiling_native_extension/collectors_thread_context.c +23 -12
- data/ext/datadog_profiling_native_extension/crashtracker.c +108 -0
- data/ext/datadog_profiling_native_extension/extconf.rb +9 -23
- data/ext/datadog_profiling_native_extension/heap_recorder.c +81 -4
- data/ext/datadog_profiling_native_extension/heap_recorder.h +12 -1
- data/ext/datadog_profiling_native_extension/http_transport.c +1 -94
- data/ext/datadog_profiling_native_extension/libdatadog_helpers.c +86 -0
- data/ext/datadog_profiling_native_extension/libdatadog_helpers.h +4 -0
- data/ext/datadog_profiling_native_extension/native_extension_helpers.rb +2 -12
- data/ext/datadog_profiling_native_extension/private_vm_api_access.c +25 -86
- data/ext/datadog_profiling_native_extension/profiling.c +2 -0
- data/ext/datadog_profiling_native_extension/ruby_helpers.h +3 -5
- data/ext/datadog_profiling_native_extension/stack_recorder.c +161 -62
- data/lib/datadog/appsec/contrib/devise/tracking.rb +8 -0
- data/lib/datadog/appsec/contrib/rack/request_middleware.rb +43 -13
- data/lib/datadog/appsec/event.rb +2 -2
- data/lib/datadog/core/configuration/components.rb +2 -1
- data/lib/datadog/core/configuration/option.rb +7 -5
- data/lib/datadog/core/configuration/settings.rb +34 -79
- data/lib/datadog/core/configuration.rb +20 -4
- data/lib/datadog/core/environment/platform.rb +7 -1
- data/lib/datadog/core/remote/client/capabilities.rb +2 -1
- data/lib/datadog/core/remote/client.rb +1 -5
- data/lib/datadog/core/remote/configuration/repository.rb +1 -1
- data/lib/datadog/core/remote/dispatcher.rb +3 -3
- data/lib/datadog/core/remote/transport/http/config.rb +5 -5
- data/lib/datadog/core/telemetry/client.rb +18 -10
- data/lib/datadog/core/telemetry/emitter.rb +9 -13
- data/lib/datadog/core/telemetry/event.rb +247 -57
- data/lib/datadog/core/telemetry/ext.rb +1 -0
- data/lib/datadog/core/telemetry/heartbeat.rb +1 -3
- data/lib/datadog/core/telemetry/http/ext.rb +4 -1
- data/lib/datadog/core/telemetry/http/response.rb +4 -0
- data/lib/datadog/core/telemetry/http/transport.rb +9 -4
- data/lib/datadog/core/telemetry/request.rb +59 -0
- data/lib/datadog/core/utils/base64.rb +22 -0
- data/lib/datadog/opentelemetry/sdk/span_processor.rb +19 -2
- data/lib/datadog/opentelemetry/sdk/trace/span.rb +3 -17
- data/lib/datadog/profiling/collectors/code_provenance.rb +10 -4
- data/lib/datadog/profiling/collectors/cpu_and_wall_time_worker.rb +25 -0
- data/lib/datadog/profiling/component.rb +49 -17
- data/lib/datadog/profiling/crashtracker.rb +91 -0
- data/lib/datadog/profiling/exporter.rb +6 -3
- data/lib/datadog/profiling/http_transport.rb +7 -11
- data/lib/datadog/profiling/load_native_extension.rb +14 -1
- data/lib/datadog/profiling/profiler.rb +9 -2
- data/lib/datadog/profiling/stack_recorder.rb +6 -2
- data/lib/datadog/profiling.rb +12 -0
- data/lib/datadog/tracing/component.rb +5 -1
- data/lib/datadog/tracing/configuration/dynamic.rb +39 -1
- data/lib/datadog/tracing/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/action_pack/integration.rb +1 -1
- data/lib/datadog/tracing/contrib/action_view/integration.rb +1 -1
- data/lib/datadog/tracing/contrib/active_record/configuration/resolver.rb +1 -0
- data/lib/datadog/tracing/contrib/active_record/integration.rb +11 -1
- data/lib/datadog/tracing/contrib/active_support/integration.rb +1 -1
- data/lib/datadog/tracing/contrib/configuration/resolver.rb +43 -0
- data/lib/datadog/tracing/contrib/grape/endpoint.rb +43 -5
- data/lib/datadog/tracing/contrib/trilogy/instrumentation.rb +1 -1
- data/lib/datadog/tracing/correlation.rb +3 -4
- data/lib/datadog/tracing/remote.rb +5 -1
- data/lib/datadog/tracing/sampling/ext.rb +5 -1
- data/lib/datadog/tracing/sampling/matcher.rb +75 -26
- data/lib/datadog/tracing/sampling/rule.rb +27 -4
- data/lib/datadog/tracing/sampling/rule_sampler.rb +19 -1
- data/lib/datadog/tracing/sampling/span/matcher.rb +13 -41
- data/lib/datadog/tracing/span.rb +7 -2
- data/lib/datadog/tracing/span_link.rb +92 -0
- data/lib/datadog/tracing/span_operation.rb +6 -4
- data/lib/datadog/tracing/trace_operation.rb +12 -0
- data/lib/datadog/tracing/tracer.rb +4 -3
- data/lib/datadog/tracing/transport/serializable_trace.rb +3 -1
- data/lib/datadog/tracing/utils.rb +16 -0
- data/lib/datadog/version.rb +1 -1
- metadata +10 -31
- data/lib/datadog/core/telemetry/collector.rb +0 -248
- data/lib/datadog/core/telemetry/v1/app_event.rb +0 -59
- data/lib/datadog/core/telemetry/v1/application.rb +0 -94
- data/lib/datadog/core/telemetry/v1/configuration.rb +0 -27
- data/lib/datadog/core/telemetry/v1/dependency.rb +0 -45
- data/lib/datadog/core/telemetry/v1/host.rb +0 -59
- data/lib/datadog/core/telemetry/v1/install_signature.rb +0 -38
- data/lib/datadog/core/telemetry/v1/integration.rb +0 -66
- data/lib/datadog/core/telemetry/v1/product.rb +0 -36
- data/lib/datadog/core/telemetry/v1/telemetry_request.rb +0 -108
- data/lib/datadog/core/telemetry/v2/app_client_configuration_change.rb +0 -41
- data/lib/datadog/core/telemetry/v2/request.rb +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c8f4fef81d3a238299c70c27f6ece67dc31e76e4b6ad2180a2d1126e4c9545a
|
4
|
+
data.tar.gz: 17bc14574f265b2fdba65d4030e37e513f6af33af6ce8be77e1bbb535d4f6ae4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fff160e4a8e316ec82381e5ae6ef5687a434aa0798debcc689c37e127d688e3d0c0f1009befb6871096c77032caeed348df777ba9baab4c8f7d6f4582d02c8bd
|
7
|
+
data.tar.gz: 6fb4d250c8838a101a489cc10ee0672c23dd4a9793ad850b17bc2c375881c0e3e4cf2c7c3bf5645a6ce8bce1e59c06cbb82609dffe489101fb3ba158d655f034
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,110 @@
|
|
2
2
|
|
3
3
|
## [Unreleased]
|
4
4
|
|
5
|
+
## [2.0.0.rc1] - 2024-05-24
|
6
|
+
|
7
|
+
### Added
|
8
|
+
|
9
|
+
* Core: Add libdatadog crash tracker ([#3384][])
|
10
|
+
* OpenTelemetry: Add support for Span Links ([#3572][])
|
11
|
+
* Profiling: Enable endpoint profiling for Sidekiq and other background job processors ([#3610][])
|
12
|
+
* Tracing: Add dynamically configurable sampling rules ([#3598][])
|
13
|
+
* Tracing: Add sampling rule glob pattern matching ([#3616][])
|
14
|
+
|
15
|
+
### Changed
|
16
|
+
|
17
|
+
* Appsec: Fix undefined method error when Tracing disabled ([#3645][])
|
18
|
+
* Profiling: Upgrade to libdatadog 9 ([#3627][])
|
19
|
+
* Tracing: Cache ActiveRecord configuration resolver ([#3630][])
|
20
|
+
|
21
|
+
### Fixed
|
22
|
+
|
23
|
+
* Core: Fix error during telemetry debug logging attempt ([#3617][])
|
24
|
+
* OpenTelemetry: Fix attribute merge with Datadog tags ([#3651][])
|
25
|
+
* Tracing: Fix environment logger repeated entries ([#3624][])
|
26
|
+
|
27
|
+
### Removed
|
28
|
+
|
29
|
+
* Profiling: Remove profiler support for Ruby 2.3 and 2.4 ([#3621][])
|
30
|
+
* Profiling: Remove deprecated profiler settings ([#3597][])
|
31
|
+
|
32
|
+
## [1.23.0] - 2024-05-09
|
33
|
+
|
34
|
+
### Added
|
35
|
+
|
36
|
+
* Profiling: Enable endpoint profiling for Sidekiq and similar background job processors ([#3619][])
|
37
|
+
|
38
|
+
### Fixed
|
39
|
+
|
40
|
+
* Fix no such file or directory issue when using single step instrumentation ([#3623][])
|
41
|
+
* Fix error during telemetry debug logging attempt ([#3618][])
|
42
|
+
|
43
|
+
## [2.0.0.beta2] - 2024-04-18
|
44
|
+
|
45
|
+
### Added
|
46
|
+
|
47
|
+
* Add Agent configuration option: `timeout_seconds`, `uds_path`, and `use_ssl` ([#3350][])
|
48
|
+
* Tracing: Add lightweight log correlation generation ([#3486][])
|
49
|
+
* Tracing: Add span links ([#3546][])
|
50
|
+
* Tracing: Add `span_remote` field to `TraceDigest` ([#3516][])
|
51
|
+
* Tracing: Add `_dd.parent_id` to `tracestate` ([#3488][])
|
52
|
+
* Tracing: Allow `RateSampler` with zero sampling rate ([#3295][])
|
53
|
+
* Grape: Add `on_error` settings ([#3370][])
|
54
|
+
|
55
|
+
### Changed
|
56
|
+
|
57
|
+
* Rename gem from `ddtrace` to `datadog` ([#3490][])
|
58
|
+
* Require Ruby `>= 2.5` ([#3291][])
|
59
|
+
* Frozen string literals ([#3392][])
|
60
|
+
* Startup logs emit when reconfigures ([#3441][])
|
61
|
+
* Enhance validation for configuration ([#3332][], [#3326][])
|
62
|
+
* Tracing: Propagation style configuration becomes case-insensitive ([#3299][])
|
63
|
+
* Tracing: Return string for `#trace_id` and `#span_id` from `Correlation::Identifier` ([#3322][])
|
64
|
+
* `Elasticsearch`: Replace instance configuration from `client` to `transport` instance ([#3399][])
|
65
|
+
* `Grape`: Change `error_statuses` settings to `error_status_codes` ([#3370][])
|
66
|
+
* `GraphQL`: Instrument with `GraphQL::Tracing::DataDogTrace` and more ([#3409][], [#3417][], [#3388][])
|
67
|
+
* `Rack`: Change http proxy span pattern ([#3369][])
|
68
|
+
* `Sidekiq`: Remove `tag_args` option and worker specific configuration ([#3396][], [#3402][])
|
69
|
+
* Integrations: Rename `error_handler` settings to `on_error` ([#3341][])
|
70
|
+
*
|
71
|
+
### Fixed
|
72
|
+
|
73
|
+
* Tracing: Fix `error_status_codes` options ([#3344][])
|
74
|
+
|
75
|
+
### Removed
|
76
|
+
|
77
|
+
* Profiling: Remove `bin/ddtracerb` ([#3506][])
|
78
|
+
* Ci-app: Remove `datadog-ci` gem dependency ([#3288][])
|
79
|
+
* Tracing: Remove `SpanOperation` aliases ([#3330][])
|
80
|
+
* Tracing: Remove `b3` style from default propagation ([#3293][])
|
81
|
+
* Tracing: Minimize sampling API ([#3423][])
|
82
|
+
* Tracing: Remove `client_ip` disabled env ([#3404][])
|
83
|
+
* Tracing: Remove `use` alias for `instrument` ([#3403][])
|
84
|
+
* Tracing: `OpenTracing`, `qless` removed ([#3398][], [#3443][])
|
85
|
+
* `Net/Http`: Remove `Datadog::Tracing::Contrib::HTTP::Instrumentation.after_request` ([#3367][])
|
86
|
+
* `Rails`: Drop support for Rails 3 ([#3324][])
|
87
|
+
* `Rails`: Remove `exception_controller` option ([#3243][])
|
88
|
+
* Remove constants, methods and more ([#3401][], [#3336][], [#3454][], [#3338][], [#3335][], [#3298][], [#3297][], [#3309][], [#3294][], [#3325][], [#3300][])
|
89
|
+
|
90
|
+
## [1.22.0] - 2024-04-16
|
91
|
+
|
92
|
+
### Added
|
93
|
+
|
94
|
+
* Tracing: Add sampling rules by trace resouce and tags ([#3587][], [#3585][])
|
95
|
+
* Appsec: Add WAF vendor header support ([#3528][])
|
96
|
+
|
97
|
+
### Changed
|
98
|
+
|
99
|
+
* Upgrade `Telemetry` to V2 ([#3551][])
|
100
|
+
* Upgrade to libdatadog 7 ([#3536][])
|
101
|
+
* Profiling: Enable Garbage Collection profiling by default ([#3558][])
|
102
|
+
* Profiling: Skip heap samples with age 0 ([#3573][])
|
103
|
+
* Profiling: Support falling back into extension directory when loading profiler ([#3582][])
|
104
|
+
|
105
|
+
### Fixed
|
106
|
+
|
107
|
+
* Appsec: Fix MIME-style newlines with strict base64 encoding ([#3565][])
|
108
|
+
|
5
109
|
## [2.0.0.beta1] - 2024-03-22
|
6
110
|
|
7
111
|
Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v2.0.0.beta1
|
@@ -2784,7 +2888,11 @@ Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.3.1
|
|
2784
2888
|
Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
|
2785
2889
|
|
2786
2890
|
|
2787
|
-
[Unreleased]: https://github.com/DataDog/dd-trace-rb/compare/
|
2891
|
+
[Unreleased]: https://github.com/DataDog/dd-trace-rb/compare/v2.0.0.rc1...master
|
2892
|
+
[2.0.0.rc1]: https://github.com/DataDog/dd-trace-rb/compare/v2.0.0.beta2...v2.0.0.rc1
|
2893
|
+
[1.23.0]: https://github.com/DataDog/dd-trace-rb/compare/v1.22.0...v1.23.0
|
2894
|
+
[2.0.0.beta2]: https://github.com/DataDog/dd-trace-rb/compare/v2.0.0.beta1...v2.0.0.beta2
|
2895
|
+
[1.22.0]: https://github.com/DataDog/dd-trace-rb/compare/v1.21.1...v1.22.0
|
2788
2896
|
[2.0.0.beta1]: https://github.com/DataDog/dd-trace-rb/compare/v1.21.1...v2.0.0.beta1
|
2789
2897
|
[1.21.1]: https://github.com/DataDog/dd-trace-rb/compare/v1.21.0...v1.21.1
|
2790
2898
|
[1.21.0]: https://github.com/DataDog/dd-trace-rb/compare/v1.20.0...v1.21.0
|
@@ -4007,6 +4115,7 @@ Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
|
|
4007
4115
|
[#3235]: https://github.com/DataDog/dd-trace-rb/issues/3235
|
4008
4116
|
[#3240]: https://github.com/DataDog/dd-trace-rb/issues/3240
|
4009
4117
|
[#3242]: https://github.com/DataDog/dd-trace-rb/issues/3242
|
4118
|
+
[#3243]: https://github.com/DataDog/dd-trace-rb/issues/3243
|
4010
4119
|
[#3248]: https://github.com/DataDog/dd-trace-rb/issues/3248
|
4011
4120
|
[#3252]: https://github.com/DataDog/dd-trace-rb/issues/3252
|
4012
4121
|
[#3255]: https://github.com/DataDog/dd-trace-rb/issues/3255
|
@@ -4025,21 +4134,43 @@ Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
|
|
4025
4134
|
[#3284]: https://github.com/DataDog/dd-trace-rb/issues/3284
|
4026
4135
|
[#3286]: https://github.com/DataDog/dd-trace-rb/issues/3286
|
4027
4136
|
[#3287]: https://github.com/DataDog/dd-trace-rb/issues/3287
|
4137
|
+
[#3288]: https://github.com/DataDog/dd-trace-rb/issues/3288
|
4028
4138
|
[#3289]: https://github.com/DataDog/dd-trace-rb/issues/3289
|
4139
|
+
[#3291]: https://github.com/DataDog/dd-trace-rb/issues/3291
|
4140
|
+
[#3293]: https://github.com/DataDog/dd-trace-rb/issues/3293
|
4141
|
+
[#3294]: https://github.com/DataDog/dd-trace-rb/issues/3294
|
4142
|
+
[#3295]: https://github.com/DataDog/dd-trace-rb/issues/3295
|
4143
|
+
[#3297]: https://github.com/DataDog/dd-trace-rb/issues/3297
|
4144
|
+
[#3298]: https://github.com/DataDog/dd-trace-rb/issues/3298
|
4145
|
+
[#3299]: https://github.com/DataDog/dd-trace-rb/issues/3299
|
4146
|
+
[#3300]: https://github.com/DataDog/dd-trace-rb/issues/3300
|
4029
4147
|
[#3303]: https://github.com/DataDog/dd-trace-rb/issues/3303
|
4030
4148
|
[#3307]: https://github.com/DataDog/dd-trace-rb/issues/3307
|
4031
4149
|
[#3308]: https://github.com/DataDog/dd-trace-rb/issues/3308
|
4150
|
+
[#3309]: https://github.com/DataDog/dd-trace-rb/issues/3309
|
4032
4151
|
[#3310]: https://github.com/DataDog/dd-trace-rb/issues/3310
|
4033
4152
|
[#3313]: https://github.com/DataDog/dd-trace-rb/issues/3313
|
4034
4153
|
[#3315]: https://github.com/DataDog/dd-trace-rb/issues/3315
|
4035
4154
|
[#3316]: https://github.com/DataDog/dd-trace-rb/issues/3316
|
4036
4155
|
[#3317]: https://github.com/DataDog/dd-trace-rb/issues/3317
|
4037
4156
|
[#3320]: https://github.com/DataDog/dd-trace-rb/issues/3320
|
4157
|
+
[#3322]: https://github.com/DataDog/dd-trace-rb/issues/3322
|
4158
|
+
[#3324]: https://github.com/DataDog/dd-trace-rb/issues/3324
|
4159
|
+
[#3325]: https://github.com/DataDog/dd-trace-rb/issues/3325
|
4160
|
+
[#3326]: https://github.com/DataDog/dd-trace-rb/issues/3326
|
4038
4161
|
[#3328]: https://github.com/DataDog/dd-trace-rb/issues/3328
|
4039
4162
|
[#3329]: https://github.com/DataDog/dd-trace-rb/issues/3329
|
4163
|
+
[#3330]: https://github.com/DataDog/dd-trace-rb/issues/3330
|
4164
|
+
[#3332]: https://github.com/DataDog/dd-trace-rb/issues/3332
|
4040
4165
|
[#3333]: https://github.com/DataDog/dd-trace-rb/issues/3333
|
4166
|
+
[#3335]: https://github.com/DataDog/dd-trace-rb/issues/3335
|
4167
|
+
[#3336]: https://github.com/DataDog/dd-trace-rb/issues/3336
|
4168
|
+
[#3338]: https://github.com/DataDog/dd-trace-rb/issues/3338
|
4169
|
+
[#3341]: https://github.com/DataDog/dd-trace-rb/issues/3341
|
4170
|
+
[#3344]: https://github.com/DataDog/dd-trace-rb/issues/3344
|
4041
4171
|
[#3345]: https://github.com/DataDog/dd-trace-rb/issues/3345
|
4042
4172
|
[#3349]: https://github.com/DataDog/dd-trace-rb/issues/3349
|
4173
|
+
[#3350]: https://github.com/DataDog/dd-trace-rb/issues/3350
|
4043
4174
|
[#3352]: https://github.com/DataDog/dd-trace-rb/issues/3352
|
4044
4175
|
[#3354]: https://github.com/DataDog/dd-trace-rb/issues/3354
|
4045
4176
|
[#3356]: https://github.com/DataDog/dd-trace-rb/issues/3356
|
@@ -4049,13 +4180,29 @@ Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
|
|
4049
4180
|
[#3362]: https://github.com/DataDog/dd-trace-rb/issues/3362
|
4050
4181
|
[#3365]: https://github.com/DataDog/dd-trace-rb/issues/3365
|
4051
4182
|
[#3366]: https://github.com/DataDog/dd-trace-rb/issues/3366
|
4183
|
+
[#3367]: https://github.com/DataDog/dd-trace-rb/issues/3367
|
4184
|
+
[#3369]: https://github.com/DataDog/dd-trace-rb/issues/3369
|
4185
|
+
[#3370]: https://github.com/DataDog/dd-trace-rb/issues/3370
|
4052
4186
|
[#3373]: https://github.com/DataDog/dd-trace-rb/issues/3373
|
4053
4187
|
[#3374]: https://github.com/DataDog/dd-trace-rb/issues/3374
|
4188
|
+
[#3384]: https://github.com/DataDog/dd-trace-rb/issues/3384
|
4054
4189
|
[#3386]: https://github.com/DataDog/dd-trace-rb/issues/3386
|
4190
|
+
[#3388]: https://github.com/DataDog/dd-trace-rb/issues/3388
|
4191
|
+
[#3392]: https://github.com/DataDog/dd-trace-rb/issues/3392
|
4055
4192
|
[#3395]: https://github.com/DataDog/dd-trace-rb/issues/3395
|
4193
|
+
[#3396]: https://github.com/DataDog/dd-trace-rb/issues/3396
|
4194
|
+
[#3398]: https://github.com/DataDog/dd-trace-rb/issues/3398
|
4195
|
+
[#3399]: https://github.com/DataDog/dd-trace-rb/issues/3399
|
4056
4196
|
[#3400]: https://github.com/DataDog/dd-trace-rb/issues/3400
|
4197
|
+
[#3401]: https://github.com/DataDog/dd-trace-rb/issues/3401
|
4198
|
+
[#3402]: https://github.com/DataDog/dd-trace-rb/issues/3402
|
4199
|
+
[#3403]: https://github.com/DataDog/dd-trace-rb/issues/3403
|
4200
|
+
[#3404]: https://github.com/DataDog/dd-trace-rb/issues/3404
|
4057
4201
|
[#3408]: https://github.com/DataDog/dd-trace-rb/issues/3408
|
4202
|
+
[#3409]: https://github.com/DataDog/dd-trace-rb/issues/3409
|
4203
|
+
[#3417]: https://github.com/DataDog/dd-trace-rb/issues/3417
|
4058
4204
|
[#3420]: https://github.com/DataDog/dd-trace-rb/issues/3420
|
4205
|
+
[#3423]: https://github.com/DataDog/dd-trace-rb/issues/3423
|
4059
4206
|
[#3426]: https://github.com/DataDog/dd-trace-rb/issues/3426
|
4060
4207
|
[#3427]: https://github.com/DataDog/dd-trace-rb/issues/3427
|
4061
4208
|
[#3428]: https://github.com/DataDog/dd-trace-rb/issues/3428
|
@@ -4064,24 +4211,57 @@ Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
|
|
4064
4211
|
[#3438]: https://github.com/DataDog/dd-trace-rb/issues/3438
|
4065
4212
|
[#3439]: https://github.com/DataDog/dd-trace-rb/issues/3439
|
4066
4213
|
[#3440]: https://github.com/DataDog/dd-trace-rb/issues/3440
|
4214
|
+
[#3441]: https://github.com/DataDog/dd-trace-rb/issues/3441
|
4215
|
+
[#3443]: https://github.com/DataDog/dd-trace-rb/issues/3443
|
4216
|
+
[#3454]: https://github.com/DataDog/dd-trace-rb/issues/3454
|
4067
4217
|
[#3455]: https://github.com/DataDog/dd-trace-rb/issues/3455
|
4068
4218
|
[#3463]: https://github.com/DataDog/dd-trace-rb/issues/3463
|
4069
4219
|
[#3466]: https://github.com/DataDog/dd-trace-rb/issues/3466
|
4070
4220
|
[#3468]: https://github.com/DataDog/dd-trace-rb/issues/3468
|
4071
4221
|
[#3473]: https://github.com/DataDog/dd-trace-rb/issues/3473
|
4222
|
+
[#3486]: https://github.com/DataDog/dd-trace-rb/issues/3486
|
4223
|
+
[#3488]: https://github.com/DataDog/dd-trace-rb/issues/3488
|
4224
|
+
[#3490]: https://github.com/DataDog/dd-trace-rb/issues/3490
|
4072
4225
|
[#3491]: https://github.com/DataDog/dd-trace-rb/issues/3491
|
4073
4226
|
[#3495]: https://github.com/DataDog/dd-trace-rb/issues/3495
|
4074
4227
|
[#3501]: https://github.com/DataDog/dd-trace-rb/issues/3501
|
4075
4228
|
[#3502]: https://github.com/DataDog/dd-trace-rb/issues/3502
|
4076
4229
|
[#3503]: https://github.com/DataDog/dd-trace-rb/issues/3503
|
4230
|
+
[#3506]: https://github.com/DataDog/dd-trace-rb/issues/3506
|
4077
4231
|
[#3511]: https://github.com/DataDog/dd-trace-rb/issues/3511
|
4232
|
+
[#3516]: https://github.com/DataDog/dd-trace-rb/issues/3516
|
4078
4233
|
[#3518]: https://github.com/DataDog/dd-trace-rb/issues/3518
|
4079
4234
|
[#3519]: https://github.com/DataDog/dd-trace-rb/issues/3519
|
4080
4235
|
[#3520]: https://github.com/DataDog/dd-trace-rb/issues/3520
|
4081
4236
|
[#3523]: https://github.com/DataDog/dd-trace-rb/issues/3523
|
4237
|
+
[#3528]: https://github.com/DataDog/dd-trace-rb/issues/3528
|
4082
4238
|
[#3531]: https://github.com/DataDog/dd-trace-rb/issues/3531
|
4083
4239
|
[#3535]: https://github.com/DataDog/dd-trace-rb/issues/3535
|
4240
|
+
[#3536]: https://github.com/DataDog/dd-trace-rb/issues/3536
|
4084
4241
|
[#3539]: https://github.com/DataDog/dd-trace-rb/issues/3539
|
4242
|
+
[#3546]: https://github.com/DataDog/dd-trace-rb/issues/3546
|
4243
|
+
[#3551]: https://github.com/DataDog/dd-trace-rb/issues/3551
|
4244
|
+
[#3558]: https://github.com/DataDog/dd-trace-rb/issues/3558
|
4245
|
+
[#3565]: https://github.com/DataDog/dd-trace-rb/issues/3565
|
4246
|
+
[#3572]: https://github.com/DataDog/dd-trace-rb/issues/3572
|
4247
|
+
[#3573]: https://github.com/DataDog/dd-trace-rb/issues/3573
|
4248
|
+
[#3582]: https://github.com/DataDog/dd-trace-rb/issues/3582
|
4249
|
+
[#3585]: https://github.com/DataDog/dd-trace-rb/issues/3585
|
4250
|
+
[#3587]: https://github.com/DataDog/dd-trace-rb/issues/3587
|
4251
|
+
[#3597]: https://github.com/DataDog/dd-trace-rb/issues/3597
|
4252
|
+
[#3598]: https://github.com/DataDog/dd-trace-rb/issues/3598
|
4253
|
+
[#3610]: https://github.com/DataDog/dd-trace-rb/issues/3610
|
4254
|
+
[#3616]: https://github.com/DataDog/dd-trace-rb/issues/3616
|
4255
|
+
[#3617]: https://github.com/DataDog/dd-trace-rb/issues/3617
|
4256
|
+
[#3618]: https://github.com/DataDog/dd-trace-rb/issues/3618
|
4257
|
+
[#3619]: https://github.com/DataDog/dd-trace-rb/issues/3619
|
4258
|
+
[#3621]: https://github.com/DataDog/dd-trace-rb/issues/3621
|
4259
|
+
[#3623]: https://github.com/DataDog/dd-trace-rb/issues/3623
|
4260
|
+
[#3624]: https://github.com/DataDog/dd-trace-rb/issues/3624
|
4261
|
+
[#3627]: https://github.com/DataDog/dd-trace-rb/issues/3627
|
4262
|
+
[#3630]: https://github.com/DataDog/dd-trace-rb/issues/3630
|
4263
|
+
[#3645]: https://github.com/DataDog/dd-trace-rb/issues/3645
|
4264
|
+
[#3651]: https://github.com/DataDog/dd-trace-rb/issues/3651
|
4085
4265
|
[@AdrianLC]: https://github.com/AdrianLC
|
4086
4266
|
[@Azure7111]: https://github.com/Azure7111
|
4087
4267
|
[@BabyGroot]: https://github.com/BabyGroot
|
@@ -28,7 +28,7 @@ documentation.**
|
|
28
28
|
The profiling native extension is (and must always be) designed to **not cause failures** during gem installation, even
|
29
29
|
if some features, Ruby versions, or operating systems are not supported.
|
30
30
|
|
31
|
-
E.g. the extension must not break installation on Ruby 2.
|
31
|
+
E.g. the extension must not break installation on Ruby 2.5 (or the oldest Ruby version we support at the time) on 64-bit ARM macOS,
|
32
32
|
even if at run time it will effectively do nothing for such a setup.
|
33
33
|
|
34
34
|
We have a CI setup to help validate this, but this is really important to keep in mind when adding to or changing the
|
@@ -96,6 +96,7 @@ struct cpu_and_wall_time_worker_state {
|
|
96
96
|
bool no_signals_workaround_enabled;
|
97
97
|
bool dynamic_sampling_rate_enabled;
|
98
98
|
bool allocation_profiling_enabled;
|
99
|
+
bool skip_idle_samples_for_testing;
|
99
100
|
VALUE self_instance;
|
100
101
|
VALUE thread_context_collector_instance;
|
101
102
|
VALUE idle_sampling_helper_instance;
|
@@ -132,6 +133,8 @@ struct cpu_and_wall_time_worker_state {
|
|
132
133
|
unsigned int signal_handler_enqueued_sample;
|
133
134
|
// How many times the signal handler was called from the wrong thread
|
134
135
|
unsigned int signal_handler_wrong_thread;
|
136
|
+
// How many times we actually tried to interrupt a thread for sampling
|
137
|
+
unsigned int interrupt_thread_attempts;
|
135
138
|
|
136
139
|
// # Stats for the results of calling rb_postponed_job_register_one
|
137
140
|
// The same function was already waiting to be executed
|
@@ -177,7 +180,8 @@ static VALUE _native_initialize(
|
|
177
180
|
VALUE no_signals_workaround_enabled,
|
178
181
|
VALUE dynamic_sampling_rate_enabled,
|
179
182
|
VALUE dynamic_sampling_rate_overhead_target_percentage,
|
180
|
-
VALUE allocation_profiling_enabled
|
183
|
+
VALUE allocation_profiling_enabled,
|
184
|
+
VALUE skip_idle_samples_for_testing
|
181
185
|
);
|
182
186
|
static void cpu_and_wall_time_worker_typed_data_mark(void *state_ptr);
|
183
187
|
static VALUE _native_sampling_loop(VALUE self, VALUE instance);
|
@@ -272,14 +276,16 @@ void collectors_cpu_and_wall_time_worker_init(VALUE profiling_module) {
|
|
272
276
|
// https://bugs.ruby-lang.org/issues/18007 for a discussion around this.
|
273
277
|
rb_define_alloc_func(collectors_cpu_and_wall_time_worker_class, _native_new);
|
274
278
|
|
275
|
-
rb_define_singleton_method(collectors_cpu_and_wall_time_worker_class, "_native_initialize", _native_initialize,
|
279
|
+
rb_define_singleton_method(collectors_cpu_and_wall_time_worker_class, "_native_initialize", _native_initialize, 9);
|
276
280
|
rb_define_singleton_method(collectors_cpu_and_wall_time_worker_class, "_native_sampling_loop", _native_sampling_loop, 1);
|
277
281
|
rb_define_singleton_method(collectors_cpu_and_wall_time_worker_class, "_native_stop", _native_stop, 2);
|
278
282
|
rb_define_singleton_method(collectors_cpu_and_wall_time_worker_class, "_native_reset_after_fork", _native_reset_after_fork, 1);
|
279
283
|
rb_define_singleton_method(collectors_cpu_and_wall_time_worker_class, "_native_stats", _native_stats, 1);
|
280
284
|
rb_define_singleton_method(collectors_cpu_and_wall_time_worker_class, "_native_stats_reset_not_thread_safe", _native_stats_reset_not_thread_safe, 1);
|
281
285
|
rb_define_singleton_method(collectors_cpu_and_wall_time_worker_class, "_native_allocation_count", _native_allocation_count, 0);
|
286
|
+
rb_define_singleton_method(collectors_cpu_and_wall_time_worker_class, "_native_is_running?", _native_is_running, 1);
|
282
287
|
rb_define_singleton_method(testing_module, "_native_current_sigprof_signal_handler", _native_current_sigprof_signal_handler, 0);
|
288
|
+
// TODO: Remove `_native_is_running` from `testing_module` once `prof-correctness` has been updated to not need it
|
283
289
|
rb_define_singleton_method(testing_module, "_native_is_running?", _native_is_running, 1);
|
284
290
|
rb_define_singleton_method(testing_module, "_native_install_testing_signal_handler", _native_install_testing_signal_handler, 0);
|
285
291
|
rb_define_singleton_method(testing_module, "_native_remove_testing_signal_handler", _native_remove_testing_signal_handler, 0);
|
@@ -315,6 +321,7 @@ static VALUE _native_new(VALUE klass) {
|
|
315
321
|
state->no_signals_workaround_enabled = false;
|
316
322
|
state->dynamic_sampling_rate_enabled = true;
|
317
323
|
state->allocation_profiling_enabled = false;
|
324
|
+
state->skip_idle_samples_for_testing = false;
|
318
325
|
state->thread_context_collector_instance = Qnil;
|
319
326
|
state->idle_sampling_helper_instance = Qnil;
|
320
327
|
state->owner_thread = Qnil;
|
@@ -350,13 +357,15 @@ static VALUE _native_initialize(
|
|
350
357
|
VALUE no_signals_workaround_enabled,
|
351
358
|
VALUE dynamic_sampling_rate_enabled,
|
352
359
|
VALUE dynamic_sampling_rate_overhead_target_percentage,
|
353
|
-
VALUE allocation_profiling_enabled
|
360
|
+
VALUE allocation_profiling_enabled,
|
361
|
+
VALUE skip_idle_samples_for_testing
|
354
362
|
) {
|
355
363
|
ENFORCE_BOOLEAN(gc_profiling_enabled);
|
356
364
|
ENFORCE_BOOLEAN(no_signals_workaround_enabled);
|
357
365
|
ENFORCE_BOOLEAN(dynamic_sampling_rate_enabled);
|
358
366
|
ENFORCE_TYPE(dynamic_sampling_rate_overhead_target_percentage, T_FLOAT);
|
359
367
|
ENFORCE_BOOLEAN(allocation_profiling_enabled);
|
368
|
+
ENFORCE_BOOLEAN(skip_idle_samples_for_testing)
|
360
369
|
|
361
370
|
struct cpu_and_wall_time_worker_state *state;
|
362
371
|
TypedData_Get_Struct(self_instance, struct cpu_and_wall_time_worker_state, &cpu_and_wall_time_worker_typed_data, state);
|
@@ -365,6 +374,7 @@ static VALUE _native_initialize(
|
|
365
374
|
state->no_signals_workaround_enabled = (no_signals_workaround_enabled == Qtrue);
|
366
375
|
state->dynamic_sampling_rate_enabled = (dynamic_sampling_rate_enabled == Qtrue);
|
367
376
|
state->allocation_profiling_enabled = (allocation_profiling_enabled == Qtrue);
|
377
|
+
state->skip_idle_samples_for_testing = (skip_idle_samples_for_testing == Qtrue);
|
368
378
|
|
369
379
|
double total_overhead_target_percentage = NUM2DBL(dynamic_sampling_rate_overhead_target_percentage);
|
370
380
|
if (!state->allocation_profiling_enabled) {
|
@@ -616,17 +626,23 @@ static void *run_sampling_trigger_loop(void *state_ptr) {
|
|
616
626
|
// Note that reading the GVL owner and sending them a signal is a race -- the Ruby VM keeps on executing while
|
617
627
|
// we're doing this, so we may still not signal the correct thread from time to time, but our signal handler
|
618
628
|
// includes a check to see if it got called in the right thread
|
629
|
+
state->stats.interrupt_thread_attempts++;
|
619
630
|
pthread_kill(owner.owner, SIGPROF);
|
620
631
|
} else {
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
632
|
+
if (state->skip_idle_samples_for_testing) {
|
633
|
+
// This was added to make sure our tests don't accidentally pass due to idle samples. Specifically, if we
|
634
|
+
// comment out the thread interruption code inside `if (owner.valid)` above, our tests should not pass!
|
635
|
+
} else {
|
636
|
+
// If no thread owns the Global VM Lock, the application is probably idle at the moment. We still want to sample
|
637
|
+
// so we "ask a friend" (the IdleSamplingHelper component) to grab the GVL and simulate getting a SIGPROF.
|
638
|
+
//
|
639
|
+
// In a previous version of the code, we called `grab_gvl_and_sample` directly BUT this was problematic because
|
640
|
+
// Ruby may concurrently get busy and so the CpuAndWallTimeWorker would be blocked in line to acquire the GVL
|
641
|
+
// for an uncontrolled amount of time. (This can still happen to the IdleSamplingHelper, but the
|
642
|
+
// CpuAndWallTimeWorker will still be free to interrupt the Ruby VM and keep sampling for the entire blocking period).
|
643
|
+
state->stats.trigger_simulated_signal_delivery_attempts++;
|
644
|
+
idle_sampling_helper_request_action(state->idle_sampling_helper_instance, grab_gvl_and_sample);
|
645
|
+
}
|
630
646
|
}
|
631
647
|
}
|
632
648
|
|
@@ -737,6 +753,9 @@ static VALUE release_gvl_and_run_sampling_trigger_loop(VALUE instance) {
|
|
737
753
|
if (state->gc_profiling_enabled) rb_tracepoint_enable(state->gc_tracepoint);
|
738
754
|
if (state->allocation_profiling_enabled) rb_tracepoint_enable(state->object_allocation_tracepoint);
|
739
755
|
|
756
|
+
// Flag the profiler as running before we release the GVL, in case anyone's waiting to know about it
|
757
|
+
rb_funcall(instance, rb_intern("signal_running"), 0);
|
758
|
+
|
740
759
|
rb_thread_call_without_gvl(run_sampling_trigger_loop, state, interrupt_sampling_trigger_loop, state);
|
741
760
|
|
742
761
|
// If we stopped sampling due to an exception, re-raise it (now in the worker thread)
|
@@ -910,18 +929,6 @@ static VALUE _native_stats(DDTRACE_UNUSED VALUE self, VALUE instance) {
|
|
910
929
|
struct cpu_and_wall_time_worker_state *state;
|
911
930
|
TypedData_Get_Struct(instance, struct cpu_and_wall_time_worker_state, &cpu_and_wall_time_worker_typed_data, state);
|
912
931
|
|
913
|
-
VALUE pretty_cpu_sampling_time_ns_min = state->stats.cpu_sampling_time_ns_min == UINT64_MAX ? Qnil : ULL2NUM(state->stats.cpu_sampling_time_ns_min);
|
914
|
-
VALUE pretty_cpu_sampling_time_ns_max = state->stats.cpu_sampling_time_ns_max == 0 ? Qnil : ULL2NUM(state->stats.cpu_sampling_time_ns_max);
|
915
|
-
VALUE pretty_cpu_sampling_time_ns_total = state->stats.cpu_sampling_time_ns_total == 0 ? Qnil : ULL2NUM(state->stats.cpu_sampling_time_ns_total);
|
916
|
-
VALUE pretty_cpu_sampling_time_ns_avg =
|
917
|
-
state->stats.cpu_sampled == 0 ? Qnil : DBL2NUM(((double) state->stats.cpu_sampling_time_ns_total) / state->stats.cpu_sampled);
|
918
|
-
|
919
|
-
VALUE pretty_allocation_sampling_time_ns_min = state->stats.allocation_sampling_time_ns_min == UINT64_MAX ? Qnil : ULL2NUM(state->stats.allocation_sampling_time_ns_min);
|
920
|
-
VALUE pretty_allocation_sampling_time_ns_max = state->stats.allocation_sampling_time_ns_max == 0 ? Qnil : ULL2NUM(state->stats.allocation_sampling_time_ns_max);
|
921
|
-
VALUE pretty_allocation_sampling_time_ns_total = state->stats.allocation_sampling_time_ns_total == 0 ? Qnil : ULL2NUM(state->stats.allocation_sampling_time_ns_total);
|
922
|
-
VALUE pretty_allocation_sampling_time_ns_avg =
|
923
|
-
state->stats.allocation_sampled == 0 ? Qnil : DBL2NUM(((double) state->stats.allocation_sampling_time_ns_total) / state->stats.allocation_sampled);
|
924
|
-
|
925
932
|
unsigned long total_cpu_samples_attempted = state->stats.cpu_sampled + state->stats.cpu_skipped;
|
926
933
|
VALUE effective_cpu_sample_rate =
|
927
934
|
total_cpu_samples_attempted == 0 ? Qnil : DBL2NUM(((double) state->stats.cpu_sampled) / total_cpu_samples_attempted);
|
@@ -943,24 +950,25 @@ static VALUE _native_stats(DDTRACE_UNUSED VALUE self, VALUE instance) {
|
|
943
950
|
ID2SYM(rb_intern("postponed_job_success")), /* => */ UINT2NUM(state->stats.postponed_job_success),
|
944
951
|
ID2SYM(rb_intern("postponed_job_full")), /* => */ UINT2NUM(state->stats.postponed_job_full),
|
945
952
|
ID2SYM(rb_intern("postponed_job_unknown_result")), /* => */ UINT2NUM(state->stats.postponed_job_unknown_result),
|
953
|
+
ID2SYM(rb_intern("interrupt_thread_attempts")), /* => */ UINT2NUM(state->stats.interrupt_thread_attempts),
|
946
954
|
|
947
955
|
// CPU Stats
|
948
956
|
ID2SYM(rb_intern("cpu_sampled")), /* => */ UINT2NUM(state->stats.cpu_sampled),
|
949
957
|
ID2SYM(rb_intern("cpu_skipped")), /* => */ UINT2NUM(state->stats.cpu_skipped),
|
950
958
|
ID2SYM(rb_intern("cpu_effective_sample_rate")), /* => */ effective_cpu_sample_rate,
|
951
|
-
ID2SYM(rb_intern("cpu_sampling_time_ns_min")), /* => */
|
952
|
-
ID2SYM(rb_intern("cpu_sampling_time_ns_max")), /* => */
|
953
|
-
ID2SYM(rb_intern("cpu_sampling_time_ns_total")), /* => */
|
954
|
-
ID2SYM(rb_intern("cpu_sampling_time_ns_avg")), /* => */
|
959
|
+
ID2SYM(rb_intern("cpu_sampling_time_ns_min")), /* => */ RUBY_NUM_OR_NIL(state->stats.cpu_sampling_time_ns_min, != UINT64_MAX, ULL2NUM),
|
960
|
+
ID2SYM(rb_intern("cpu_sampling_time_ns_max")), /* => */ RUBY_NUM_OR_NIL(state->stats.cpu_sampling_time_ns_max, > 0, ULL2NUM),
|
961
|
+
ID2SYM(rb_intern("cpu_sampling_time_ns_total")), /* => */ RUBY_NUM_OR_NIL(state->stats.cpu_sampling_time_ns_total, > 0, ULL2NUM),
|
962
|
+
ID2SYM(rb_intern("cpu_sampling_time_ns_avg")), /* => */ RUBY_AVG_OR_NIL(state->stats.cpu_sampling_time_ns_total, state->stats.cpu_sampled),
|
955
963
|
|
956
964
|
// Allocation stats
|
957
965
|
ID2SYM(rb_intern("allocation_sampled")), /* => */ state->allocation_profiling_enabled ? ULONG2NUM(state->stats.allocation_sampled) : Qnil,
|
958
966
|
ID2SYM(rb_intern("allocation_skipped")), /* => */ state->allocation_profiling_enabled ? ULONG2NUM(state->stats.allocation_skipped) : Qnil,
|
959
967
|
ID2SYM(rb_intern("allocation_effective_sample_rate")), /* => */ effective_allocation_sample_rate,
|
960
|
-
ID2SYM(rb_intern("allocation_sampling_time_ns_min")), /* => */
|
961
|
-
ID2SYM(rb_intern("allocation_sampling_time_ns_max")), /* => */
|
962
|
-
ID2SYM(rb_intern("allocation_sampling_time_ns_total")), /* => */
|
963
|
-
ID2SYM(rb_intern("allocation_sampling_time_ns_avg")), /* => */
|
968
|
+
ID2SYM(rb_intern("allocation_sampling_time_ns_min")), /* => */ RUBY_NUM_OR_NIL(state->stats.allocation_sampling_time_ns_min, != UINT64_MAX, ULL2NUM),
|
969
|
+
ID2SYM(rb_intern("allocation_sampling_time_ns_max")), /* => */ RUBY_NUM_OR_NIL(state->stats.allocation_sampling_time_ns_max, > 0, ULL2NUM),
|
970
|
+
ID2SYM(rb_intern("allocation_sampling_time_ns_total")), /* => */ RUBY_NUM_OR_NIL(state->stats.allocation_sampling_time_ns_total, > 0, ULL2NUM),
|
971
|
+
ID2SYM(rb_intern("allocation_sampling_time_ns_avg")), /* => */ RUBY_AVG_OR_NIL(state->stats.allocation_sampling_time_ns_total, state->stats.allocation_sampled),
|
964
972
|
ID2SYM(rb_intern("allocation_sampler_snapshot")), /* => */ allocation_sampler_snapshot,
|
965
973
|
ID2SYM(rb_intern("allocations_during_sample")), /* => */ state->allocation_profiling_enabled ? UINT2NUM(state->stats.allocations_during_sample) : Qnil,
|
966
974
|
};
|
@@ -217,7 +217,7 @@ static long thread_id_for(VALUE thread);
|
|
217
217
|
static VALUE _native_stats(VALUE self, VALUE collector_instance);
|
218
218
|
static VALUE _native_gc_tracking(VALUE self, VALUE collector_instance);
|
219
219
|
static void trace_identifiers_for(struct thread_context_collector_state *state, VALUE thread, struct trace_identifiers *trace_identifiers_result);
|
220
|
-
static bool should_collect_resource(VALUE
|
220
|
+
static bool should_collect_resource(VALUE root_span);
|
221
221
|
static VALUE _native_reset_after_fork(DDTRACE_UNUSED VALUE self, VALUE collector_instance);
|
222
222
|
static VALUE thread_list(struct thread_context_collector_state *state);
|
223
223
|
static VALUE _native_sample_allocation(DDTRACE_UNUSED VALUE self, VALUE collector_instance, VALUE sample_weight, VALUE new_object);
|
@@ -621,11 +621,14 @@ bool thread_context_collector_on_gc_finish(VALUE self_instance) {
|
|
621
621
|
// Let the caller know if it should schedule a flush or not. Returning true every time would cause a lot of overhead
|
622
622
|
// on the application (see GC tracking introduction at the top of the file), so instead we try to accumulate a few
|
623
623
|
// samples first.
|
624
|
-
bool finished_major_gc = gc_profiling_has_major_gc_finished();
|
625
624
|
bool over_flush_time_treshold =
|
626
625
|
(wall_time_at_finish_ns - state->gc_tracking.wall_time_at_last_flushed_gc_event_ns) >= TIME_BETWEEN_GC_EVENTS_NS;
|
627
626
|
|
628
|
-
|
627
|
+
if (over_flush_time_treshold) {
|
628
|
+
return true;
|
629
|
+
} else {
|
630
|
+
return gc_profiling_has_major_gc_finished();
|
631
|
+
}
|
629
632
|
}
|
630
633
|
|
631
634
|
// This function gets called after one or more GC work steps (calls to on_gc_start/on_gc_finish).
|
@@ -1143,10 +1146,7 @@ static void trace_identifiers_for(struct thread_context_collector_state *state,
|
|
1143
1146
|
|
1144
1147
|
trace_identifiers_result->valid = true;
|
1145
1148
|
|
1146
|
-
if (!state->endpoint_collection_enabled) return;
|
1147
|
-
|
1148
|
-
VALUE root_span_type = rb_ivar_get(root_span, at_type_id /* @type */);
|
1149
|
-
if (root_span_type == Qnil || !should_collect_resource(root_span_type)) return;
|
1149
|
+
if (!state->endpoint_collection_enabled || !should_collect_resource(root_span)) return;
|
1150
1150
|
|
1151
1151
|
VALUE trace_resource = rb_ivar_get(active_trace, at_resource_id /* @resource */);
|
1152
1152
|
if (RB_TYPE_P(trace_resource, T_STRING)) {
|
@@ -1157,21 +1157,32 @@ static void trace_identifiers_for(struct thread_context_collector_state *state,
|
|
1157
1157
|
}
|
1158
1158
|
}
|
1159
1159
|
|
1160
|
-
// We
|
1160
|
+
// We opt-in to collecting the resource for spans of types:
|
1161
1161
|
// * 'web', for web requests
|
1162
|
-
// * proxy', used by the rack integration with request_queuing: true (e.g. also represents a web request)
|
1162
|
+
// * 'proxy', used by the rack integration with request_queuing: true (e.g. also represents a web request)
|
1163
|
+
// * 'worker', used for sidekiq and similar background job processors
|
1163
1164
|
//
|
1164
|
-
//
|
1165
|
+
// Over time, this list may be expanded.
|
1165
1166
|
// Resources MUST NOT include personal identifiable information (PII); this should not be the case with
|
1166
1167
|
// ddtrace integrations, but worth mentioning just in case :)
|
1167
|
-
static bool should_collect_resource(VALUE
|
1168
|
+
static bool should_collect_resource(VALUE root_span) {
|
1169
|
+
VALUE root_span_type = rb_ivar_get(root_span, at_type_id /* @type */);
|
1170
|
+
if (root_span_type == Qnil) return false;
|
1168
1171
|
ENFORCE_TYPE(root_span_type, T_STRING);
|
1169
1172
|
|
1170
1173
|
int root_span_type_length = RSTRING_LEN(root_span_type);
|
1171
1174
|
const char *root_span_type_value = StringValuePtr(root_span_type);
|
1172
1175
|
|
1173
|
-
|
1176
|
+
bool is_web_request =
|
1177
|
+
(root_span_type_length == strlen("web") && (memcmp("web", root_span_type_value, strlen("web")) == 0)) ||
|
1174
1178
|
(root_span_type_length == strlen("proxy") && (memcmp("proxy", root_span_type_value, strlen("proxy")) == 0));
|
1179
|
+
|
1180
|
+
if (is_web_request) return true;
|
1181
|
+
|
1182
|
+
bool is_worker_request =
|
1183
|
+
(root_span_type_length == strlen("worker") && (memcmp("worker", root_span_type_value, strlen("worker")) == 0));
|
1184
|
+
|
1185
|
+
return is_worker_request;
|
1175
1186
|
}
|
1176
1187
|
|
1177
1188
|
// After the Ruby VM forks, this method gets called in the child process to clean up any leftover state from the parent.
|