ddtrace 1.20.0 → 1.22.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +115 -1
- data/LICENSE-3rdparty.csv +1 -1
- data/bin/ddprofrb +15 -0
- data/bin/ddtracerb +3 -1
- data/ext/{ddtrace_profiling_loader/ddtrace_profiling_loader.c → datadog_profiling_loader/datadog_profiling_loader.c} +2 -2
- data/ext/{ddtrace_profiling_loader → datadog_profiling_loader}/extconf.rb +3 -3
- data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/collectors_cpu_and_wall_time_worker.c +238 -61
- data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/collectors_discrete_dynamic_sampler.c +145 -72
- data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/collectors_discrete_dynamic_sampler.h +17 -5
- data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/collectors_thread_context.c +97 -4
- data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/extconf.rb +2 -2
- data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/heap_recorder.c +45 -3
- data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/heap_recorder.h +7 -1
- data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/http_transport.c +15 -19
- data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/native_extension_helpers.rb +4 -4
- data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/private_vm_api_access.c +14 -0
- data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/private_vm_api_access.h +4 -0
- data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/profiling.c +1 -1
- data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/ruby_helpers.c +10 -0
- data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/ruby_helpers.h +2 -0
- data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/stack_recorder.c +7 -9
- data/lib/datadog/appsec/contrib/rack/request_middleware.rb +43 -13
- data/lib/datadog/appsec/event.rb +1 -1
- data/lib/datadog/auto_instrument.rb +3 -0
- data/lib/datadog/core/configuration/components.rb +7 -6
- data/lib/datadog/core/configuration/option.rb +8 -6
- data/lib/datadog/core/configuration/settings.rb +130 -63
- data/lib/datadog/core/configuration.rb +20 -4
- data/lib/datadog/core/diagnostics/environment_logger.rb +4 -3
- data/lib/datadog/core/environment/git.rb +25 -0
- data/lib/datadog/core/environment/identity.rb +18 -48
- data/lib/datadog/core/environment/platform.rb +7 -1
- data/lib/datadog/core/git/ext.rb +2 -23
- data/lib/datadog/core/remote/client/capabilities.rb +1 -1
- data/lib/datadog/core/remote/negotiation.rb +2 -2
- data/lib/datadog/core/remote/transport/http/config.rb +1 -1
- data/lib/datadog/core/remote/worker.rb +7 -4
- 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/transport.rb +9 -4
- data/lib/datadog/core/telemetry/request.rb +59 -0
- data/lib/datadog/core/transport/ext.rb +2 -0
- data/lib/datadog/core/utils/url.rb +25 -0
- data/lib/datadog/profiling/collectors/code_provenance.rb +10 -4
- data/lib/datadog/profiling/collectors/cpu_and_wall_time_worker.rb +31 -0
- data/lib/datadog/profiling/collectors/info.rb +101 -0
- data/lib/datadog/profiling/component.rb +34 -28
- data/lib/datadog/profiling/exporter.rb +19 -5
- data/lib/datadog/profiling/ext.rb +2 -0
- data/lib/datadog/profiling/flush.rb +6 -3
- data/lib/datadog/profiling/http_transport.rb +5 -1
- data/lib/datadog/profiling/load_native_extension.rb +19 -6
- data/lib/datadog/profiling/native_extension.rb +1 -1
- data/lib/datadog/profiling/tag_builder.rb +5 -0
- data/lib/datadog/profiling/tasks/exec.rb +3 -3
- data/lib/datadog/profiling/tasks/help.rb +3 -3
- data/lib/datadog/profiling.rb +13 -2
- data/lib/datadog/tracing/contrib/action_mailer/events/deliver.rb +1 -1
- data/lib/datadog/tracing/contrib/active_record/configuration/resolver.rb +11 -4
- data/lib/datadog/tracing/contrib/concurrent_ruby/async_patch.rb +20 -0
- data/lib/datadog/tracing/contrib/concurrent_ruby/patcher.rb +11 -1
- data/lib/datadog/tracing/contrib/configurable.rb +1 -1
- data/lib/datadog/tracing/contrib/extensions.rb +6 -2
- data/lib/datadog/tracing/contrib/pg/instrumentation.rb +11 -4
- data/lib/datadog/tracing/sampling/matcher.rb +23 -3
- data/lib/datadog/tracing/sampling/rule.rb +7 -2
- data/lib/datadog/tracing/sampling/rule_sampler.rb +2 -0
- data/lib/datadog/tracing/trace_operation.rb +1 -2
- data/lib/datadog/tracing/transport/http.rb +1 -0
- data/lib/datadog/tracing/transport/trace_formatter.rb +31 -0
- data/lib/ddtrace/version.rb +1 -1
- metadata +55 -62
- data/ext/ddtrace_profiling_native_extension/pid_controller.c +0 -57
- data/ext/ddtrace_profiling_native_extension/pid_controller.h +0 -45
- data/lib/datadog/core/telemetry/collector.rb +0 -250
- data/lib/datadog/core/telemetry/v1/app_event.rb +0 -59
- data/lib/datadog/core/telemetry/v1/application.rb +0 -92
- data/lib/datadog/core/telemetry/v1/configuration.rb +0 -25
- data/lib/datadog/core/telemetry/v1/dependency.rb +0 -43
- 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 -64
- data/lib/datadog/core/telemetry/v1/product.rb +0 -36
- data/lib/datadog/core/telemetry/v1/telemetry_request.rb +0 -106
- data/lib/datadog/core/telemetry/v2/app_client_configuration_change.rb +0 -41
- data/lib/datadog/core/telemetry/v2/request.rb +0 -29
- data/lib/datadog/profiling/diagnostics/environment_logger.rb +0 -39
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/NativeExtensionDesign.md +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/clock_id.h +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/clock_id_from_pthread.c +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/clock_id_noop.c +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/collectors_dynamic_sampling_rate.c +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/collectors_dynamic_sampling_rate.h +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/collectors_gc_profiling_helper.c +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/collectors_gc_profiling_helper.h +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/collectors_idle_sampling_helper.c +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/collectors_idle_sampling_helper.h +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/collectors_stack.c +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/collectors_stack.h +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/collectors_thread_context.h +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/helpers.h +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/libdatadog_helpers.c +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/libdatadog_helpers.h +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/setup_signal_handler.c +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/setup_signal_handler.h +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/stack_recorder.h +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/time_helpers.c +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/time_helpers.h +0 -0
@@ -168,8 +168,12 @@ module Datadog
|
|
168
168
|
integration
|
169
169
|
end
|
170
170
|
|
171
|
-
|
172
|
-
|
171
|
+
def use(integration_name, options = {}, &block)
|
172
|
+
Core.log_deprecation do
|
173
|
+
'Configuration with `use` has been deprecated, use `instrument` instead.'
|
174
|
+
end
|
175
|
+
instrument(integration_name, options, &block)
|
176
|
+
end
|
173
177
|
|
174
178
|
# For the provided `integration_name`, resolves a matching configuration
|
175
179
|
# for the provided integration from an integration-specific `key`.
|
@@ -125,15 +125,22 @@ module Datadog
|
|
125
125
|
end
|
126
126
|
|
127
127
|
# Read metadata from PG::Result
|
128
|
+
#
|
129
|
+
# It is important to guard with `nil` check, because it is possible
|
130
|
+
# the result is `nil` instead of `PG::Result`.
|
131
|
+
#
|
132
|
+
# A non-null pointer will generally be returned except in out-of-memory conditions or
|
133
|
+
# serious errors such as inability to send the command to the server.
|
134
|
+
#
|
135
|
+
# see: https://www.postgresql.org/docs/current/libpq-exec.html#LIBPQ-PQEXEC
|
128
136
|
if block
|
129
137
|
yield(propagated_sql_statement, proc do |result|
|
130
|
-
|
131
|
-
|
132
|
-
ret
|
138
|
+
annotate_span_with_result!(span, result) if result
|
139
|
+
block.call(result)
|
133
140
|
end)
|
134
141
|
else
|
135
142
|
result = yield(propagated_sql_statement)
|
136
|
-
annotate_span_with_result!(span, result)
|
143
|
+
annotate_span_with_result!(span, result) if result
|
137
144
|
result
|
138
145
|
end
|
139
146
|
end
|
@@ -29,20 +29,40 @@ module Datadog
|
|
29
29
|
end
|
30
30
|
end.new
|
31
31
|
|
32
|
-
attr_reader :name, :service
|
32
|
+
attr_reader :name, :service, :resource, :tags
|
33
33
|
|
34
34
|
# @param name [String,Regexp,Proc] Matcher for case equality (===) with the trace name,
|
35
35
|
# defaults to always match
|
36
36
|
# @param service [String,Regexp,Proc] Matcher for case equality (===) with the service name,
|
37
37
|
# defaults to always match
|
38
|
-
|
38
|
+
# @param resource [String,Regexp,Proc] Matcher for case equality (===) with the resource name,
|
39
|
+
# defaults to always match
|
40
|
+
def initialize(name: MATCH_ALL, service: MATCH_ALL, resource: MATCH_ALL, tags: {})
|
39
41
|
super()
|
40
42
|
@name = name
|
41
43
|
@service = service
|
44
|
+
@resource = resource
|
45
|
+
@tags = tags
|
42
46
|
end
|
43
47
|
|
44
48
|
def match?(trace)
|
45
|
-
name === trace.name && service === trace.service
|
49
|
+
name === trace.name && service === trace.service && resource === trace.resource && tags_match?(trace)
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
# Match against the trace tags and metrics.
|
55
|
+
def tags_match?(trace)
|
56
|
+
@tags.all? do |name, matcher|
|
57
|
+
tag = trace.get_tag(name)
|
58
|
+
|
59
|
+
# Format metrics as strings, to allow for partial number matching (/4.*/ matching '400', '404', etc.).
|
60
|
+
# Because metrics are floats, we use the '%g' format specifier to avoid trailing zeros, which
|
61
|
+
# can affect exact string matching (e.g. '400' matching '400.0').
|
62
|
+
tag = format('%g', tag) if tag.is_a?(Numeric)
|
63
|
+
|
64
|
+
matcher === tag
|
65
|
+
end
|
46
66
|
end
|
47
67
|
end
|
48
68
|
|
@@ -51,8 +51,13 @@ module Datadog
|
|
51
51
|
# @param name [String,Regexp,Proc] Matcher for case equality (===) with the trace name, defaults to always match
|
52
52
|
# @param service [String,Regexp,Proc] Matcher for case equality (===) with the service name,
|
53
53
|
# defaults to always match
|
54
|
+
# @param resource [String,Regexp,Proc] Matcher for case equality (===) with the resource name,
|
55
|
+
# defaults to always match
|
54
56
|
# @param sample_rate [Float] Sampling rate between +[0,1]+
|
55
|
-
def initialize(
|
57
|
+
def initialize(
|
58
|
+
name: SimpleMatcher::MATCH_ALL, service: SimpleMatcher::MATCH_ALL,
|
59
|
+
resource: SimpleMatcher::MATCH_ALL, tags: {}, sample_rate: 1.0
|
60
|
+
)
|
56
61
|
# We want to allow 0.0 to drop all traces, but {Datadog::Tracing::Sampling::RateSampler}
|
57
62
|
# considers 0.0 an invalid rate and falls back to 100% sampling.
|
58
63
|
#
|
@@ -64,7 +69,7 @@ module Datadog
|
|
64
69
|
sampler = RateSampler.new
|
65
70
|
sampler.sample_rate = sample_rate
|
66
71
|
|
67
|
-
super(SimpleMatcher.new(name: name, service: service), sampler)
|
72
|
+
super(SimpleMatcher.new(name: name, service: service, resource: resource, tags: tags), sampler)
|
68
73
|
end
|
69
74
|
end
|
70
75
|
end
|
@@ -137,13 +137,12 @@ module Datadog
|
|
137
137
|
end
|
138
138
|
|
139
139
|
def keep!
|
140
|
-
self.sampled = true
|
141
140
|
self.sampling_priority = Sampling::Ext::Priority::USER_KEEP
|
142
141
|
set_tag(Tracing::Metadata::Ext::Distributed::TAG_DECISION_MAKER, Tracing::Sampling::Ext::Decision::MANUAL)
|
142
|
+
self.sampled = true # Just in case the in-app sampler had decided to drop this span, we revert that decision.
|
143
143
|
end
|
144
144
|
|
145
145
|
def reject!
|
146
|
-
self.sampled = false
|
147
146
|
self.sampling_priority = Sampling::Ext::Priority::USER_REJECT
|
148
147
|
set_tag(Tracing::Metadata::Ext::Distributed::TAG_DECISION_MAKER, Tracing::Sampling::Ext::Decision::MANUAL)
|
149
148
|
end
|
@@ -71,6 +71,7 @@ module Datadog
|
|
71
71
|
Datadog::Core::Transport::Ext::HTTP::HEADER_META_LANG_VERSION => Datadog::Core::Environment::Ext::LANG_VERSION,
|
72
72
|
Datadog::Core::Transport::Ext::HTTP::HEADER_META_LANG_INTERPRETER =>
|
73
73
|
Datadog::Core::Environment::Ext::LANG_INTERPRETER,
|
74
|
+
Datadog::Core::Transport::Ext::HTTP::HEADER_META_LANG_INTERPRETER_VENDOR => Core::Environment::Ext::LANG_ENGINE,
|
74
75
|
Datadog::Core::Transport::Ext::HTTP::HEADER_META_TRACER_VERSION =>
|
75
76
|
Datadog::Core::Environment::Ext::TRACER_VERSION
|
76
77
|
}.tap do |headers|
|
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
require_relative '../../core/environment/identity'
|
4
4
|
require_relative '../../core/environment/socket'
|
5
|
+
require_relative '../../core/environment/git'
|
6
|
+
require_relative '../../core/git/ext'
|
5
7
|
require_relative '../../core/runtime/ext'
|
6
8
|
require_relative '../metadata/ext'
|
7
9
|
require_relative '../trace_segment'
|
@@ -13,6 +15,7 @@ module Datadog
|
|
13
15
|
class TraceFormatter
|
14
16
|
attr_reader \
|
15
17
|
:root_span,
|
18
|
+
:first_span,
|
16
19
|
:trace
|
17
20
|
|
18
21
|
def self.format!(trace)
|
@@ -22,6 +25,9 @@ module Datadog
|
|
22
25
|
def initialize(trace)
|
23
26
|
@trace = trace
|
24
27
|
@root_span = find_root_span(trace)
|
28
|
+
# source code integration uses the "first span in trace chunk" concept instead of root span
|
29
|
+
# see: https://github.com/DataDog/dd-trace-rb/pull/3424
|
30
|
+
@first_span = trace.spans.first
|
25
31
|
end
|
26
32
|
|
27
33
|
# Modifies a trace so suitable for transport
|
@@ -54,6 +60,11 @@ module Datadog
|
|
54
60
|
tag_sampling_priority!
|
55
61
|
tag_profiling_enabled!
|
56
62
|
|
63
|
+
if first_span
|
64
|
+
tag_git_repository_url!
|
65
|
+
tag_git_commit_sha!
|
66
|
+
end
|
67
|
+
|
57
68
|
trace
|
58
69
|
end
|
59
70
|
|
@@ -185,6 +196,18 @@ module Datadog
|
|
185
196
|
)
|
186
197
|
end
|
187
198
|
|
199
|
+
def tag_git_repository_url!
|
200
|
+
return if git_repository_url.nil?
|
201
|
+
|
202
|
+
first_span.set_tag(Core::Git::Ext::TAG_REPOSITORY_URL, git_repository_url)
|
203
|
+
end
|
204
|
+
|
205
|
+
def tag_git_commit_sha!
|
206
|
+
return if git_commit_sha.nil?
|
207
|
+
|
208
|
+
first_span.set_tag(Core::Git::Ext::TAG_COMMIT_SHA, git_commit_sha)
|
209
|
+
end
|
210
|
+
|
188
211
|
private
|
189
212
|
|
190
213
|
def partial?
|
@@ -203,6 +226,14 @@ module Datadog
|
|
203
226
|
# when root span is not found, fall back to last span (partial flush)
|
204
227
|
root_span || trace.spans.last
|
205
228
|
end
|
229
|
+
|
230
|
+
def git_repository_url
|
231
|
+
Core::Environment::Git.git_repository_url
|
232
|
+
end
|
233
|
+
|
234
|
+
def git_commit_sha
|
235
|
+
Core::Environment::Git.git_commit_sha
|
236
|
+
end
|
206
237
|
end
|
207
238
|
end
|
208
239
|
end
|
data/lib/ddtrace/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ddtrace
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.22.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Datadog, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|
@@ -58,28 +58,28 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 7.0.0.1.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 7.0.0.1.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: datadog-ci
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
75
|
+
version: 0.8.1
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.
|
82
|
+
version: 0.8.1
|
83
83
|
description: |
|
84
84
|
ddtrace is Datadog's tracing client for Ruby. It is used to trace requests
|
85
85
|
as they flow across web servers, databases and microservices so that developers
|
@@ -88,9 +88,10 @@ email:
|
|
88
88
|
- dev@datadoghq.com
|
89
89
|
executables:
|
90
90
|
- ddtracerb
|
91
|
+
- ddprofrb
|
91
92
|
extensions:
|
92
|
-
- ext/
|
93
|
-
- ext/
|
93
|
+
- ext/datadog_profiling_native_extension/extconf.rb
|
94
|
+
- ext/datadog_profiling_loader/extconf.rb
|
94
95
|
extra_rdoc_files: []
|
95
96
|
files:
|
96
97
|
- CHANGELOG.md
|
@@ -100,47 +101,46 @@ files:
|
|
100
101
|
- LICENSE.BSD3
|
101
102
|
- NOTICE
|
102
103
|
- README.md
|
104
|
+
- bin/ddprofrb
|
103
105
|
- bin/ddtracerb
|
104
|
-
- ext/
|
105
|
-
- ext/
|
106
|
-
- ext/
|
107
|
-
- ext/
|
108
|
-
- ext/
|
109
|
-
- ext/
|
110
|
-
- ext/
|
111
|
-
- ext/
|
112
|
-
- ext/
|
113
|
-
- ext/
|
114
|
-
- ext/
|
115
|
-
- ext/
|
116
|
-
- ext/
|
117
|
-
- ext/
|
118
|
-
- ext/
|
119
|
-
- ext/
|
120
|
-
- ext/
|
121
|
-
- ext/
|
122
|
-
- ext/
|
123
|
-
- ext/
|
124
|
-
- ext/
|
125
|
-
- ext/
|
126
|
-
- ext/
|
127
|
-
- ext/
|
128
|
-
- ext/
|
129
|
-
- ext/
|
130
|
-
- ext/
|
131
|
-
- ext/
|
132
|
-
- ext/
|
133
|
-
- ext/
|
134
|
-
- ext/
|
135
|
-
- ext/
|
136
|
-
- ext/
|
137
|
-
- ext/
|
138
|
-
- ext/
|
139
|
-
- ext/
|
140
|
-
- ext/
|
141
|
-
- ext/
|
142
|
-
- ext/ddtrace_profiling_native_extension/time_helpers.c
|
143
|
-
- ext/ddtrace_profiling_native_extension/time_helpers.h
|
106
|
+
- ext/datadog_profiling_loader/datadog_profiling_loader.c
|
107
|
+
- ext/datadog_profiling_loader/extconf.rb
|
108
|
+
- ext/datadog_profiling_native_extension/NativeExtensionDesign.md
|
109
|
+
- ext/datadog_profiling_native_extension/clock_id.h
|
110
|
+
- ext/datadog_profiling_native_extension/clock_id_from_pthread.c
|
111
|
+
- ext/datadog_profiling_native_extension/clock_id_noop.c
|
112
|
+
- ext/datadog_profiling_native_extension/collectors_cpu_and_wall_time_worker.c
|
113
|
+
- ext/datadog_profiling_native_extension/collectors_discrete_dynamic_sampler.c
|
114
|
+
- ext/datadog_profiling_native_extension/collectors_discrete_dynamic_sampler.h
|
115
|
+
- ext/datadog_profiling_native_extension/collectors_dynamic_sampling_rate.c
|
116
|
+
- ext/datadog_profiling_native_extension/collectors_dynamic_sampling_rate.h
|
117
|
+
- ext/datadog_profiling_native_extension/collectors_gc_profiling_helper.c
|
118
|
+
- ext/datadog_profiling_native_extension/collectors_gc_profiling_helper.h
|
119
|
+
- ext/datadog_profiling_native_extension/collectors_idle_sampling_helper.c
|
120
|
+
- ext/datadog_profiling_native_extension/collectors_idle_sampling_helper.h
|
121
|
+
- ext/datadog_profiling_native_extension/collectors_stack.c
|
122
|
+
- ext/datadog_profiling_native_extension/collectors_stack.h
|
123
|
+
- ext/datadog_profiling_native_extension/collectors_thread_context.c
|
124
|
+
- ext/datadog_profiling_native_extension/collectors_thread_context.h
|
125
|
+
- ext/datadog_profiling_native_extension/extconf.rb
|
126
|
+
- ext/datadog_profiling_native_extension/heap_recorder.c
|
127
|
+
- ext/datadog_profiling_native_extension/heap_recorder.h
|
128
|
+
- ext/datadog_profiling_native_extension/helpers.h
|
129
|
+
- ext/datadog_profiling_native_extension/http_transport.c
|
130
|
+
- ext/datadog_profiling_native_extension/libdatadog_helpers.c
|
131
|
+
- ext/datadog_profiling_native_extension/libdatadog_helpers.h
|
132
|
+
- ext/datadog_profiling_native_extension/native_extension_helpers.rb
|
133
|
+
- ext/datadog_profiling_native_extension/private_vm_api_access.c
|
134
|
+
- ext/datadog_profiling_native_extension/private_vm_api_access.h
|
135
|
+
- ext/datadog_profiling_native_extension/profiling.c
|
136
|
+
- ext/datadog_profiling_native_extension/ruby_helpers.c
|
137
|
+
- ext/datadog_profiling_native_extension/ruby_helpers.h
|
138
|
+
- ext/datadog_profiling_native_extension/setup_signal_handler.c
|
139
|
+
- ext/datadog_profiling_native_extension/setup_signal_handler.h
|
140
|
+
- ext/datadog_profiling_native_extension/stack_recorder.c
|
141
|
+
- ext/datadog_profiling_native_extension/stack_recorder.h
|
142
|
+
- ext/datadog_profiling_native_extension/time_helpers.c
|
143
|
+
- ext/datadog_profiling_native_extension/time_helpers.h
|
144
144
|
- lib/datadog/appsec.rb
|
145
145
|
- lib/datadog/appsec/assets.rb
|
146
146
|
- lib/datadog/appsec/assets/blocked.html
|
@@ -221,6 +221,7 @@ files:
|
|
221
221
|
- lib/datadog/appsec/utils/http.rb
|
222
222
|
- lib/datadog/appsec/utils/http/media_range.rb
|
223
223
|
- lib/datadog/appsec/utils/http/media_type.rb
|
224
|
+
- lib/datadog/auto_instrument.rb
|
224
225
|
- lib/datadog/core.rb
|
225
226
|
- lib/datadog/core/backport.rb
|
226
227
|
- lib/datadog/core/buffer/cruby.rb
|
@@ -245,6 +246,7 @@ files:
|
|
245
246
|
- lib/datadog/core/environment/execution.rb
|
246
247
|
- lib/datadog/core/environment/ext.rb
|
247
248
|
- lib/datadog/core/environment/gc.rb
|
249
|
+
- lib/datadog/core/environment/git.rb
|
248
250
|
- lib/datadog/core/environment/identity.rb
|
249
251
|
- lib/datadog/core/environment/platform.rb
|
250
252
|
- lib/datadog/core/environment/socket.rb
|
@@ -294,7 +296,6 @@ files:
|
|
294
296
|
- lib/datadog/core/runtime/ext.rb
|
295
297
|
- lib/datadog/core/runtime/metrics.rb
|
296
298
|
- lib/datadog/core/telemetry/client.rb
|
297
|
-
- lib/datadog/core/telemetry/collector.rb
|
298
299
|
- lib/datadog/core/telemetry/emitter.rb
|
299
300
|
- lib/datadog/core/telemetry/event.rb
|
300
301
|
- lib/datadog/core/telemetry/ext.rb
|
@@ -304,17 +305,7 @@ files:
|
|
304
305
|
- lib/datadog/core/telemetry/http/ext.rb
|
305
306
|
- lib/datadog/core/telemetry/http/response.rb
|
306
307
|
- lib/datadog/core/telemetry/http/transport.rb
|
307
|
-
- lib/datadog/core/telemetry/
|
308
|
-
- lib/datadog/core/telemetry/v1/application.rb
|
309
|
-
- lib/datadog/core/telemetry/v1/configuration.rb
|
310
|
-
- lib/datadog/core/telemetry/v1/dependency.rb
|
311
|
-
- lib/datadog/core/telemetry/v1/host.rb
|
312
|
-
- lib/datadog/core/telemetry/v1/install_signature.rb
|
313
|
-
- lib/datadog/core/telemetry/v1/integration.rb
|
314
|
-
- lib/datadog/core/telemetry/v1/product.rb
|
315
|
-
- lib/datadog/core/telemetry/v1/telemetry_request.rb
|
316
|
-
- lib/datadog/core/telemetry/v2/app_client_configuration_change.rb
|
317
|
-
- lib/datadog/core/telemetry/v2/request.rb
|
308
|
+
- lib/datadog/core/telemetry/request.rb
|
318
309
|
- lib/datadog/core/transport/ext.rb
|
319
310
|
- lib/datadog/core/transport/http/adapters/net.rb
|
320
311
|
- lib/datadog/core/transport/http/adapters/registry.rb
|
@@ -338,6 +329,7 @@ files:
|
|
338
329
|
- lib/datadog/core/utils/safe_dup.rb
|
339
330
|
- lib/datadog/core/utils/sequence.rb
|
340
331
|
- lib/datadog/core/utils/time.rb
|
332
|
+
- lib/datadog/core/utils/url.rb
|
341
333
|
- lib/datadog/core/vendor/ipaddr.rb
|
342
334
|
- lib/datadog/core/vendor/multipart-post/LICENSE
|
343
335
|
- lib/datadog/core/vendor/multipart-post/multipart.rb
|
@@ -387,10 +379,10 @@ files:
|
|
387
379
|
- lib/datadog/profiling/collectors/cpu_and_wall_time_worker.rb
|
388
380
|
- lib/datadog/profiling/collectors/dynamic_sampling_rate.rb
|
389
381
|
- lib/datadog/profiling/collectors/idle_sampling_helper.rb
|
382
|
+
- lib/datadog/profiling/collectors/info.rb
|
390
383
|
- lib/datadog/profiling/collectors/stack.rb
|
391
384
|
- lib/datadog/profiling/collectors/thread_context.rb
|
392
385
|
- lib/datadog/profiling/component.rb
|
393
|
-
- lib/datadog/profiling/diagnostics/environment_logger.rb
|
394
386
|
- lib/datadog/profiling/exporter.rb
|
395
387
|
- lib/datadog/profiling/ext.rb
|
396
388
|
- lib/datadog/profiling/ext/forking.rb
|
@@ -517,6 +509,7 @@ files:
|
|
517
509
|
- lib/datadog/tracing/contrib/aws/service/sqs.rb
|
518
510
|
- lib/datadog/tracing/contrib/aws/service/states.rb
|
519
511
|
- lib/datadog/tracing/contrib/aws/services.rb
|
512
|
+
- lib/datadog/tracing/contrib/concurrent_ruby/async_patch.rb
|
520
513
|
- lib/datadog/tracing/contrib/concurrent_ruby/configuration/settings.rb
|
521
514
|
- lib/datadog/tracing/contrib/concurrent_ruby/context_composite_executor_service.rb
|
522
515
|
- lib/datadog/tracing/contrib/concurrent_ruby/ext.rb
|
@@ -904,7 +897,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
904
897
|
- !ruby/object:Gem::Version
|
905
898
|
version: 2.0.0
|
906
899
|
requirements: []
|
907
|
-
rubygems_version: 3.
|
900
|
+
rubygems_version: 3.5.3
|
908
901
|
signing_key:
|
909
902
|
specification_version: 4
|
910
903
|
summary: Datadog tracing code for your Ruby applications
|
@@ -1,57 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright 2023 Datadog, Inc
|
3
|
-
*
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
* you may not use this file except in compliance with the License.
|
6
|
-
* You may obtain a copy of the License at
|
7
|
-
*
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
*
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
* See the License for the specific language governing permissions and
|
14
|
-
* limitations under the License.
|
15
|
-
*/
|
16
|
-
|
17
|
-
// Originally imported from https://github.com/DataDog/java-profiler/blob/11fe6206c31a14c6e5134e8401eaec8b22c618d7/ddprof-lib/src/main/cpp/pidController.cpp
|
18
|
-
|
19
|
-
#include "pid_controller.h"
|
20
|
-
|
21
|
-
#include <math.h>
|
22
|
-
|
23
|
-
inline static double computeAlpha(float cutoff) {
|
24
|
-
if (cutoff <= 0)
|
25
|
-
return 1;
|
26
|
-
// α(fₙ) = cos(2πfₙ) - 1 + √( cos(2πfₙ)² - 4 cos(2πfₙ) + 3 )
|
27
|
-
const double c = cos(2 * ((double) M_PI) * cutoff);
|
28
|
-
return c - 1 + sqrt(c * c - 4 * c + 3);
|
29
|
-
}
|
30
|
-
|
31
|
-
void pid_controller_init(pid_controller *controller, u64 target_per_second, double proportional_gain, double integral_gain, double derivative_gain, int sampling_window, double cutoff_secs) {
|
32
|
-
controller->_target = target_per_second * sampling_window;
|
33
|
-
controller->_proportional_gain = proportional_gain;
|
34
|
-
controller->_integral_gain = integral_gain * sampling_window;
|
35
|
-
controller->_derivative_gain = derivative_gain / sampling_window;
|
36
|
-
controller->_alpha = computeAlpha(sampling_window / cutoff_secs);
|
37
|
-
controller->_avg_error= 0;
|
38
|
-
controller->_integral_value = 0;
|
39
|
-
}
|
40
|
-
|
41
|
-
double pid_controller_compute(pid_controller *controller, u64 input, double time_delta_coefficient) {
|
42
|
-
// time_delta_coefficient allows variable sampling window
|
43
|
-
// the values are linearly scaled using that coefficient to reinterpret the given value within the expected sampling window
|
44
|
-
double absolute_error = (((double) controller->_target) - ((double) input)) * time_delta_coefficient;
|
45
|
-
|
46
|
-
double avg_error = (controller->_alpha * absolute_error) + ((1 - controller->_alpha) * controller->_avg_error);
|
47
|
-
double derivative = avg_error - controller->_avg_error;
|
48
|
-
|
49
|
-
// PID formula:
|
50
|
-
// u[k] = Kp e[k] + Ki e_i[k] + Kd e_d[k], control signal
|
51
|
-
double signal = controller->_proportional_gain * absolute_error + controller->_integral_gain * controller->_integral_value + controller->_derivative_gain * derivative;
|
52
|
-
|
53
|
-
controller->_integral_value += absolute_error;
|
54
|
-
controller->_avg_error = avg_error;
|
55
|
-
|
56
|
-
return signal;
|
57
|
-
}
|
@@ -1,45 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright 2023 Datadog, Inc
|
3
|
-
*
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
* you may not use this file except in compliance with the License.
|
6
|
-
* You may obtain a copy of the License at
|
7
|
-
*
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
*
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
* See the License for the specific language governing permissions and
|
14
|
-
* limitations under the License.
|
15
|
-
*/
|
16
|
-
|
17
|
-
// Originally imported from https://github.com/DataDog/java-profiler/blob/11fe6206c31a14c6e5134e8401eaec8b22c618d7/ddprof-lib/src/main/cpp/pidController.h
|
18
|
-
|
19
|
-
#ifndef _PIDCONTROLLER_H
|
20
|
-
#define _PIDCONTROLLER_H
|
21
|
-
|
22
|
-
// From arch.h in java-profiler
|
23
|
-
typedef unsigned long long u64;
|
24
|
-
|
25
|
-
/*
|
26
|
-
* A simple implementation of a PID controller.
|
27
|
-
* Heavily influenced by https://tttapa.github.io/Pages/Arduino/Control-Theory/Motor-Fader/PID-Cpp-Implementation.html
|
28
|
-
*/
|
29
|
-
|
30
|
-
typedef struct {
|
31
|
-
u64 _target;
|
32
|
-
double _proportional_gain;
|
33
|
-
double _derivative_gain;
|
34
|
-
double _integral_gain;
|
35
|
-
double _alpha;
|
36
|
-
|
37
|
-
double _avg_error;
|
38
|
-
long long _integral_value;
|
39
|
-
} pid_controller;
|
40
|
-
|
41
|
-
void pid_controller_init(pid_controller *controller, u64 target_per_second, double proportional_gain, double integral_gain, double derivative_gain, int sampling_window, double cutoff_secs);
|
42
|
-
|
43
|
-
double pid_controller_compute(pid_controller *controller, u64 input, double time_delta_seconds);
|
44
|
-
|
45
|
-
#endif
|