Skip to content

Commit a9f892f

Browse files
authored
Merge branch 'master' into di-loading
2 parents d3b854c + f3e66ea commit a9f892f

File tree

198 files changed

+999
-1088
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

198 files changed

+999
-1088
lines changed

.circleci/config.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ save_bundle_checksum: &save_bundle_checksum
6565
command: |
6666
if [ "$CI_BUNDLE_CACHE_HIT" != 1 ]; then
6767
# Recompute gemfiles/*.lock checksum, as those files might have changed
68-
cat Gemfile Gemfile.lock Appraisals gemfiles/*.gemfile gemfiles/*.gemfile.lock | md5sum > .circleci/bundle_checksum
68+
cat Gemfile Gemfile.lock ruby-*.gemfile gemfiles/*.gemfile gemfiles/*.gemfile.lock | md5sum > .circleci/bundle_checksum
6969
fi
7070
cp .circleci/bundle_checksum /usr/local/bundle/bundle_checksum
7171
step_bundle_install: &step_bundle_install
@@ -96,7 +96,7 @@ step_compute_bundle_checksum: &step_compute_bundle_checksum
9696
# updating the gemset lock files produces extremely large commits.
9797
command: |
9898
bundle lock # Create Gemfile.lock
99-
cat Gemfile Gemfile.lock Appraisals gemfiles/*.gemfile gemfiles/*.gemfile.lock | md5sum > .circleci/bundle_checksum
99+
cat Gemfile Gemfile.lock ruby-*.gemfile gemfiles/*.gemfile gemfiles/*.gemfile.lock | md5sum > .circleci/bundle_checksum
100100
step_get_test_agent_trace_check_results: &step_get_test_agent_trace_check_results
101101
run:
102102
name: Get APM Test Agent Trace Check Results

.github/workflows/test-memory-leaks.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ jobs:
77
- uses: actions/checkout@v4
88
- uses: ruby/setup-ruby@v1
99
with:
10-
ruby-version: 3.4.0-preview2 # TODO: Use stable version once 3.4 is out
10+
ruby-version: 3.4.1
1111
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
1212
bundler: latest
13-
cache-version: v1 # bump this to invalidate cache
13+
cache-version: v2 # bump this to invalidate cache
1414
- run: sudo apt-get update && (sudo apt-get install -y valgrind || sleep 5 && sudo apt-get install -y valgrind) && valgrind --version
1515
- run: gem update --system 3.5.23 # TODO: This is a workaround for a buggy rubygems in 3.4.0-preview2; remove once stable version 3.4 is out
1616
- run: bundle exec rake compile spec:profiling:memcheck

Steepfile

-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ target :datadog do
8080
ignore 'lib/datadog/core/buffer/thread_safe.rb'
8181
ignore 'lib/datadog/core/chunker.rb'
8282
ignore 'lib/datadog/core/configuration.rb'
83-
ignore 'lib/datadog/core/configuration/agent_settings_resolver.rb'
8483
ignore 'lib/datadog/core/configuration/base.rb'
8584
ignore 'lib/datadog/core/configuration/components.rb'
8685
ignore 'lib/datadog/core/configuration/dependency_resolver.rb'

appraisal/ruby-3.3.rb

-2
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,6 @@
180180
gem 'dalli', '< 3.0.0'
181181
gem 'presto-client', '>= 0.5.14' # Renamed to trino-client in >= 1.0
182182
gem 'qless', '0.12.0'
183-
184-
gem 'racc' # Remove this once graphql resolves issue for ruby 3.3 preview. https://github.com/rmosolgo/graphql-ruby/issues/4650
185183
end
186184

187185
appraise 'core-old' do

appraisal/ruby-3.4.rb

-2
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,6 @@
191191
gem 'dalli', '< 3.0.0'
192192
gem 'presto-client', '>= 0.5.14' # Renamed to trino-client in >= 1.0
193193
gem 'qless', '0.12.0'
194-
195-
gem 'racc' # Remove this once graphql resolves issue for ruby 3.3 preview. https://github.com/rmosolgo/graphql-ruby/issues/4650
196194
end
197195

198196
appraise 'core-old' do

benchmarks/profiler_gc.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def create_profiler
1414

1515
# We take a dummy sample so that the context for the main thread is created, as otherwise the GC profiling methods do
1616
# not create it (because we don't want to do memory allocations in the middle of GC)
17-
Datadog::Profiling::Collectors::ThreadContext::Testing._native_sample(@collector, Thread.current)
17+
Datadog::Profiling::Collectors::ThreadContext::Testing._native_sample(@collector, Thread.current, false)
1818
end
1919

2020
def run_benchmark
@@ -29,7 +29,7 @@ def run_benchmark
2929
x.report('profiler gc') do
3030
Datadog::Profiling::Collectors::ThreadContext::Testing._native_on_gc_start(@collector)
3131
Datadog::Profiling::Collectors::ThreadContext::Testing._native_on_gc_finish(@collector)
32-
Datadog::Profiling::Collectors::ThreadContext::Testing._native_sample_after_gc(@collector, false)
32+
Datadog::Profiling::Collectors::ThreadContext::Testing._native_sample_after_gc(@collector, false, false)
3333
end
3434

3535
x.save! "#{File.basename(__FILE__)}-results.json" unless VALIDATE_BENCHMARK_MODE
@@ -52,7 +52,7 @@ def run_benchmark
5252
estimated_gc_per_minute.times do
5353
Datadog::Profiling::Collectors::ThreadContext::Testing._native_on_gc_start(@collector)
5454
Datadog::Profiling::Collectors::ThreadContext::Testing._native_on_gc_finish(@collector)
55-
Datadog::Profiling::Collectors::ThreadContext::Testing._native_sample_after_gc(@collector, false)
55+
Datadog::Profiling::Collectors::ThreadContext::Testing._native_sample_after_gc(@collector, false, false)
5656
end
5757

5858
@recorder.serialize

benchmarks/profiler_sample_gvl.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def initialize
2727
@target_thread = thread_with_very_deep_stack
2828

2929
# Sample once to trigger thread context creation for all threads (including @target_thread)
30-
Datadog::Profiling::Collectors::ThreadContext::Testing._native_sample(@collector, PROFILER_OVERHEAD_STACK_THREAD)
30+
Datadog::Profiling::Collectors::ThreadContext::Testing._native_sample(@collector, PROFILER_OVERHEAD_STACK_THREAD, false)
3131
end
3232

3333
def create_profiler

benchmarks/profiler_sample_loop_v2.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def run_benchmark
3737
)
3838

3939
x.report("stack collector #{ENV['CONFIG']}") do
40-
Datadog::Profiling::Collectors::ThreadContext::Testing._native_sample(@collector, PROFILER_OVERHEAD_STACK_THREAD)
40+
Datadog::Profiling::Collectors::ThreadContext::Testing._native_sample(@collector, PROFILER_OVERHEAD_STACK_THREAD, false)
4141
end
4242

4343
x.save! "#{File.basename(__FILE__)}-results.json" unless VALIDATE_BENCHMARK_MODE

benchmarks/profiler_sample_serialize.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def run_benchmark
3535
simulate_seconds = 60
3636

3737
(samples_per_second * simulate_seconds).times do
38-
Datadog::Profiling::Collectors::ThreadContext::Testing._native_sample(@collector, PROFILER_OVERHEAD_STACK_THREAD)
38+
Datadog::Profiling::Collectors::ThreadContext::Testing._native_sample(@collector, PROFILER_OVERHEAD_STACK_THREAD, false)
3939
end
4040

4141
@recorder.serialize

docs/Compatibility.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ The Ruby Datadog Trace library is open source. See the [dd-trace-rb][1] GitHub r
99

1010
| Type | Documentation | Version | Support type | Gem version support |
1111
|-------|----------------------------|-----------|---------------------------|---------------------|
12-
| MRI | https://www.ruby-lang.org/ | 3.3 | [latest](#support-latest) | Latest |
12+
| MRI | https://www.ruby-lang.org/ | 3.4 | [latest](#support-latest) | Latest |
13+
| | | 3.3 | [latest](#support-latest) | Latest |
1314
| | | 3.2 | [latest](#support-latest) | Latest |
1415
| | | 3.1 | [latest](#support-latest) | Latest |
1516
| | | 3.0 | [latest](#support-latest) | Latest |

docs/DevelopmentGuide.md

+25-6
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ All tests should run in CI. When adding new `_spec.rb` files, you may need to ad
6565
{
6666
'foo' => {
6767
# With default dependencies for each Ruby runtime
68-
'' => '✅ 2.1 / ✅ 2.2 / ✅ 2.3 / ✅ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ jruby',
68+
'' => '✅ 2.1 / ✅ 2.2 / ✅ 2.3 / ✅ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby',
6969
# or with dependency group definition `foo-on-rails`, that includes additional gems
70-
'foo-on-rails' => '✅ 2.1 / ✅ 2.2 / ✅ 2.3 / ✅ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ jruby'
70+
'foo-on-rails' => '✅ 2.1 / ✅ 2.2 / ✅ 2.3 / ✅ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby'
7171
},
7272
}
7373
```
@@ -98,9 +98,9 @@ Take `bundle exec rake test:redis` as example, multiple versions of `redis` from
9898
```ruby
9999
{
100100
'redis' => {
101-
'redis-3' => '✅ 2.1 / ✅ 2.2 / ✅ 2.3 / ✅ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ jruby',
102-
'redis-4' => '❌ 2.1 / ❌ 2.2 / ❌ 2.3 / ✅ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ jruby',
103-
'redis-5' => '❌ 2.1 / ❌ 2.2 / ❌ 2.3 / ❌ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ jruby'
101+
'redis-3' => '✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby',
102+
'redis-4' => '✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby',
103+
'redis-5' => '✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby'
104104
}
105105
}
106106
```
@@ -223,12 +223,31 @@ https://github.com/datadog/dd-apm-test-agent#readme
223223

224224
**Linting**
225225

226-
The trace library uses Rubocop to enforce [code style](https://github.com/bbatsov/ruby-style-guide) and quality. To check, run:
226+
Most of the library uses Rubocop to enforce [code style](https://github.com/bbatsov/ruby-style-guide) and quality. To check, run:
227227

228228
```
229229
$ bundle exec rake rubocop
230230
```
231231

232+
To change your code to the version that rubocop wants, run:
233+
234+
```
235+
$ bundle exec rake rubocop -A
236+
```
237+
238+
Profiling and Dynamic Instrumentation use [standard](https://github.com/standardrb/standard)
239+
instead of Rubocop. To check files with standard, run:
240+
241+
```
242+
$ bundle exec rake standard
243+
```
244+
245+
To change your code to the version that standard wants, run:
246+
247+
```
248+
$ bundle exec rake standard:fix
249+
```
250+
232251
## Appendix
233252

234253
### Writing new integrations

docs/GettingStarted.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1547,11 +1547,10 @@ Rake::Task['my_task'].invoke
15471547

15481548
| Key | Env Var| Type | Description | Default |
15491549
| -------------- | - | ------- | -------------------------------------------------------------------------------------------------------- | -------- |
1550-
| `enabled` | | `Bool` | Defines whether Rake tasks should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
1550+
| `enabled` | `DD_TRACE_RAKE_ENABLED` | `Bool` | Defines whether Rake tasks should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
15511551
| `quantize` | | `Hash` | Hash containing options for quantization of task arguments. See below for more details and examples. | `{}` |
15521552
| `service_name` | | `String` | Service name used for `rake` instrumentation | `'rake'` |
15531553
| `tasks` | | `Array` | Names of the Rake tasks to instrument | `[]` |
1554-
| `enabled` | `DD_TRACE_RAKE_ENABLED` | `Bool` | Whether the integration should create spans. | `true` |
15551554

15561555
**Configuring task quantization behavior**
15571556

ext/datadog_profiling_native_extension/clock_id.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
#include <ruby.h>
66

77
// Contains the operating-system specific identifier needed to fetch CPU-time, and a flag to indicate if we failed to fetch it
8-
typedef struct thread_cpu_time_id {
8+
typedef struct {
99
bool valid;
1010
clockid_t clock_id;
1111
} thread_cpu_time_id;
1212

1313
// Contains the current cpu time, and a flag to indicate if we failed to fetch it
14-
typedef struct thread_cpu_time {
14+
typedef struct {
1515
bool valid;
1616
long result_ns;
1717
} thread_cpu_time;

0 commit comments

Comments
 (0)