ddtrace 1.5.2 → 1.6.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 +44 -1
- data/ext/ddtrace_profiling_loader/ddtrace_profiling_loader.c +9 -2
- data/ext/ddtrace_profiling_loader/extconf.rb +17 -0
- data/ext/ddtrace_profiling_native_extension/NativeExtensionDesign.md +38 -2
- data/ext/ddtrace_profiling_native_extension/clock_id.h +1 -0
- data/ext/ddtrace_profiling_native_extension/clock_id_from_pthread.c +1 -0
- data/ext/ddtrace_profiling_native_extension/collectors_cpu_and_wall_time.c +517 -42
- data/ext/ddtrace_profiling_native_extension/collectors_cpu_and_wall_time.h +3 -0
- data/ext/ddtrace_profiling_native_extension/collectors_cpu_and_wall_time_worker.c +208 -30
- data/ext/ddtrace_profiling_native_extension/collectors_stack.c +156 -46
- data/ext/ddtrace_profiling_native_extension/collectors_stack.h +11 -2
- data/ext/ddtrace_profiling_native_extension/extconf.rb +11 -1
- data/ext/ddtrace_profiling_native_extension/http_transport.c +83 -64
- data/ext/ddtrace_profiling_native_extension/libdatadog_helpers.h +4 -4
- data/ext/ddtrace_profiling_native_extension/native_extension_helpers.rb +3 -2
- data/ext/ddtrace_profiling_native_extension/private_vm_api_access.c +59 -0
- data/ext/ddtrace_profiling_native_extension/private_vm_api_access.h +3 -0
- data/ext/ddtrace_profiling_native_extension/profiling.c +10 -0
- data/ext/ddtrace_profiling_native_extension/ruby_helpers.c +0 -1
- data/ext/ddtrace_profiling_native_extension/ruby_helpers.h +4 -2
- data/ext/ddtrace_profiling_native_extension/stack_recorder.c +45 -29
- data/ext/ddtrace_profiling_native_extension/stack_recorder.h +7 -7
- data/lib/datadog/appsec/contrib/rack/request_middleware.rb +4 -0
- data/lib/datadog/appsec/event.rb +6 -0
- data/lib/datadog/core/configuration/components.rb +20 -14
- data/lib/datadog/core/configuration/settings.rb +42 -4
- data/lib/datadog/core/diagnostics/environment_logger.rb +5 -1
- data/lib/datadog/core/utils/compression.rb +5 -1
- data/lib/datadog/core.rb +0 -54
- data/lib/datadog/profiling/collectors/cpu_and_wall_time.rb +12 -2
- data/lib/datadog/profiling/collectors/cpu_and_wall_time_worker.rb +5 -3
- data/lib/datadog/profiling/exporter.rb +2 -4
- data/lib/datadog/profiling/http_transport.rb +1 -1
- data/lib/datadog/tracing/configuration/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/aws/instrumentation.rb +2 -0
- data/lib/datadog/tracing/contrib/dalli/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/dalli/instrumentation.rb +4 -0
- data/lib/datadog/tracing/contrib/elasticsearch/ext.rb +2 -0
- data/lib/datadog/tracing/contrib/elasticsearch/patcher.rb +3 -0
- data/lib/datadog/tracing/contrib/ethon/easy_patch.rb +2 -0
- data/lib/datadog/tracing/contrib/ethon/multi_patch.rb +2 -0
- data/lib/datadog/tracing/contrib/excon/middleware.rb +2 -0
- data/lib/datadog/tracing/contrib/ext.rb +6 -0
- data/lib/datadog/tracing/contrib/faraday/middleware.rb +2 -0
- data/lib/datadog/tracing/contrib/grpc/datadog_interceptor/client.rb +5 -0
- data/lib/datadog/tracing/contrib/grpc/datadog_interceptor/server.rb +7 -1
- data/lib/datadog/tracing/contrib/grpc/ext.rb +2 -0
- data/lib/datadog/tracing/contrib/hanami/action_tracer.rb +47 -0
- data/lib/datadog/tracing/contrib/hanami/configuration/settings.rb +22 -0
- data/lib/datadog/tracing/contrib/hanami/ext.rb +24 -0
- data/lib/datadog/tracing/contrib/hanami/integration.rb +44 -0
- data/lib/datadog/tracing/contrib/hanami/patcher.rb +33 -0
- data/lib/datadog/tracing/contrib/hanami/plugin.rb +23 -0
- data/lib/datadog/tracing/contrib/hanami/renderer_policy_tracing.rb +41 -0
- data/lib/datadog/tracing/contrib/hanami/router_tracing.rb +44 -0
- data/lib/datadog/tracing/contrib/http/instrumentation.rb +2 -0
- data/lib/datadog/tracing/contrib/httpclient/instrumentation.rb +2 -0
- data/lib/datadog/tracing/contrib/httprb/instrumentation.rb +2 -0
- data/lib/datadog/tracing/contrib/mongodb/ext.rb +7 -0
- data/lib/datadog/tracing/contrib/mongodb/subscribers.rb +4 -0
- data/lib/datadog/tracing/contrib/mysql2/configuration/settings.rb +12 -0
- data/lib/datadog/tracing/contrib/mysql2/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/mysql2/instrumentation.rb +16 -0
- data/lib/datadog/tracing/contrib/pg/configuration/settings.rb +12 -0
- data/lib/datadog/tracing/contrib/pg/ext.rb +2 -1
- data/lib/datadog/tracing/contrib/pg/instrumentation.rb +34 -18
- data/lib/datadog/tracing/contrib/propagation/sql_comment/comment.rb +43 -0
- data/lib/datadog/tracing/contrib/propagation/sql_comment/ext.rb +32 -0
- data/lib/datadog/tracing/contrib/propagation/sql_comment/mode.rb +28 -0
- data/lib/datadog/tracing/contrib/propagation/sql_comment.rb +49 -0
- data/lib/datadog/tracing/contrib/rack/middlewares.rb +11 -5
- data/lib/datadog/tracing/contrib/redis/ext.rb +2 -0
- data/lib/datadog/tracing/contrib/redis/instrumentation.rb +4 -2
- data/lib/datadog/tracing/contrib/redis/patcher.rb +41 -0
- data/lib/datadog/tracing/contrib/redis/tags.rb +5 -0
- data/lib/datadog/tracing/contrib/rest_client/request_patch.rb +2 -0
- data/lib/datadog/tracing/contrib/sinatra/env.rb +12 -23
- data/lib/datadog/tracing/contrib/sinatra/ext.rb +7 -3
- data/lib/datadog/tracing/contrib/sinatra/patcher.rb +2 -2
- data/lib/datadog/tracing/contrib/sinatra/tracer.rb +8 -80
- data/lib/datadog/tracing/contrib/sinatra/tracer_middleware.rb +14 -9
- data/lib/datadog/tracing/contrib.rb +1 -0
- data/lib/datadog/tracing/distributed/datadog_tags_codec.rb +84 -0
- data/lib/datadog/tracing/distributed/headers/datadog.rb +122 -30
- data/lib/datadog/tracing/distributed/headers/ext.rb +2 -0
- data/lib/datadog/tracing/flush.rb +1 -1
- data/lib/datadog/tracing/metadata/ext.rb +8 -0
- data/lib/datadog/tracing/propagation/http.rb +9 -1
- data/lib/datadog/tracing/sampling/ext.rb +31 -0
- data/lib/datadog/tracing/sampling/priority_sampler.rb +46 -4
- data/lib/datadog/tracing/sampling/rate_by_key_sampler.rb +8 -9
- data/lib/datadog/tracing/sampling/rate_by_service_sampler.rb +29 -5
- data/lib/datadog/tracing/sampling/rate_sampler.rb +10 -3
- data/lib/datadog/tracing/sampling/rule_sampler.rb +4 -3
- data/lib/datadog/tracing/sampling/span/ext.rb +0 -4
- data/lib/datadog/tracing/sampling/span/rule.rb +1 -1
- data/lib/datadog/tracing/sampling/span/sampler.rb +14 -3
- data/lib/datadog/tracing/trace_digest.rb +3 -0
- data/lib/datadog/tracing/trace_operation.rb +10 -0
- data/lib/datadog/tracing/trace_segment.rb +6 -0
- data/lib/datadog/tracing/tracer.rb +3 -1
- data/lib/datadog/tracing/writer.rb +7 -0
- data/lib/ddtrace/transport/trace_formatter.rb +7 -0
- data/lib/ddtrace/transport/traces.rb +1 -1
- data/lib/ddtrace/version.rb +2 -2
- metadata +18 -14
- data/lib/datadog/profiling/old_ext.rb +0 -42
- data/lib/datadog/profiling/transport/http/api/endpoint.rb +0 -85
- data/lib/datadog/profiling/transport/http/api/instance.rb +0 -38
- data/lib/datadog/profiling/transport/http/api/spec.rb +0 -42
- data/lib/datadog/profiling/transport/http/api.rb +0 -45
- data/lib/datadog/profiling/transport/http/builder.rb +0 -30
- data/lib/datadog/profiling/transport/http/client.rb +0 -37
- data/lib/datadog/profiling/transport/http/response.rb +0 -21
- data/lib/datadog/profiling/transport/http.rb +0 -118
|
@@ -48,7 +48,7 @@ module Datadog
|
|
|
48
48
|
nil
|
|
49
49
|
else
|
|
50
50
|
# TODO: Simplify .tags access, as `Tracer#tags` can't be arbitrarily changed anymore
|
|
51
|
-
RateByServiceSampler.new(1.0, env: -> { Tracing.send(:tracer).tags[
|
|
51
|
+
RateByServiceSampler.new(1.0, env: -> { Tracing.send(:tracer).tags['env'] })
|
|
52
52
|
end
|
|
53
53
|
end
|
|
54
54
|
|
|
@@ -76,10 +76,10 @@ module Datadog
|
|
|
76
76
|
end
|
|
77
77
|
|
|
78
78
|
# @!visibility private
|
|
79
|
-
def update(*args)
|
|
79
|
+
def update(*args, **kwargs)
|
|
80
80
|
return false unless @default_sampler.respond_to?(:update)
|
|
81
81
|
|
|
82
|
-
@default_sampler.update(*args)
|
|
82
|
+
@default_sampler.update(*args, **kwargs)
|
|
83
83
|
end
|
|
84
84
|
|
|
85
85
|
private
|
|
@@ -100,6 +100,7 @@ module Datadog
|
|
|
100
100
|
rate_limiter.allow?(1).tap do |allowed|
|
|
101
101
|
set_priority(trace, allowed)
|
|
102
102
|
set_limiter_metrics(trace, rate_limiter.effective_rate)
|
|
103
|
+
trace.set_tag(Tracing::Metadata::Ext::Distributed::TAG_DECISION_MAKER, Ext::Decision::TRACE_SAMPLING_RULE)
|
|
103
104
|
end
|
|
104
105
|
rescue StandardError => e
|
|
105
106
|
Datadog.logger.error(
|
|
@@ -18,10 +18,6 @@ module Datadog
|
|
|
18
18
|
TAG_RULE_RATE = '_dd.span_sampling.rule_rate'
|
|
19
19
|
# Rate limit configured for this span, if a rule applies
|
|
20
20
|
TAG_MAX_PER_SECOND = '_dd.span_sampling.max_per_second'
|
|
21
|
-
|
|
22
|
-
# This span was sampled on account of a Span Sampling Rule
|
|
23
|
-
# @see Datadog::Tracing::Sampling::Span::Rule
|
|
24
|
-
MECHANISM_SPAN_SAMPLING_RATE = 8
|
|
25
21
|
end
|
|
26
22
|
end
|
|
27
23
|
end
|
|
@@ -59,7 +59,7 @@ module Datadog
|
|
|
59
59
|
return :not_matched unless @matcher.match?(span_op)
|
|
60
60
|
|
|
61
61
|
if @sampler.sample?(span_op) && @rate_limiter.allow?(1)
|
|
62
|
-
span_op.set_metric(Span::Ext::TAG_MECHANISM,
|
|
62
|
+
span_op.set_metric(Span::Ext::TAG_MECHANISM, Sampling::Ext::Mechanism::SPAN_SAMPLING_RATE)
|
|
63
63
|
span_op.set_metric(Span::Ext::TAG_RULE_RATE, @sample_rate)
|
|
64
64
|
span_op.set_metric(Span::Ext::TAG_MAX_PER_SECOND, @rate_limit)
|
|
65
65
|
:kept
|
|
@@ -50,9 +50,20 @@ module Datadog
|
|
|
50
50
|
def sample!(trace_op, span_op)
|
|
51
51
|
return if trace_op.sampled? && trace_op.priority_sampled?
|
|
52
52
|
|
|
53
|
-
#
|
|
54
|
-
@rules.
|
|
55
|
-
rule.sample!(span_op)
|
|
53
|
+
# Applies the first matching rule
|
|
54
|
+
@rules.each do |rule|
|
|
55
|
+
decision = rule.sample!(span_op)
|
|
56
|
+
|
|
57
|
+
next if decision == :not_matched # Iterate until we find a matching decision
|
|
58
|
+
|
|
59
|
+
if decision == :kept
|
|
60
|
+
trace_op.set_tag(
|
|
61
|
+
Metadata::Ext::Distributed::TAG_DECISION_MAKER,
|
|
62
|
+
Sampling::Ext::Decision::SPAN_SAMPLING_RATE
|
|
63
|
+
)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
break # Found either a `kept` or `rejected` decision
|
|
56
67
|
end
|
|
57
68
|
|
|
58
69
|
nil
|
|
@@ -12,6 +12,7 @@ module Datadog
|
|
|
12
12
|
:span_resource,
|
|
13
13
|
:span_service,
|
|
14
14
|
:span_type,
|
|
15
|
+
:trace_distributed_tags,
|
|
15
16
|
:trace_hostname,
|
|
16
17
|
:trace_id,
|
|
17
18
|
:trace_name,
|
|
@@ -28,6 +29,7 @@ module Datadog
|
|
|
28
29
|
span_resource: nil,
|
|
29
30
|
span_service: nil,
|
|
30
31
|
span_type: nil,
|
|
32
|
+
trace_distributed_tags: nil,
|
|
31
33
|
trace_hostname: nil,
|
|
32
34
|
trace_id: nil,
|
|
33
35
|
trace_name: nil,
|
|
@@ -43,6 +45,7 @@ module Datadog
|
|
|
43
45
|
@span_resource = span_resource && span_resource.dup.freeze
|
|
44
46
|
@span_service = span_service && span_service.dup.freeze
|
|
45
47
|
@span_type = span_type && span_type.dup.freeze
|
|
48
|
+
@trace_distributed_tags = trace_distributed_tags && trace_distributed_tags.dup.freeze
|
|
46
49
|
@trace_hostname = trace_hostname && trace_hostname.dup.freeze
|
|
47
50
|
@trace_id = trace_id
|
|
48
51
|
@trace_name = trace_name && trace_name.dup.freeze
|
|
@@ -133,11 +133,13 @@ module Datadog
|
|
|
133
133
|
def keep!
|
|
134
134
|
self.sampled = true
|
|
135
135
|
self.sampling_priority = Sampling::Ext::Priority::USER_KEEP
|
|
136
|
+
set_tag(Tracing::Metadata::Ext::Distributed::TAG_DECISION_MAKER, Tracing::Sampling::Ext::Decision::MANUAL)
|
|
136
137
|
end
|
|
137
138
|
|
|
138
139
|
def reject!
|
|
139
140
|
self.sampled = false
|
|
140
141
|
self.sampling_priority = Sampling::Ext::Priority::USER_REJECT
|
|
142
|
+
set_tag(Tracing::Metadata::Ext::Distributed::TAG_DECISION_MAKER, Tracing::Sampling::Ext::Decision::MANUAL)
|
|
141
143
|
end
|
|
142
144
|
|
|
143
145
|
def name
|
|
@@ -278,6 +280,7 @@ module Datadog
|
|
|
278
280
|
span_resource: (@active_span && @active_span.resource),
|
|
279
281
|
span_service: (@active_span && @active_span.service),
|
|
280
282
|
span_type: (@active_span && @active_span.type),
|
|
283
|
+
trace_distributed_tags: distributed_tags,
|
|
281
284
|
trace_hostname: @hostname,
|
|
282
285
|
trace_id: @id,
|
|
283
286
|
trace_name: name,
|
|
@@ -452,6 +455,13 @@ module Datadog
|
|
|
452
455
|
root_span_id: !partial ? root_span && root_span.id : nil
|
|
453
456
|
)
|
|
454
457
|
end
|
|
458
|
+
|
|
459
|
+
# Returns tracer tags that will be propagated if this span's context
|
|
460
|
+
# is exported through {.to_digest}.
|
|
461
|
+
# @return [Hash] key value pairs of distributed tags
|
|
462
|
+
def distributed_tags
|
|
463
|
+
meta.select { |name, _| name.start_with?(Metadata::Ext::Distributed::TAGS_PREFIX) }
|
|
464
|
+
end
|
|
455
465
|
end
|
|
456
466
|
end
|
|
457
467
|
end
|
|
@@ -30,6 +30,7 @@ module Datadog
|
|
|
30
30
|
:rule_sample_rate,
|
|
31
31
|
:runtime_id,
|
|
32
32
|
:sample_rate,
|
|
33
|
+
:sampling_decision_maker,
|
|
33
34
|
:sampling_priority,
|
|
34
35
|
:service
|
|
35
36
|
|
|
@@ -77,6 +78,7 @@ module Datadog
|
|
|
77
78
|
@rule_sample_rate = rule_sample_rate_tag || rule_sample_rate
|
|
78
79
|
@runtime_id = runtime_id || runtime_id_tag
|
|
79
80
|
@sample_rate = sample_rate || sample_rate_tag
|
|
81
|
+
@sampling_decision_maker = sampling_decision_maker_tag
|
|
80
82
|
@sampling_priority = sampling_priority || sampling_priority_tag
|
|
81
83
|
@service = Core::Utils::SafeDup.frozen_or_dup(service || service_tag)
|
|
82
84
|
end
|
|
@@ -194,6 +196,10 @@ module Datadog
|
|
|
194
196
|
metrics[Metadata::Ext::Sampling::TAG_SAMPLE_RATE]
|
|
195
197
|
end
|
|
196
198
|
|
|
199
|
+
def sampling_decision_maker_tag
|
|
200
|
+
meta[Metadata::Ext::Distributed::TAG_DECISION_MAKER]
|
|
201
|
+
end
|
|
202
|
+
|
|
197
203
|
def sampling_priority_tag
|
|
198
204
|
meta[Metadata::Ext::Distributed::TAG_SAMPLING_PRIORITY]
|
|
199
205
|
end
|
|
@@ -326,7 +326,9 @@ module Datadog
|
|
|
326
326
|
id: digest.trace_id,
|
|
327
327
|
origin: digest.trace_origin,
|
|
328
328
|
parent_span_id: digest.span_id,
|
|
329
|
-
sampling_priority: digest.trace_sampling_priority
|
|
329
|
+
sampling_priority: digest.trace_sampling_priority,
|
|
330
|
+
# Distributed tags are just regular trace tags with special meaning to Datadog
|
|
331
|
+
tags: digest.trace_distributed_tags,
|
|
330
332
|
)
|
|
331
333
|
else
|
|
332
334
|
TraceOperation.new(
|
|
@@ -48,6 +48,7 @@ module Datadog
|
|
|
48
48
|
tag_runtime_id!
|
|
49
49
|
tag_rate_limiter_rate!
|
|
50
50
|
tag_sample_rate!
|
|
51
|
+
tag_sampling_decision_maker!
|
|
51
52
|
tag_sampling_priority!
|
|
52
53
|
|
|
53
54
|
trace
|
|
@@ -155,6 +156,12 @@ module Datadog
|
|
|
155
156
|
)
|
|
156
157
|
end
|
|
157
158
|
|
|
159
|
+
def tag_sampling_decision_maker!
|
|
160
|
+
return unless (decision = trace.sampling_decision_maker)
|
|
161
|
+
|
|
162
|
+
root_span.set_tag(Tracing::Metadata::Ext::Distributed::TAG_DECISION_MAKER, decision)
|
|
163
|
+
end
|
|
164
|
+
|
|
158
165
|
def tag_sampling_priority!
|
|
159
166
|
return unless trace.sampling_priority
|
|
160
167
|
|
|
@@ -80,7 +80,7 @@ module Datadog
|
|
|
80
80
|
|
|
81
81
|
if encoded.size > max_size
|
|
82
82
|
# This single trace is too large, we can't flush it
|
|
83
|
-
Datadog.logger.debug { "Dropping trace. Payload too large: '#{trace.
|
|
83
|
+
Datadog.logger.debug { "Dropping trace. Payload too large: '#{trace.inspect}'" }
|
|
84
84
|
Datadog.health_metrics.transport_trace_too_large(1)
|
|
85
85
|
|
|
86
86
|
return nil
|
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.6.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:
|
|
11
|
+
date: 2022-11-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: msgpack
|
|
@@ -64,14 +64,14 @@ dependencies:
|
|
|
64
64
|
requirements:
|
|
65
65
|
- - "~>"
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
|
-
version: 0.
|
|
67
|
+
version: 0.9.0.1.0
|
|
68
68
|
type: :runtime
|
|
69
69
|
prerelease: false
|
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
|
71
71
|
requirements:
|
|
72
72
|
- - "~>"
|
|
73
73
|
- !ruby/object:Gem::Version
|
|
74
|
-
version: 0.
|
|
74
|
+
version: 0.9.0.1.0
|
|
75
75
|
description: |
|
|
76
76
|
ddtrace is Datadog's tracing client for Ruby. It is used to trace requests
|
|
77
77
|
as they flow across web servers, databases and microservices so that developers
|
|
@@ -314,7 +314,6 @@ files:
|
|
|
314
314
|
- lib/datadog/profiling/http_transport.rb
|
|
315
315
|
- lib/datadog/profiling/load_native_extension.rb
|
|
316
316
|
- lib/datadog/profiling/native_extension.rb
|
|
317
|
-
- lib/datadog/profiling/old_ext.rb
|
|
318
317
|
- lib/datadog/profiling/old_recorder.rb
|
|
319
318
|
- lib/datadog/profiling/pprof/builder.rb
|
|
320
319
|
- lib/datadog/profiling/pprof/converter.rb
|
|
@@ -335,14 +334,6 @@ files:
|
|
|
335
334
|
- lib/datadog/profiling/tasks/setup.rb
|
|
336
335
|
- lib/datadog/profiling/trace_identifiers/ddtrace.rb
|
|
337
336
|
- lib/datadog/profiling/trace_identifiers/helper.rb
|
|
338
|
-
- lib/datadog/profiling/transport/http.rb
|
|
339
|
-
- lib/datadog/profiling/transport/http/api.rb
|
|
340
|
-
- lib/datadog/profiling/transport/http/api/endpoint.rb
|
|
341
|
-
- lib/datadog/profiling/transport/http/api/instance.rb
|
|
342
|
-
- lib/datadog/profiling/transport/http/api/spec.rb
|
|
343
|
-
- lib/datadog/profiling/transport/http/builder.rb
|
|
344
|
-
- lib/datadog/profiling/transport/http/client.rb
|
|
345
|
-
- lib/datadog/profiling/transport/http/response.rb
|
|
346
337
|
- lib/datadog/tracing.rb
|
|
347
338
|
- lib/datadog/tracing/analytics.rb
|
|
348
339
|
- lib/datadog/tracing/buffer.rb
|
|
@@ -505,6 +496,14 @@ files:
|
|
|
505
496
|
- lib/datadog/tracing/contrib/grpc/integration.rb
|
|
506
497
|
- lib/datadog/tracing/contrib/grpc/intercept_with_datadog.rb
|
|
507
498
|
- lib/datadog/tracing/contrib/grpc/patcher.rb
|
|
499
|
+
- lib/datadog/tracing/contrib/hanami/action_tracer.rb
|
|
500
|
+
- lib/datadog/tracing/contrib/hanami/configuration/settings.rb
|
|
501
|
+
- lib/datadog/tracing/contrib/hanami/ext.rb
|
|
502
|
+
- lib/datadog/tracing/contrib/hanami/integration.rb
|
|
503
|
+
- lib/datadog/tracing/contrib/hanami/patcher.rb
|
|
504
|
+
- lib/datadog/tracing/contrib/hanami/plugin.rb
|
|
505
|
+
- lib/datadog/tracing/contrib/hanami/renderer_policy_tracing.rb
|
|
506
|
+
- lib/datadog/tracing/contrib/hanami/router_tracing.rb
|
|
508
507
|
- lib/datadog/tracing/contrib/http/circuit_breaker.rb
|
|
509
508
|
- lib/datadog/tracing/contrib/http/configuration/settings.rb
|
|
510
509
|
- lib/datadog/tracing/contrib/http/ext.rb
|
|
@@ -569,6 +568,10 @@ files:
|
|
|
569
568
|
- lib/datadog/tracing/contrib/presto/instrumentation.rb
|
|
570
569
|
- lib/datadog/tracing/contrib/presto/integration.rb
|
|
571
570
|
- lib/datadog/tracing/contrib/presto/patcher.rb
|
|
571
|
+
- lib/datadog/tracing/contrib/propagation/sql_comment.rb
|
|
572
|
+
- lib/datadog/tracing/contrib/propagation/sql_comment/comment.rb
|
|
573
|
+
- lib/datadog/tracing/contrib/propagation/sql_comment/ext.rb
|
|
574
|
+
- lib/datadog/tracing/contrib/propagation/sql_comment/mode.rb
|
|
572
575
|
- lib/datadog/tracing/contrib/qless/configuration/settings.rb
|
|
573
576
|
- lib/datadog/tracing/contrib/qless/ext.rb
|
|
574
577
|
- lib/datadog/tracing/contrib/qless/integration.rb
|
|
@@ -686,6 +689,7 @@ files:
|
|
|
686
689
|
- lib/datadog/tracing/contrib/utils/quantization/hash.rb
|
|
687
690
|
- lib/datadog/tracing/contrib/utils/quantization/http.rb
|
|
688
691
|
- lib/datadog/tracing/correlation.rb
|
|
692
|
+
- lib/datadog/tracing/distributed/datadog_tags_codec.rb
|
|
689
693
|
- lib/datadog/tracing/distributed/headers/b3.rb
|
|
690
694
|
- lib/datadog/tracing/distributed/headers/b3_single.rb
|
|
691
695
|
- lib/datadog/tracing/distributed/headers/datadog.rb
|
|
@@ -792,7 +796,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
792
796
|
- !ruby/object:Gem::Version
|
|
793
797
|
version: 2.0.0
|
|
794
798
|
requirements: []
|
|
795
|
-
rubygems_version: 3.
|
|
799
|
+
rubygems_version: 3.3.7
|
|
796
800
|
signing_key:
|
|
797
801
|
specification_version: 4
|
|
798
802
|
summary: Datadog tracing code for your Ruby applications
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
# typed: true
|
|
2
|
-
|
|
3
|
-
module Datadog
|
|
4
|
-
module Profiling
|
|
5
|
-
# NOTE: This OldExt file is temporary and expected to be removed once the migration to the new `HttpTransport` class
|
|
6
|
-
# is complete
|
|
7
|
-
module OldExt
|
|
8
|
-
module Transport
|
|
9
|
-
module HTTP
|
|
10
|
-
URI_TEMPLATE_DD_API = 'https://intake.profile.%s/'.freeze
|
|
11
|
-
|
|
12
|
-
FORM_FIELD_RECORDING_START = 'start'.freeze
|
|
13
|
-
FORM_FIELD_RECORDING_END = 'end'.freeze
|
|
14
|
-
FORM_FIELD_FAMILY = 'family'.freeze
|
|
15
|
-
FORM_FIELD_TAG_ENV = 'env'.freeze
|
|
16
|
-
FORM_FIELD_TAG_HOST = 'host'.freeze
|
|
17
|
-
FORM_FIELD_TAG_LANGUAGE = 'language'.freeze
|
|
18
|
-
FORM_FIELD_TAG_PID = 'process_id'.freeze
|
|
19
|
-
FORM_FIELD_TAG_PROFILER_VERSION = 'profiler_version'.freeze
|
|
20
|
-
FORM_FIELD_TAG_RUNTIME = 'runtime'.freeze
|
|
21
|
-
FORM_FIELD_TAG_RUNTIME_ENGINE = 'runtime_engine'.freeze
|
|
22
|
-
FORM_FIELD_TAG_RUNTIME_ID = 'runtime-id'.freeze
|
|
23
|
-
FORM_FIELD_TAG_RUNTIME_PLATFORM = 'runtime_platform'.freeze
|
|
24
|
-
FORM_FIELD_TAG_RUNTIME_VERSION = 'runtime_version'.freeze
|
|
25
|
-
FORM_FIELD_TAG_SERVICE = 'service'.freeze
|
|
26
|
-
FORM_FIELD_TAG_VERSION = 'version'.freeze
|
|
27
|
-
FORM_FIELD_TAGS = 'tags'.freeze
|
|
28
|
-
FORM_FIELD_INTAKE_VERSION = 'version'.freeze
|
|
29
|
-
|
|
30
|
-
HEADER_CONTENT_TYPE = 'Content-Type'.freeze
|
|
31
|
-
HEADER_CONTENT_TYPE_OCTET_STREAM = 'application/octet-stream'.freeze
|
|
32
|
-
|
|
33
|
-
FORM_FIELD_PPROF_DATA = 'data[rubyprofile.pprof]'.freeze
|
|
34
|
-
PPROF_DEFAULT_FILENAME = 'rubyprofile.pprof.gz'.freeze
|
|
35
|
-
|
|
36
|
-
FORM_FIELD_CODE_PROVENANCE_DATA = 'data[code-provenance.json]'.freeze
|
|
37
|
-
CODE_PROVENANCE_FILENAME = 'code-provenance.json.gz'.freeze
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
# typed: true
|
|
2
|
-
|
|
3
|
-
require_relative '../../../../core/utils/compression'
|
|
4
|
-
require_relative '../../../../core/vendor/multipart-post/multipart/post/composite_read_io'
|
|
5
|
-
require_relative '../../../old_ext'
|
|
6
|
-
require_relative '../response'
|
|
7
|
-
require_relative '../../../../../ddtrace/transport/http/api/endpoint'
|
|
8
|
-
|
|
9
|
-
module Datadog
|
|
10
|
-
module Profiling
|
|
11
|
-
module Transport
|
|
12
|
-
module HTTP
|
|
13
|
-
module API
|
|
14
|
-
# Datadog API endpoint for profiling
|
|
15
|
-
class Endpoint < Datadog::Transport::HTTP::API::Endpoint
|
|
16
|
-
include Profiling::OldExt::Transport::HTTP
|
|
17
|
-
|
|
18
|
-
# These tags are read from the flush object (see below) directly and so we ignore any extra copies that
|
|
19
|
-
# may come in the tags hash to avoid duplicates.
|
|
20
|
-
TAGS_TO_IGNORE_IN_TAGS_HASH = %w[service env version].freeze
|
|
21
|
-
private_constant :TAGS_TO_IGNORE_IN_TAGS_HASH
|
|
22
|
-
|
|
23
|
-
attr_reader \
|
|
24
|
-
:encoder
|
|
25
|
-
|
|
26
|
-
def initialize(path, encoder = nil)
|
|
27
|
-
super(:post, path)
|
|
28
|
-
@encoder = encoder
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def call(env, &block)
|
|
32
|
-
# Build request
|
|
33
|
-
env.form = build_form(env)
|
|
34
|
-
|
|
35
|
-
# Send request
|
|
36
|
-
http_response = super(env, &block)
|
|
37
|
-
|
|
38
|
-
# Build response
|
|
39
|
-
Profiling::Transport::HTTP::Response.new(http_response)
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def build_form(env)
|
|
43
|
-
flush = env.request
|
|
44
|
-
pprof_file = build_pprof(flush)
|
|
45
|
-
|
|
46
|
-
form = {
|
|
47
|
-
FORM_FIELD_INTAKE_VERSION => '3', # Aka 1.3 intake format
|
|
48
|
-
FORM_FIELD_RECORDING_START => flush.start.utc.iso8601,
|
|
49
|
-
FORM_FIELD_RECORDING_END => flush.finish.utc.iso8601,
|
|
50
|
-
FORM_FIELD_TAGS => flush.tags_as_array.map { |key, value| "#{key}:#{value}" },
|
|
51
|
-
FORM_FIELD_PPROF_DATA => pprof_file,
|
|
52
|
-
FORM_FIELD_FAMILY => 'ruby',
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
# May not be available/enabled
|
|
56
|
-
form[FORM_FIELD_CODE_PROVENANCE_DATA] = build_code_provenance(flush) if flush.code_provenance_data
|
|
57
|
-
|
|
58
|
-
form
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
def build_pprof(flush)
|
|
62
|
-
gzipped_pprof_data = flush.pprof_data
|
|
63
|
-
|
|
64
|
-
Core::Vendor::Multipart::Post::UploadIO.new(
|
|
65
|
-
StringIO.new(gzipped_pprof_data),
|
|
66
|
-
HEADER_CONTENT_TYPE_OCTET_STREAM,
|
|
67
|
-
PPROF_DEFAULT_FILENAME
|
|
68
|
-
)
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
def build_code_provenance(flush)
|
|
72
|
-
gzipped_code_provenance = flush.code_provenance_data
|
|
73
|
-
|
|
74
|
-
Core::Vendor::Multipart::Post::UploadIO.new(
|
|
75
|
-
StringIO.new(gzipped_code_provenance),
|
|
76
|
-
HEADER_CONTENT_TYPE_OCTET_STREAM,
|
|
77
|
-
CODE_PROVENANCE_FILENAME,
|
|
78
|
-
)
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
end
|
|
82
|
-
end
|
|
83
|
-
end
|
|
84
|
-
end
|
|
85
|
-
end
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
# typed: true
|
|
2
|
-
|
|
3
|
-
require_relative '../../../../../ddtrace/transport/http/api/instance'
|
|
4
|
-
require_relative 'spec'
|
|
5
|
-
|
|
6
|
-
module Datadog
|
|
7
|
-
module Profiling
|
|
8
|
-
module Transport
|
|
9
|
-
module HTTP
|
|
10
|
-
module API
|
|
11
|
-
# API instance for profiling
|
|
12
|
-
class Instance < Datadog::Transport::HTTP::API::Instance
|
|
13
|
-
def send_profiling_flush(env)
|
|
14
|
-
raise ProfilesNotSupportedError, spec unless spec.is_a?(Spec)
|
|
15
|
-
|
|
16
|
-
spec.send_profiling_flush(env) do |request_env|
|
|
17
|
-
call(request_env)
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
# Raised when profiles sent to API that does not support profiles
|
|
22
|
-
class ProfilesNotSupportedError < StandardError
|
|
23
|
-
attr_reader :spec
|
|
24
|
-
|
|
25
|
-
def initialize(spec)
|
|
26
|
-
@spec = spec
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def message
|
|
30
|
-
'Profiles not supported for this API!'
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
# typed: true
|
|
2
|
-
|
|
3
|
-
require_relative '../../../../../ddtrace/transport/http/api/spec'
|
|
4
|
-
|
|
5
|
-
module Datadog
|
|
6
|
-
module Profiling
|
|
7
|
-
module Transport
|
|
8
|
-
module HTTP
|
|
9
|
-
module API
|
|
10
|
-
# API specification for profiling
|
|
11
|
-
class Spec < Datadog::Transport::HTTP::API::Spec
|
|
12
|
-
attr_accessor \
|
|
13
|
-
:profiles
|
|
14
|
-
|
|
15
|
-
def send_profiling_flush(env, &block)
|
|
16
|
-
raise NoProfilesEndpointDefinedError, self if profiles.nil?
|
|
17
|
-
|
|
18
|
-
profiles.call(env, &block)
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def encoder
|
|
22
|
-
profiles.encoder
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
# Raised when profiles sent but no profiles endpoint is defined
|
|
26
|
-
class NoProfilesEndpointDefinedError < StandardError
|
|
27
|
-
attr_reader :spec
|
|
28
|
-
|
|
29
|
-
def initialize(spec)
|
|
30
|
-
@spec = spec
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def message
|
|
34
|
-
'No profiles endpoint is defined for API specification!'
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
# typed: true
|
|
2
|
-
|
|
3
|
-
require_relative '../../../../ddtrace/transport/http/api/map'
|
|
4
|
-
require_relative '../../encoding/profile'
|
|
5
|
-
require_relative 'api/spec'
|
|
6
|
-
require_relative 'api/instance'
|
|
7
|
-
require_relative 'api/endpoint'
|
|
8
|
-
|
|
9
|
-
module Datadog
|
|
10
|
-
module Profiling
|
|
11
|
-
module Transport
|
|
12
|
-
module HTTP
|
|
13
|
-
# Extensions for HTTP API Spec
|
|
14
|
-
module API
|
|
15
|
-
# Default API versions
|
|
16
|
-
V1 = 'v1'.freeze
|
|
17
|
-
|
|
18
|
-
module_function
|
|
19
|
-
|
|
20
|
-
def agent_defaults
|
|
21
|
-
@agent_defaults ||= Datadog::Transport::HTTP::API::Map[
|
|
22
|
-
V1 => Spec.new do |s|
|
|
23
|
-
s.profiles = Endpoint.new(
|
|
24
|
-
'/profiling/v1/input'.freeze,
|
|
25
|
-
Profiling::Encoding::Profile::Protobuf
|
|
26
|
-
)
|
|
27
|
-
end
|
|
28
|
-
]
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def api_defaults
|
|
32
|
-
@api_defaults ||= Datadog::Transport::HTTP::API::Map[
|
|
33
|
-
V1 => Spec.new do |s|
|
|
34
|
-
s.profiles = Endpoint.new(
|
|
35
|
-
'/v1/input'.freeze,
|
|
36
|
-
Profiling::Encoding::Profile::Protobuf
|
|
37
|
-
)
|
|
38
|
-
end
|
|
39
|
-
]
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# typed: true
|
|
2
|
-
|
|
3
|
-
require_relative '../../../../ddtrace/transport/http/builder'
|
|
4
|
-
|
|
5
|
-
require_relative 'api'
|
|
6
|
-
require_relative 'client'
|
|
7
|
-
|
|
8
|
-
module Datadog
|
|
9
|
-
module Profiling
|
|
10
|
-
module Transport
|
|
11
|
-
module HTTP
|
|
12
|
-
# Builds new instances of Transport::HTTP::Client
|
|
13
|
-
class Builder < Datadog::Transport::HTTP::Builder
|
|
14
|
-
def api_instance_class
|
|
15
|
-
API::Instance
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def to_transport
|
|
19
|
-
raise Datadog::Transport::HTTP::Builder::NoDefaultApiError if @default_api.nil?
|
|
20
|
-
|
|
21
|
-
# TODO: Profiling doesn't have multiple APIs yet.
|
|
22
|
-
# When it does, we should build it out with these APIs.
|
|
23
|
-
# Just use :default_api for now.
|
|
24
|
-
Client.new(to_api_instances[@default_api])
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# typed: true
|
|
2
|
-
|
|
3
|
-
require_relative '../../../../ddtrace/transport/http/client'
|
|
4
|
-
require_relative '../../../../ddtrace/transport/request'
|
|
5
|
-
|
|
6
|
-
module Datadog
|
|
7
|
-
module Profiling
|
|
8
|
-
module Transport
|
|
9
|
-
module HTTP
|
|
10
|
-
# Routes, encodes, and sends tracer data to the trace agent via HTTP.
|
|
11
|
-
class Client < Datadog::Transport::HTTP::Client
|
|
12
|
-
def export(flush)
|
|
13
|
-
send_profiling_flush(flush)
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def send_profiling_flush(flush)
|
|
17
|
-
# Build a request
|
|
18
|
-
request = flush
|
|
19
|
-
send_payload(request).tap do |response|
|
|
20
|
-
if response.ok?
|
|
21
|
-
Datadog.logger.debug('Successfully reported profiling data')
|
|
22
|
-
else
|
|
23
|
-
Datadog.logger.debug { "Failed to report profiling data -- #{response.inspect}" }
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def send_payload(request)
|
|
29
|
-
send_request(request) do |api, env|
|
|
30
|
-
api.send_profiling_flush(env)
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|