Skip to content

Commit b9185f5

Browse files
authored
Merge branch 'master' into dependabot/github_actions/gh-actions-packages-62e118ac18
2 parents f9d6f18 + 97354cd commit b9185f5

File tree

782 files changed

+3096
-1240
lines changed

Some content is hidden

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

782 files changed

+3096
-1240
lines changed

.rubocop.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,11 @@ Performance/Squeeze: # (new in 1.7)
208208
Enabled: true
209209
Performance/StringInclude: # (new in 1.7)
210210
Enabled: true
211+
# These complain about strings that contain interpolation, demanding
212+
# additional conversion to symbol which is extra overhead:
213+
# https://github.com/rubocop/rubocop/issues/13955
214+
Performance/StringIdentifierArgument:
215+
Enabled: false
211216

212217
# Requires Ruby 2.2
213218
Style/HashSyntax:
@@ -379,6 +384,10 @@ RSpec/DescribeClass:
379384
RSpec/LetSetup:
380385
Enabled: false
381386

387+
# Botches example descriptions. https://github.com/rubocop/rubocop/issues/13956
388+
RSpec/ExampleWording:
389+
Enabled: false
390+
382391
# Identifies where `fetch(key) { value }` can be replaced by `fetch(key, value)`.
383392
# Can't differentiate between `Hash#fetch` and `RailsCache#fetch`,
384393
# passing in wrong parameters to these methods.

.standard_todo.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ ignore:
1010
- Style/TrailingCommaInArrayLiteral
1111
- Style/TrailingCommaInHashLiteral
1212
- Style/StringLiterals
13+
# These complain about strings that contain interpolation, demanding
14+
# additional conversion to symbol which is extra overhead:
15+
# https://github.com/rubocop/rubocop/issues/13955
16+
- Performance/StringIdentifierArgument
1317

1418
# This disables standardrb for the rest of dd-trace-rb (other than profiling)
1519
- .pryrc

Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ namespace :test do
3838
RuntimeMatcher.match?(rubies)
3939
end
4040

41-
candidates.each do |group, _|
41+
candidates.each_key do |group|
4242
env = if group.empty?
4343
{}
4444
else

Steepfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ target :datadog do
9595
ignore 'lib/datadog/di/transport/http/api.rb'
9696
ignore 'lib/datadog/di/transport/http/diagnostics.rb'
9797
ignore 'lib/datadog/di/transport/http/input.rb'
98+
# steep thinks the type of the class is 'self', whatever that is,
99+
# and then complains that this type doesn't have any methods including
100+
# language basics like 'send' and 'raise'.
101+
ignore 'lib/datadog/di/probe_notifier_worker.rb'
98102
ignore 'lib/datadog/kit/appsec/events.rb' # disabled because of https://github.com/soutaro/steep/issues/701
99103
ignore 'lib/datadog/kit/identity.rb' # disabled because of https://github.com/soutaro/steep/issues/701
100104
ignore 'lib/datadog/opentelemetry.rb'

benchmarks/profiler_gc.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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, false)
32+
Datadog::Profiling::Collectors::ThreadContext::Testing._native_sample_after_gc(@collector, 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, false)
55+
Datadog::Profiling::Collectors::ThreadContext::Testing._native_sample_after_gc(@collector, false)
5656
end
5757

5858
@recorder.serialize

