ddtrace 1.20.0 → 1.21.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 +61 -2
- 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 +206 -49
- 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 +92 -2
- data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/extconf.rb +2 -2
- data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/http_transport.c +10 -14
- 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/lib/datadog/core/configuration/components.rb +5 -5
- data/lib/datadog/core/configuration/option.rb +1 -1
- data/lib/datadog/core/configuration/settings.rb +92 -46
- 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/git/ext.rb +2 -23
- data/lib/datadog/core/remote/negotiation.rb +2 -2
- data/lib/datadog/core/remote/worker.rb +7 -4
- data/lib/datadog/core/transport/ext.rb +2 -0
- data/lib/datadog/core/utils/url.rb +25 -0
- data/lib/datadog/profiling/collectors/cpu_and_wall_time_worker.rb +6 -0
- data/lib/datadog/profiling/collectors/info.rb +101 -0
- data/lib/datadog/profiling/component.rb +12 -14
- 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 +5 -5
- 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 +2 -2
- 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/extensions.rb +6 -2
- data/lib/datadog/tracing/contrib/grape/endpoint.rb +5 -0
- data/lib/datadog/tracing/contrib/pg/instrumentation.rb +11 -4
- data/lib/datadog/tracing/contrib/rack/middlewares.rb +28 -4
- data/lib/datadog/tracing/contrib/rails/patcher.rb +16 -0
- data/lib/datadog/tracing/contrib/sinatra/tracer.rb +6 -3
- data/lib/datadog/tracing/metadata/ext.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 +56 -53
- 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/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}/heap_recorder.c +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/heap_recorder.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.c +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
|
@@ -5,11 +5,24 @@ require_relative 'log_injection'
|
|
|
5
5
|
require_relative 'middlewares'
|
|
6
6
|
require_relative 'utils'
|
|
7
7
|
require_relative '../semantic_logger/patcher'
|
|
8
|
+
require_relative 'ext'
|
|
8
9
|
|
|
9
10
|
module Datadog
|
|
10
11
|
module Tracing
|
|
11
12
|
module Contrib
|
|
12
13
|
module Rails
|
|
14
|
+
# Patcher to trace rails routing done by JourneyRouter
|
|
15
|
+
module JourneyRouterPatch
|
|
16
|
+
def find_routes(*args)
|
|
17
|
+
result = super
|
|
18
|
+
integration_route = result.first[2].path.spec.to_s.gsub(/\(\.:format\)/, '') if result.any?
|
|
19
|
+
request_trace = Tracing.active_trace || TraceOperation.new
|
|
20
|
+
request_trace.set_tag(Tracing::Metadata::Ext::HTTP::TAG_ROUTE, integration_route)
|
|
21
|
+
request_trace.set_tag(Tracing::Metadata::Ext::HTTP::TAG_ROUTE_PATH, args.first.env['SCRIPT_NAME'])
|
|
22
|
+
result
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
13
26
|
# Patcher enables patching of 'rails' module.
|
|
14
27
|
module Patcher
|
|
15
28
|
include Contrib::Patcher
|
|
@@ -41,6 +54,9 @@ module Datadog
|
|
|
41
54
|
# Sometimes we don't want to activate middleware e.g. OpenTracing, etc.
|
|
42
55
|
add_middleware(app) if Datadog.configuration.tracing[:rails][:middleware]
|
|
43
56
|
|
|
57
|
+
# ActionDispatch::Journey is not available or incompatible in Rails < 4.2.
|
|
58
|
+
ActionDispatch::Journey::Router.prepend(JourneyRouterPatch) if Integration.version >= Gem::Version.new('4.2')
|
|
59
|
+
|
|
44
60
|
Rails::LogInjection.configure_log_tags(app.config)
|
|
45
61
|
end
|
|
46
62
|
end
|
|
@@ -47,16 +47,16 @@ module Datadog
|
|
|
47
47
|
configuration = Datadog.configuration.tracing[:sinatra]
|
|
48
48
|
return super unless Tracing.enabled?
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
integration_route = Sinatra::Env.route_path(env)
|
|
51
51
|
|
|
52
52
|
Tracing.trace(
|
|
53
53
|
Ext::SPAN_ROUTE,
|
|
54
54
|
service: configuration[:service_name],
|
|
55
55
|
span_type: Tracing::Metadata::Ext::HTTP::TYPE_INBOUND,
|
|
56
|
-
resource: "#{request.request_method} #{
|
|
56
|
+
resource: "#{request.request_method} #{integration_route}",
|
|
57
57
|
) do |span, trace|
|
|
58
58
|
span.set_tag(Ext::TAG_APP_NAME, settings.name || settings.superclass.name)
|
|
59
|
-
span.set_tag(Ext::TAG_ROUTE_PATH,
|
|
59
|
+
span.set_tag(Ext::TAG_ROUTE_PATH, integration_route)
|
|
60
60
|
|
|
61
61
|
if request.script_name && !request.script_name.empty?
|
|
62
62
|
span.set_tag(Ext::TAG_SCRIPT_NAME, request.script_name)
|
|
@@ -73,6 +73,9 @@ module Datadog
|
|
|
73
73
|
|
|
74
74
|
Contrib::Analytics.set_measured(span)
|
|
75
75
|
|
|
76
|
+
_, path = env['sinatra.route'].split(' ', 2)
|
|
77
|
+
trace.set_tag(Tracing::Metadata::Ext::HTTP::TAG_ROUTE, path)
|
|
78
|
+
trace.set_tag(Tracing::Metadata::Ext::HTTP::TAG_ROUTE_PATH, env['SCRIPT_NAME'])
|
|
76
79
|
super
|
|
77
80
|
end
|
|
78
81
|
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.21.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Datadog, Inc.
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-
|
|
11
|
+
date: 2024-03-14 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: 6.0.0.2.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: 6.0.0.2.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
|
|
@@ -245,6 +245,7 @@ files:
|
|
|
245
245
|
- lib/datadog/core/environment/execution.rb
|
|
246
246
|
- lib/datadog/core/environment/ext.rb
|
|
247
247
|
- lib/datadog/core/environment/gc.rb
|
|
248
|
+
- lib/datadog/core/environment/git.rb
|
|
248
249
|
- lib/datadog/core/environment/identity.rb
|
|
249
250
|
- lib/datadog/core/environment/platform.rb
|
|
250
251
|
- lib/datadog/core/environment/socket.rb
|
|
@@ -338,6 +339,7 @@ files:
|
|
|
338
339
|
- lib/datadog/core/utils/safe_dup.rb
|
|
339
340
|
- lib/datadog/core/utils/sequence.rb
|
|
340
341
|
- lib/datadog/core/utils/time.rb
|
|
342
|
+
- lib/datadog/core/utils/url.rb
|
|
341
343
|
- lib/datadog/core/vendor/ipaddr.rb
|
|
342
344
|
- lib/datadog/core/vendor/multipart-post/LICENSE
|
|
343
345
|
- lib/datadog/core/vendor/multipart-post/multipart.rb
|
|
@@ -387,10 +389,10 @@ files:
|
|
|
387
389
|
- lib/datadog/profiling/collectors/cpu_and_wall_time_worker.rb
|
|
388
390
|
- lib/datadog/profiling/collectors/dynamic_sampling_rate.rb
|
|
389
391
|
- lib/datadog/profiling/collectors/idle_sampling_helper.rb
|
|
392
|
+
- lib/datadog/profiling/collectors/info.rb
|
|
390
393
|
- lib/datadog/profiling/collectors/stack.rb
|
|
391
394
|
- lib/datadog/profiling/collectors/thread_context.rb
|
|
392
395
|
- lib/datadog/profiling/component.rb
|
|
393
|
-
- lib/datadog/profiling/diagnostics/environment_logger.rb
|
|
394
396
|
- lib/datadog/profiling/exporter.rb
|
|
395
397
|
- lib/datadog/profiling/ext.rb
|
|
396
398
|
- lib/datadog/profiling/ext/forking.rb
|
|
@@ -517,6 +519,7 @@ files:
|
|
|
517
519
|
- lib/datadog/tracing/contrib/aws/service/sqs.rb
|
|
518
520
|
- lib/datadog/tracing/contrib/aws/service/states.rb
|
|
519
521
|
- lib/datadog/tracing/contrib/aws/services.rb
|
|
522
|
+
- lib/datadog/tracing/contrib/concurrent_ruby/async_patch.rb
|
|
520
523
|
- lib/datadog/tracing/contrib/concurrent_ruby/configuration/settings.rb
|
|
521
524
|
- lib/datadog/tracing/contrib/concurrent_ruby/context_composite_executor_service.rb
|
|
522
525
|
- lib/datadog/tracing/contrib/concurrent_ruby/ext.rb
|
|
@@ -886,7 +889,7 @@ licenses:
|
|
|
886
889
|
metadata:
|
|
887
890
|
allowed_push_host: https://rubygems.org
|
|
888
891
|
changelog_uri: https://github.com/DataDog/dd-trace-rb/blob/master/CHANGELOG.md
|
|
889
|
-
post_install_message:
|
|
892
|
+
post_install_message:
|
|
890
893
|
rdoc_options: []
|
|
891
894
|
require_paths:
|
|
892
895
|
- lib
|
|
@@ -904,8 +907,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
904
907
|
- !ruby/object:Gem::Version
|
|
905
908
|
version: 2.0.0
|
|
906
909
|
requirements: []
|
|
907
|
-
rubygems_version: 3.4.
|
|
908
|
-
signing_key:
|
|
910
|
+
rubygems_version: 3.4.10
|
|
911
|
+
signing_key:
|
|
909
912
|
specification_version: 4
|
|
910
913
|
summary: Datadog tracing code for your Ruby applications
|
|
911
914
|
test_files: []
|
|
@@ -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
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'date'
|
|
4
|
-
require 'json'
|
|
5
|
-
require 'rbconfig'
|
|
6
|
-
require_relative '../../core/diagnostics/environment_logger'
|
|
7
|
-
|
|
8
|
-
module Datadog
|
|
9
|
-
module Profiling
|
|
10
|
-
module Diagnostics
|
|
11
|
-
# Collects and logs Profiling diagnostic information
|
|
12
|
-
module EnvironmentLogger
|
|
13
|
-
extend Core::Diagnostics::EnvironmentLogging
|
|
14
|
-
|
|
15
|
-
def self.collect_and_log!
|
|
16
|
-
log_once! do
|
|
17
|
-
data = EnvironmentCollector.collect_config!
|
|
18
|
-
log_configuration!('PROFILING', data.to_json)
|
|
19
|
-
end
|
|
20
|
-
rescue => e
|
|
21
|
-
logger.warn("Failed to collect profiling environment information: #{e} Location: #{Array(e.backtrace).first}")
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
# Collects environment information for Profiling diagnostic logging
|
|
26
|
-
module EnvironmentCollector
|
|
27
|
-
def self.collect_config!(*args)
|
|
28
|
-
{
|
|
29
|
-
profiling_enabled: profiling_enabled
|
|
30
|
-
}
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def self.profiling_enabled
|
|
34
|
-
!!Datadog.configuration.profiling.enabled
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|
|
File without changes
|
/data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/clock_id.h
RENAMED
|
File without changes
|
|
File without changes
|
/data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/clock_id_noop.c
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/heap_recorder.c
RENAMED
|
File without changes
|
/data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/heap_recorder.h
RENAMED
|
File without changes
|
/data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/helpers.h
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/stack_recorder.c
RENAMED
|
File without changes
|
/data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/stack_recorder.h
RENAMED
|
File without changes
|
/data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/time_helpers.c
RENAMED
|
File without changes
|
/data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/time_helpers.h
RENAMED
|
File without changes
|