datadog 2.44.0 → 2.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +26 -1
- data/ext/datadog_profiling_native_extension/collectors_cpu_and_wall_time_worker.c +114 -141
- data/ext/datadog_profiling_native_extension/collectors_discrete_dynamic_sampler.c +1 -5
- data/ext/datadog_profiling_native_extension/collectors_gc_profiling_helper.c +0 -2
- data/ext/datadog_profiling_native_extension/collectors_idle_sampling_helper.c +13 -13
- data/ext/datadog_profiling_native_extension/collectors_idle_sampling_helper.h +5 -1
- data/ext/datadog_profiling_native_extension/collectors_stack.c +1 -0
- data/ext/datadog_profiling_native_extension/collectors_thread_context.c +106 -103
- data/ext/datadog_profiling_native_extension/collectors_thread_context.h +3 -3
- data/ext/datadog_profiling_native_extension/extconf.rb +2 -0
- data/ext/datadog_profiling_native_extension/heap_recorder.c +2 -2
- data/ext/datadog_profiling_native_extension/private_vm_api_access.c +98 -54
- data/ext/datadog_profiling_native_extension/private_vm_api_access.h +5 -2
- data/ext/datadog_profiling_native_extension/profiling.c +21 -23
- data/ext/datadog_profiling_native_extension/ruby_helpers.c +3 -1
- data/ext/datadog_profiling_native_extension/ruby_helpers.h +4 -0
- data/ext/datadog_profiling_native_extension/setup_signal_handler.c +0 -2
- data/ext/datadog_profiling_native_extension/stack_recorder.c +6 -24
- data/ext/datadog_profiling_native_extension/stack_recorder.h +0 -1
- data/ext/datadog_profiling_native_extension/time_helpers.c +2 -4
- data/ext/datadog_profiling_native_extension/time_helpers.h +10 -11
- data/ext/libdatadog_api/trace_exporter.c +77 -11
- data/ext/libdatadog_extconf_helpers.rb +1 -1
- data/lib/datadog/profiling/collectors/cpu_and_wall_time_worker.rb +5 -0
- data/lib/datadog/profiling/component.rb +2 -3
- data/lib/datadog/profiling/exporter.rb +7 -5
- data/lib/datadog/tracing/component.rb +1 -1
- data/lib/datadog/tracing/configuration/settings.rb +3 -2
- data/lib/datadog/tracing/contrib/utils/quantization/http.rb +6 -3
- data/lib/datadog/tracing/diagnostics/environment_logger.rb +1 -0
- data/lib/datadog/tracing/transport/native.rb +22 -21
- data/lib/datadog/version.rb +1 -1
- metadata +5 -5
|
@@ -34,6 +34,7 @@ static VALUE _native_from_span(VALUE klass, VALUE span);
|
|
|
34
34
|
|
|
35
35
|
/* TraceExporter methods */
|
|
36
36
|
static VALUE _native_exporter_new(int argc, VALUE *argv, VALUE klass);
|
|
37
|
+
static VALUE _native_close(VALUE self);
|
|
37
38
|
static VALUE _native_send_traces(VALUE self, VALUE traces, VALUE native_events_supported);
|
|
38
39
|
static VALUE _native_before_fork(VALUE self);
|
|
39
40
|
static VALUE _native_after_fork_in_parent(VALUE self);
|
|
@@ -1410,9 +1411,10 @@ static VALUE create_ok_response(long trace_count, VALUE payload) {
|
|
|
1410
1411
|
* TraceExporter._native_new(
|
|
1411
1412
|
* url:, tracer_version: nil, language: nil, language_version: nil,
|
|
1412
1413
|
* language_interpreter: nil, hostname: nil, env: nil,
|
|
1413
|
-
* service: nil, version: nil
|
|
1414
|
+
* service: nil, version: nil, client_computed_stats: false,
|
|
1415
|
+
* timeout_milliseconds: nil) -> TraceExporter
|
|
1414
1416
|
*
|
|
1415
|
-
* +url+ is required (String).
|
|
1417
|
+
* +url+ is required (String). Metadata arguments may be nil.
|
|
1416
1418
|
* ======================================================================== */
|
|
1417
1419
|
|
|
1418
1420
|
static VALUE _native_exporter_new(
|
|
@@ -1431,6 +1433,8 @@ static VALUE _native_exporter_new(
|
|
|
1431
1433
|
VALUE rb_env = rb_hash_fetch(options, ID2SYM(rb_intern("env")));
|
|
1432
1434
|
VALUE rb_service = rb_hash_fetch(options, ID2SYM(rb_intern("service")));
|
|
1433
1435
|
VALUE rb_version = rb_hash_fetch(options, ID2SYM(rb_intern("version")));
|
|
1436
|
+
VALUE rb_client_computed_stats = rb_hash_lookup2(options, ID2SYM(rb_intern("client_computed_stats")), Qfalse);
|
|
1437
|
+
VALUE rb_timeout_milliseconds = rb_hash_lookup2(options, ID2SYM(rb_intern("timeout_milliseconds")), Qnil);
|
|
1434
1438
|
|
|
1435
1439
|
/* Phase 1: validate types (may raise, no Rust resources yet) */
|
|
1436
1440
|
ENFORCE_TYPE(rb_url, T_STRING);
|
|
@@ -1442,6 +1446,20 @@ static VALUE _native_exporter_new(
|
|
|
1442
1446
|
if (rb_env != Qnil) ENFORCE_TYPE(rb_env, T_STRING);
|
|
1443
1447
|
if (rb_service != Qnil) ENFORCE_TYPE(rb_service, T_STRING);
|
|
1444
1448
|
if (rb_version != Qnil) ENFORCE_TYPE(rb_version, T_STRING);
|
|
1449
|
+
if (rb_client_computed_stats != Qtrue && rb_client_computed_stats != Qfalse) {
|
|
1450
|
+
rb_raise(rb_eTypeError, "client_computed_stats must be true or false");
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
long long timeout_milliseconds = 0;
|
|
1454
|
+
if (rb_timeout_milliseconds != Qnil) {
|
|
1455
|
+
if (!RB_TYPE_P(rb_timeout_milliseconds, T_FIXNUM) && !RB_TYPE_P(rb_timeout_milliseconds, T_BIGNUM)) {
|
|
1456
|
+
rb_raise(rb_eTypeError, "timeout_milliseconds must be an Integer or nil");
|
|
1457
|
+
}
|
|
1458
|
+
timeout_milliseconds = NUM2LL(rb_timeout_milliseconds);
|
|
1459
|
+
if (timeout_milliseconds < 0) {
|
|
1460
|
+
rb_raise(rb_eRangeError, "timeout_milliseconds must be non-negative");
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1445
1463
|
|
|
1446
1464
|
/* Phase 2: configure before creating the separately-owned runtime. */
|
|
1447
1465
|
ddog_TraceExporterConfig *config = NULL;
|
|
@@ -1457,6 +1475,22 @@ static VALUE _native_exporter_new(
|
|
|
1457
1475
|
set_config_field(config, ddog_trace_exporter_config_set_service, rb_service, "service");
|
|
1458
1476
|
set_config_field(config, ddog_trace_exporter_config_set_version, rb_version, "version");
|
|
1459
1477
|
|
|
1478
|
+
if (rb_timeout_milliseconds != Qnil) {
|
|
1479
|
+
ddog_TraceExporterError *timeout_err = ddog_trace_exporter_config_set_connection_timeout(
|
|
1480
|
+
config, (uint64_t)timeout_milliseconds);
|
|
1481
|
+
if (timeout_err != NULL) {
|
|
1482
|
+
ddog_trace_exporter_config_free(config);
|
|
1483
|
+
check_exporter_error("Failed to configure native transport timeout", timeout_err);
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1487
|
+
ddog_TraceExporterError *stats_err = ddog_trace_exporter_config_set_client_computed_stats(
|
|
1488
|
+
config, rb_client_computed_stats == Qtrue);
|
|
1489
|
+
if (stats_err != NULL) {
|
|
1490
|
+
ddog_trace_exporter_config_free(config);
|
|
1491
|
+
check_exporter_error("Failed to configure client-computed stats", stats_err);
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1460
1494
|
/*
|
|
1461
1495
|
* Create a SharedRuntime and attach it to the config before building the
|
|
1462
1496
|
* exporter. The exporter holds a clone of the runtime's Arc; we keep our
|
|
@@ -1511,12 +1545,47 @@ static VALUE _native_exporter_new(
|
|
|
1511
1545
|
* (Puma, Unicorn, Passenger).
|
|
1512
1546
|
* ======================================================================== */
|
|
1513
1547
|
|
|
1548
|
+
static void *close_exporter_without_gvl(void *ptr) {
|
|
1549
|
+
trace_exporter_t *resources = ptr;
|
|
1550
|
+
if (resources->exporter != NULL) {
|
|
1551
|
+
ddog_trace_exporter_free(resources->exporter);
|
|
1552
|
+
resources->exporter = NULL;
|
|
1553
|
+
}
|
|
1554
|
+
if (resources->runtime != NULL) {
|
|
1555
|
+
ddog_shared_runtime_free(resources->runtime);
|
|
1556
|
+
resources->runtime = NULL;
|
|
1557
|
+
}
|
|
1558
|
+
return NULL;
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1561
|
+
static VALUE close_exporter_body(VALUE ptr) {
|
|
1562
|
+
rb_thread_call_without_gvl(close_exporter_without_gvl, (void *)ptr, NULL, NULL);
|
|
1563
|
+
return Qnil;
|
|
1564
|
+
}
|
|
1565
|
+
|
|
1566
|
+
static VALUE close_exporter_ensure(VALUE ptr) {
|
|
1567
|
+
/* An interrupt may arrive before the no-GVL call starts. */
|
|
1568
|
+
close_exporter_without_gvl((void *)ptr);
|
|
1569
|
+
return Qnil;
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1572
|
+
static VALUE _native_close(VALUE self) {
|
|
1573
|
+
trace_exporter_t *wrapper;
|
|
1574
|
+
TypedData_Get_Struct(self, trace_exporter_t, &trace_exporter_typed_data, wrapper);
|
|
1575
|
+
if (wrapper == NULL) return Qnil;
|
|
1576
|
+
|
|
1577
|
+
trace_exporter_t resources = *wrapper;
|
|
1578
|
+
wrapper->exporter = NULL;
|
|
1579
|
+
wrapper->runtime = NULL;
|
|
1580
|
+
rb_ensure(close_exporter_body, (VALUE)&resources, close_exporter_ensure, (VALUE)&resources);
|
|
1581
|
+
RB_GC_GUARD(self);
|
|
1582
|
+
return Qnil;
|
|
1583
|
+
}
|
|
1584
|
+
|
|
1514
1585
|
static VALUE _native_before_fork(VALUE self) {
|
|
1515
1586
|
trace_exporter_t *wrapper;
|
|
1516
1587
|
TypedData_Get_Struct(self, trace_exporter_t, &trace_exporter_typed_data, wrapper);
|
|
1517
|
-
if (wrapper == NULL || wrapper->runtime == NULL)
|
|
1518
|
-
raise_error(rb_eRuntimeError, "TraceExporter has not been initialized or was already freed");
|
|
1519
|
-
}
|
|
1588
|
+
if (wrapper == NULL || wrapper->runtime == NULL) return Qnil;
|
|
1520
1589
|
ddog_SharedRuntimeFFIError *err = ddog_shared_runtime_before_fork(wrapper->runtime);
|
|
1521
1590
|
check_shared_runtime_error("Failed to prepare for fork", err);
|
|
1522
1591
|
return Qnil;
|
|
@@ -1525,9 +1594,7 @@ static VALUE _native_before_fork(VALUE self) {
|
|
|
1525
1594
|
static VALUE _native_after_fork_in_parent(VALUE self) {
|
|
1526
1595
|
trace_exporter_t *wrapper;
|
|
1527
1596
|
TypedData_Get_Struct(self, trace_exporter_t, &trace_exporter_typed_data, wrapper);
|
|
1528
|
-
if (wrapper == NULL || wrapper->runtime == NULL)
|
|
1529
|
-
raise_error(rb_eRuntimeError, "TraceExporter has not been initialized or was already freed");
|
|
1530
|
-
}
|
|
1597
|
+
if (wrapper == NULL || wrapper->runtime == NULL) return Qnil;
|
|
1531
1598
|
ddog_SharedRuntimeFFIError *err = ddog_shared_runtime_after_fork_parent(wrapper->runtime);
|
|
1532
1599
|
check_shared_runtime_error("Failed to restore after fork in parent", err);
|
|
1533
1600
|
return Qnil;
|
|
@@ -1536,9 +1603,7 @@ static VALUE _native_after_fork_in_parent(VALUE self) {
|
|
|
1536
1603
|
static VALUE _native_after_fork_in_child(VALUE self) {
|
|
1537
1604
|
trace_exporter_t *wrapper;
|
|
1538
1605
|
TypedData_Get_Struct(self, trace_exporter_t, &trace_exporter_typed_data, wrapper);
|
|
1539
|
-
if (wrapper == NULL || wrapper->runtime == NULL)
|
|
1540
|
-
raise_error(rb_eRuntimeError, "TraceExporter has not been initialized or was already freed");
|
|
1541
|
-
}
|
|
1606
|
+
if (wrapper == NULL || wrapper->runtime == NULL) return Qnil;
|
|
1542
1607
|
ddog_SharedRuntimeFFIError *err = ddog_shared_runtime_after_fork_child(wrapper->runtime);
|
|
1543
1608
|
check_shared_runtime_error("Failed to restore after fork in child", err);
|
|
1544
1609
|
return Qnil;
|
|
@@ -1848,6 +1913,7 @@ void trace_exporter_init(VALUE tracing_module) {
|
|
|
1848
1913
|
/* Instance: _native_send_traces(traces, native_events_supported) -> Array[Response] */
|
|
1849
1914
|
rb_define_method(trace_exporter_class, "_native_send_traces",
|
|
1850
1915
|
_native_send_traces, 2);
|
|
1916
|
+
rb_define_method(trace_exporter_class, "_native_close", _native_close, 0);
|
|
1851
1917
|
|
|
1852
1918
|
/* Instance: fork safety hooks */
|
|
1853
1919
|
rb_define_method(trace_exporter_class, "_native_before_fork",
|
|
@@ -11,7 +11,7 @@ module Datadog
|
|
|
11
11
|
module LibdatadogExtconfHelpers
|
|
12
12
|
# Used to make sure the correct gem version gets loaded, as extconf.rb does not get run with "bundle exec" and thus
|
|
13
13
|
# may see multiple libdatadog versions. See https://github.com/DataDog/dd-trace-rb/pull/2531 for the horror story.
|
|
14
|
-
LIBDATADOG_VERSION = "~>
|
|
14
|
+
LIBDATADOG_VERSION = "~> 45.0.0.1.0"
|
|
15
15
|
|
|
16
16
|
# Used as an workaround for a limitation with how dynamic linking works in environments where the datadog gem and
|
|
17
17
|
# libdatadog are moved after the extension gets compiled.
|
|
@@ -147,6 +147,11 @@ module Datadog
|
|
|
147
147
|
end
|
|
148
148
|
end
|
|
149
149
|
|
|
150
|
+
# @rbs return: Datadog::Profiling::StackRecorder
|
|
151
|
+
def prepare_serialize
|
|
152
|
+
self.class._native_prepare_serialize(self)
|
|
153
|
+
end
|
|
154
|
+
|
|
150
155
|
#: () -> true
|
|
151
156
|
def reset_after_fork
|
|
152
157
|
self.class._native_reset_after_fork(self)
|
|
@@ -73,7 +73,7 @@ module Datadog
|
|
|
73
73
|
heap_sample_every: heap_sample_every,
|
|
74
74
|
}.freeze
|
|
75
75
|
|
|
76
|
-
exporter = build_profiler_exporter(settings,
|
|
76
|
+
exporter = build_profiler_exporter(settings, worker, internal_metadata: internal_metadata)
|
|
77
77
|
transport = build_profiler_transport(settings, agent_settings)
|
|
78
78
|
scheduler = Profiling::Scheduler.new(exporter: exporter, transport: transport, interval: upload_period_seconds)
|
|
79
79
|
profiler = Profiling::Profiler.new(worker: worker, scheduler: scheduler)
|
|
@@ -109,13 +109,12 @@ module Datadog
|
|
|
109
109
|
)
|
|
110
110
|
end
|
|
111
111
|
|
|
112
|
-
private_class_method def self.build_profiler_exporter(settings,
|
|
112
|
+
private_class_method def self.build_profiler_exporter(settings, worker, internal_metadata:)
|
|
113
113
|
info_collector = Profiling::Collectors::Info.new(settings)
|
|
114
114
|
code_provenance_collector =
|
|
115
115
|
(Profiling::Collectors::CodeProvenance.new if settings.profiling.advanced.code_provenance_enabled)
|
|
116
116
|
|
|
117
117
|
Profiling::Exporter.new(
|
|
118
|
-
pprof_recorder: recorder,
|
|
119
118
|
worker: worker,
|
|
120
119
|
info_collector: info_collector,
|
|
121
120
|
code_provenance_collector: code_provenance_collector,
|
|
@@ -20,7 +20,6 @@ module Datadog
|
|
|
20
20
|
|
|
21
21
|
private
|
|
22
22
|
|
|
23
|
-
attr_reader :pprof_recorder #: Datadog::Profiling::StackRecorder
|
|
24
23
|
# The code provenance collector acts both as collector and as a recorder
|
|
25
24
|
attr_reader :code_provenance_collector #: Datadog::Profiling::Collectors::CodeProvenance?
|
|
26
25
|
attr_reader :minimum_duration_seconds #: ::Integer
|
|
@@ -33,7 +32,6 @@ module Datadog
|
|
|
33
32
|
|
|
34
33
|
public
|
|
35
34
|
|
|
36
|
-
# @rbs pprof_recorder: Datadog::Profiling::StackRecorder
|
|
37
35
|
# @rbs worker: Datadog::Profiling::Collectors::CpuAndWallTimeWorker
|
|
38
36
|
# @rbs info_collector: Datadog::Profiling::Collectors::Info
|
|
39
37
|
# @rbs code_provenance_collector: Datadog::Profiling::Collectors::CodeProvenance?
|
|
@@ -43,7 +41,6 @@ module Datadog
|
|
|
43
41
|
# @rbs sequence_tracker: singleton(Datadog::Profiling::SequenceTracker)
|
|
44
42
|
# @rbs return: void
|
|
45
43
|
def initialize(
|
|
46
|
-
pprof_recorder:,
|
|
47
44
|
worker:,
|
|
48
45
|
info_collector:,
|
|
49
46
|
code_provenance_collector:,
|
|
@@ -52,7 +49,6 @@ module Datadog
|
|
|
52
49
|
time_provider: Time,
|
|
53
50
|
sequence_tracker: Datadog::Profiling::SequenceTracker
|
|
54
51
|
)
|
|
55
|
-
@pprof_recorder = pprof_recorder
|
|
56
52
|
@worker = worker
|
|
57
53
|
@code_provenance_collector = code_provenance_collector
|
|
58
54
|
@minimum_duration_seconds = minimum_duration_seconds
|
|
@@ -68,6 +64,7 @@ module Datadog
|
|
|
68
64
|
|
|
69
65
|
#: () -> Datadog::Profiling::Flush?
|
|
70
66
|
def flush
|
|
67
|
+
pprof_recorder = @worker.prepare_serialize
|
|
71
68
|
worker_stats = @worker.stats_and_reset_not_thread_safe
|
|
72
69
|
serialization_result = pprof_recorder.serialize
|
|
73
70
|
return if serialization_result.nil?
|
|
@@ -111,7 +108,7 @@ module Datadog
|
|
|
111
108
|
worker_stats: worker_stats,
|
|
112
109
|
profile_stats: profile_stats,
|
|
113
110
|
recorder_stats: pprof_recorder.stats,
|
|
114
|
-
gc:
|
|
111
|
+
gc: gc_stats,
|
|
115
112
|
}
|
|
116
113
|
),
|
|
117
114
|
info_json: info_json,
|
|
@@ -131,6 +128,11 @@ module Datadog
|
|
|
131
128
|
|
|
132
129
|
private
|
|
133
130
|
|
|
131
|
+
# @rbs return: Hash[Symbol, Integer | bool]
|
|
132
|
+
def gc_stats
|
|
133
|
+
GC.stat.merge(auto_compact: GC.respond_to?(:auto_compact) && GC.auto_compact)
|
|
134
|
+
end
|
|
135
|
+
|
|
134
136
|
#: (::Time, ::Time) -> bool
|
|
135
137
|
def duration_below_threshold?(start, finish)
|
|
136
138
|
(finish - start) < minimum_duration_seconds
|
|
@@ -106,7 +106,7 @@ module Datadog
|
|
|
106
106
|
return writer
|
|
107
107
|
end
|
|
108
108
|
|
|
109
|
-
if settings.tracing.native_transport && (transport = build_native_transport(agent_settings))
|
|
109
|
+
if !options.key?(:transport) && settings.tracing.native_transport && (transport = build_native_transport(agent_settings))
|
|
110
110
|
options = options.merge(transport: transport)
|
|
111
111
|
end
|
|
112
112
|
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require_relative "../../tracing/configuration/ext"
|
|
4
4
|
require_relative "../../core/environment/variable_helpers"
|
|
5
|
+
require_relative "../../ruby_version"
|
|
5
6
|
require_relative "../contrib/status_range_matcher"
|
|
6
7
|
require_relative "../contrib/status_range_env_parser"
|
|
7
8
|
require_relative "http"
|
|
@@ -496,11 +497,11 @@ module Datadog
|
|
|
496
497
|
#
|
|
497
498
|
# This option is recommended for internal use only.
|
|
498
499
|
#
|
|
499
|
-
# @default `false`
|
|
500
|
+
# @default `true` on CRuby 4.0.0 and later, otherwise `false`
|
|
500
501
|
# @return [Boolean]
|
|
501
502
|
option :native_transport do |o|
|
|
502
503
|
o.env Configuration::Ext::ENV_EXPERIMENTAL_NATIVE_TRANSPORT_ENABLED
|
|
503
|
-
o.default
|
|
504
|
+
o.default { RUBY_ENGINE == "ruby" && RubyVersion.is?(">= 4.0.0") }
|
|
504
505
|
o.type :bool
|
|
505
506
|
end
|
|
506
507
|
|
|
@@ -60,6 +60,8 @@ module Datadog
|
|
|
60
60
|
def query(query, options = {})
|
|
61
61
|
query!(query, options)
|
|
62
62
|
rescue
|
|
63
|
+
return "" if options && options[:obfuscate]
|
|
64
|
+
|
|
63
65
|
options[:placeholder] || PLACEHOLDER
|
|
64
66
|
end
|
|
65
67
|
|
|
@@ -136,7 +138,7 @@ module Datadog
|
|
|
136
138
|
(?:"|%22)?
|
|
137
139
|
)
|
|
138
140
|
(?: # common keys
|
|
139
|
-
(?:old[-_]?|
|
|
141
|
+
(?:old[-_]?|new[-_]?)?p(?:ass)?w(?:or)?d(?:1|2)? # pw, password variants
|
|
140
142
|
|pass(?:[-_]?phrase)? # pass, passphrase variants
|
|
141
143
|
|secret
|
|
142
144
|
|(?: # key, key_id variants
|
|
@@ -145,6 +147,7 @@ module Datadog
|
|
|
145
147
|
|public[-_]?
|
|
146
148
|
|access[-_]?
|
|
147
149
|
|secret[-_]?
|
|
150
|
+
|app(?:lication)?[-_]?
|
|
148
151
|
)key(?:[-_]?id)?
|
|
149
152
|
|token
|
|
150
153
|
|consumer[-_]?(?:id|key|secret)
|
|
@@ -165,9 +168,9 @@ module Datadog
|
|
|
165
168
|
bearer(?:\s|%20)+[a-z0-9._-]+
|
|
166
169
|
|token(?::|%3A)[a-z0-9]{13}
|
|
167
170
|
|gh[opsu]_[0-9a-zA-Z]{36}
|
|
168
|
-
|ey[I-L]
|
|
171
|
+
|(?:^|[^\w%-]|%[0-9a-f]{2})ey[I-L][\w-]+(?:=|%3D)*\.ey[I-L][\w-]+(?:=|%3D)*(?:\.(?:[\w.+/=-]|%3D|%2F|%2B)+)?
|
|
169
172
|
|-{5}BEGIN(?:[a-z\s]|%20)+PRIVATE(?:\s|%20)KEY-{5}[^-]+-{5}END(?:[a-z\s]|%20)+PRIVATE(?:\s|%20)KEY(?:-{5})?(?:\n|%0A)?
|
|
170
|
-
|(?:ssh-(?:rsa|dss)|ecdsa-[a-z0-9]+-[a-z0-9]+)(?:\s|%20)
|
|
173
|
+
|(?:ssh-(?:rsa|dss)|ecdsa-[a-z0-9]+-[a-z0-9]+)(?:\s|%20|%09)+(?:[a-z0-9/.+]|%2F|%5C|%2B){100,}(?:=|%3D)*(?:(?:\s|%20|%09)+[a-z0-9._-]+)?
|
|
171
174
|
)
|
|
172
175
|
}ix.freeze
|
|
173
176
|
# rubocop:enable Layout/LineLength
|
|
@@ -60,6 +60,7 @@ module Datadog
|
|
|
60
60
|
def agent_url
|
|
61
61
|
# Retrieve the effect agent URL, regardless of how it was configured
|
|
62
62
|
transport = Tracing.send(:tracer).writer.transport
|
|
63
|
+
return transport.url if transport.respond_to?(:url)
|
|
63
64
|
|
|
64
65
|
# return `nil` with IO transport
|
|
65
66
|
return unless transport.respond_to?(:client)
|
|
@@ -47,10 +47,10 @@ module Datadog
|
|
|
47
47
|
include Statistics
|
|
48
48
|
include SpanEventsNegotiation
|
|
49
49
|
|
|
50
|
-
attr_reader :logger
|
|
50
|
+
attr_reader :logger, :url
|
|
51
51
|
|
|
52
52
|
# @param agent_settings [Datadog::Core::Configuration::AgentSettingsResolver::AgentSettings]
|
|
53
|
-
# Agent connection settings
|
|
53
|
+
# Agent connection settings, including the request timeout.
|
|
54
54
|
# @param logger [Logger]
|
|
55
55
|
def initialize(agent_settings:, logger:)
|
|
56
56
|
unless Native.supported?
|
|
@@ -67,7 +67,7 @@ module Datadog
|
|
|
67
67
|
# this is held across the fork through the matching completion hook.
|
|
68
68
|
@fork_mutex = Mutex.new
|
|
69
69
|
|
|
70
|
-
url = agent_settings.url
|
|
70
|
+
@url = agent_settings.url
|
|
71
71
|
tracer_version = tracer_version_string
|
|
72
72
|
language = Core::Environment::Ext::LANG
|
|
73
73
|
language_version = Core::Environment::Ext::LANG_VERSION
|
|
@@ -83,6 +83,7 @@ module Datadog
|
|
|
83
83
|
|
|
84
84
|
exporter = Native::TraceExporter._native_new(
|
|
85
85
|
url: url,
|
|
86
|
+
timeout_milliseconds: agent_settings.timeout_seconds * 1000,
|
|
86
87
|
tracer_version: tracer_version,
|
|
87
88
|
language: language,
|
|
88
89
|
language_version: language_version,
|
|
@@ -90,7 +91,8 @@ module Datadog
|
|
|
90
91
|
hostname: hostname,
|
|
91
92
|
env: env,
|
|
92
93
|
service: service,
|
|
93
|
-
version: version
|
|
94
|
+
version: version,
|
|
95
|
+
client_computed_stats: !Datadog.configuration.apm.tracing.enabled
|
|
94
96
|
)
|
|
95
97
|
@exporter = exporter
|
|
96
98
|
|
|
@@ -215,25 +217,24 @@ module Datadog
|
|
|
215
217
|
# native exporter so its runtime can shut down. Idempotent: safe to
|
|
216
218
|
# call multiple times and safe to call after the finalizer has run.
|
|
217
219
|
def close
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
220
|
+
@fork_mutex.synchronize do
|
|
221
|
+
@send_mutex.synchronize do
|
|
222
|
+
hooks = @fork_hooks
|
|
223
|
+
return if hooks.nil?
|
|
224
|
+
|
|
225
|
+
begin
|
|
226
|
+
@exporter&._native_close
|
|
227
|
+
ensure
|
|
228
|
+
@fork_hooks = nil
|
|
229
|
+
@exporter = nil
|
|
230
|
+
hooks.each do |stage, block|
|
|
231
|
+
Core::Utils::AtForkMonkeyPatch.remove_at_fork(stage, block)
|
|
232
|
+
end
|
|
233
|
+
ObjectSpace.undefine_finalizer(self)
|
|
234
|
+
end
|
|
235
|
+
end
|
|
229
236
|
end
|
|
230
237
|
|
|
231
|
-
# The finalizer only exists to deregister the hooks for a transport
|
|
232
|
-
# dropped without #close. We have just done that, so remove it;
|
|
233
|
-
# otherwise its closed-over hook blocks keep the exporter alive until
|
|
234
|
-
# this transport is itself collected.
|
|
235
|
-
ObjectSpace.undefine_finalizer(self)
|
|
236
|
-
|
|
237
238
|
nil
|
|
238
239
|
end
|
|
239
240
|
|
data/lib/datadog/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: datadog
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.45.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Datadog, Inc.
|
|
@@ -63,14 +63,14 @@ dependencies:
|
|
|
63
63
|
requirements:
|
|
64
64
|
- - "~>"
|
|
65
65
|
- !ruby/object:Gem::Version
|
|
66
|
-
version:
|
|
66
|
+
version: 45.0.0.1.0
|
|
67
67
|
type: :runtime
|
|
68
68
|
prerelease: false
|
|
69
69
|
version_requirements: !ruby/object:Gem::Requirement
|
|
70
70
|
requirements:
|
|
71
71
|
- - "~>"
|
|
72
72
|
- !ruby/object:Gem::Version
|
|
73
|
-
version:
|
|
73
|
+
version: 45.0.0.1.0
|
|
74
74
|
- !ruby/object:Gem::Dependency
|
|
75
75
|
name: logger
|
|
76
76
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -1190,8 +1190,8 @@ licenses:
|
|
|
1190
1190
|
- Apache-2.0
|
|
1191
1191
|
metadata:
|
|
1192
1192
|
allowed_push_host: https://rubygems.org
|
|
1193
|
-
changelog_uri: https://github.com/DataDog/dd-trace-rb/blob/v2.
|
|
1194
|
-
source_code_uri: https://github.com/DataDog/dd-trace-rb/tree/v2.
|
|
1193
|
+
changelog_uri: https://github.com/DataDog/dd-trace-rb/blob/v2.45.0/CHANGELOG.md
|
|
1194
|
+
source_code_uri: https://github.com/DataDog/dd-trace-rb/tree/v2.45.0
|
|
1195
1195
|
post_install_message: 'JRuby support in the datadog gem is deprecated. Details: https://dtdg.co/jruby-deprecation'
|
|
1196
1196
|
rdoc_options: []
|
|
1197
1197
|
require_paths:
|