docs/GettingStarted.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2072,6 +2072,7 @@ For example, if `tracing.sampling.default_rate` is configured by [Remote Configu
20722072
| `tracing.header_tags` | `DD_TRACE_HEADER_TAGS` | `Array` | `nil` | Record HTTP headers as span tags. See [Applying header tags to root spans][header tags] for more information. |
20732073
| `tracing.instrument(<integration-name>, <options...>)` | | | | Activates instrumentation for a specific library. See [Integration instrumentation](#integration-instrumentation) for more details. |
20742074
| `tracing.log_injection` | `DD_LOGS_INJECTION` | `Bool` | `true` | Injects [Trace Correlation](#trace-correlation) information into Rails logs if present. Supports the default logger (`ActiveSupport::TaggedLogging`), `lograge`, and `semantic_logger`. |
2075+
| `tracing.native_span_events` | `DD_TRACE_NATIVE_SPAN_EVENTS` | `Bool` | `false` | Forces the tracer to always send span events with the native span events format, regardless of whether the Agent supports it. This is useful when you want to change the serialization format in Agent-less setups. |
20752076
| `tracing.partial_flush.enabled` | | `Bool` | `false` | Enables or disables partial flushing. Partial flushing submits completed portions of a trace to the agent. Used when tracing instruments long running tasks (e.g. jobs) with many spans. |
20762077
| `tracing.partial_flush.min_spans_threshold` | | `Integer` | `500` | The number of spans that must be completed in a trace before partial flushing submits those completed spans. |
20772078
| `tracing.sampler` | | `Datadog::Tracing::Sampling::Sampler` | `nil` | Advanced usage only. Sets a custom `Datadog::Tracing::Sampling::Sampler` instance. If provided, the tracer will use this sampler to determine sampling behavior. See [Custom sampling](#custom-sampling) for details. |

ext/datadog_profiling_native_extension/collectors_thread_context.c

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ static VALUE _native_initialize(int argc, VALUE *argv, DDTRACE_UNUSED VALUE _sel
212212
static VALUE _native_sample(VALUE self, VALUE collector_instance, VALUE profiler_overhead_stack_thread, VALUE allow_exception);
213213
static VALUE _native_on_gc_start(VALUE self, VALUE collector_instance);
214214
static VALUE _native_on_gc_finish(VALUE self, VALUE collector_instance);
215-
static VALUE _native_sample_after_gc(DDTRACE_UNUSED VALUE self, VALUE collector_instance, VALUE reset_monotonic_to_system_state, VALUE allow_exception);
215+
static VALUE _native_sample_after_gc(DDTRACE_UNUSED VALUE self, VALUE collector_instance, VALUE allow_exception);
216216
static void update_metrics_and_sample(
217217
thread_context_collector_state *state,
218218
VALUE thread_being_sampled,
@@ -297,6 +297,7 @@ static void otel_without_ddtrace_trace_identifiers_for(
297297
static otel_span otel_span_from(VALUE otel_context, VALUE otel_current_span_key);
298298
static uint64_t otel_span_id_to_uint(VALUE otel_span_id);
299299
static VALUE safely_lookup_hash_without_going_into_ruby_code(VALUE hash, VALUE key);
300+
static VALUE _native_reset_monotonic_to_system_state(DDTRACE_UNUSED VALUE self, VALUE collector_instance);
300301

301302
void collectors_thread_context_init(VALUE profiling_module) {
302303
VALUE collectors_module = rb_define_module_under(profiling_module, "Collectors");
@@ -321,13 +322,14 @@ void collectors_thread_context_init(VALUE profiling_module) {
321322
rb_define_singleton_method(testing_module, "_native_sample_allocation", _native_sample_allocation, 3);
322323
rb_define_singleton_method(testing_module, "_native_on_gc_start", _native_on_gc_start, 1);
323324
rb_define_singleton_method(testing_module, "_native_on_gc_finish", _native_on_gc_finish, 1);
324-
rb_define_singleton_method(testing_module, "_native_sample_after_gc", _native_sample_after_gc, 3);
325+
rb_define_singleton_method(testing_module, "_native_sample_after_gc", _native_sample_after_gc, 2);
325326
rb_define_singleton_method(testing_module, "_native_thread_list", _native_thread_list, 0);
326327
rb_define_singleton_method(testing_module, "_native_per_thread_context", _native_per_thread_context, 1);
327328
rb_define_singleton_method(testing_module, "_native_stats", _native_stats, 1);
328329
rb_define_singleton_method(testing_module, "_native_gc_tracking", _native_gc_tracking, 1);
329330
rb_define_singleton_method(testing_module, "_native_new_empty_thread", _native_new_empty_thread, 0);
330331
rb_define_singleton_method(testing_module, "_native_sample_skipped_allocation_samples", _native_sample_skipped_allocation_samples, 2);
332+
rb_define_singleton_method(testing_module, "_native_reset_monotonic_to_system_state", _native_reset_monotonic_to_system_state, 1);
331333
#ifndef NO_GVL_INSTRUMENTATION
332334
rb_define_singleton_method(testing_module, "_native_on_gvl_waiting", _native_on_gvl_waiting, 1);
333335
rb_define_singleton_method(testing_module, "_native_gvl_waiting_at_for", _native_gvl_waiting_at_for, 1);
@@ -551,19 +553,9 @@ static VALUE _native_on_gc_finish(DDTRACE_UNUSED VALUE self, VALUE collector_ins
551553
return Qtrue;
552554
}
553555

554-
// This method exists only to enable testing Datadog::Profiling::Collectors::ThreadContext behavior using RSpec.
555-
// It SHOULD NOT be used for other purposes.
556-
static VALUE _native_sample_after_gc(DDTRACE_UNUSED VALUE self, VALUE collector_instance, VALUE reset_monotonic_to_system_state, VALUE allow_exception) {
557-
ENFORCE_BOOLEAN(reset_monotonic_to_system_state);
556+
static VALUE _native_sample_after_gc(DDTRACE_UNUSED VALUE self, VALUE collector_instance, VALUE allow_exception) {
558557
ENFORCE_BOOLEAN(allow_exception);
559558

560-
thread_context_collector_state *state;
561-
TypedData_Get_Struct(collector_instance, thread_context_collector_state, &thread_context_collector_typed_data, state);
562-
563-
if (reset_monotonic_to_system_state == Qtrue) {
564-
state->time_converter_state = (monotonic_to_system_epoch_state) MONOTONIC_TO_SYSTEM_EPOCH_INITIALIZER;
565-
}
566-
567559
if (allow_exception == Qfalse) debug_enter_unsafe_context();
568560

569561
thread_context_collector_sample_after_gc(collector_instance);
@@ -2167,3 +2159,12 @@ static VALUE safely_lookup_hash_without_going_into_ruby_code(VALUE hash, VALUE k
21672159

21682160
return state.result;
21692161
}
2162+
2163+
static VALUE _native_reset_monotonic_to_system_state(DDTRACE_UNUSED VALUE self, VALUE collector_instance) {
2164+
thread_context_collector_state *state;
2165+
TypedData_Get_Struct(collector_instance, thread_context_collector_state, &thread_context_collector_typed_data, state);
2166+
2167+
state->time_converter_state = (monotonic_to_system_epoch_state) MONOTONIC_TO_SYSTEM_EPOCH_INITIALIZER;
2168+
2169+
return Qtrue;
2170+
}

gemfiles/jruby_9.2_activesupport.gemfile

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gemfiles/jruby_9.2_aws.gemfile

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gemfiles/jruby_9.2_contrib.gemfile

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)