ddtrace 1.6.0 → 1.7.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 +50 -1
- data/ext/ddtrace_profiling_loader/extconf.rb +1 -1
- data/ext/ddtrace_profiling_native_extension/collectors_cpu_and_wall_time.c +66 -6
- data/ext/ddtrace_profiling_native_extension/collectors_cpu_and_wall_time_worker.c +51 -54
- data/ext/ddtrace_profiling_native_extension/collectors_stack.c +11 -13
- data/ext/ddtrace_profiling_native_extension/extconf.rb +1 -1
- data/ext/ddtrace_profiling_native_extension/private_vm_api_access.c +3 -2
- data/ext/ddtrace_profiling_native_extension/setup_signal_handler.c +96 -0
- data/ext/ddtrace_profiling_native_extension/setup_signal_handler.h +7 -0
- data/ext/ddtrace_profiling_native_extension/stack_recorder.c +70 -18
- data/ext/ddtrace_profiling_native_extension/stack_recorder.h +1 -0
- data/lib/datadog/appsec/assets/blocked.html +98 -3
- data/lib/datadog/appsec/assets/blocked.json +1 -0
- data/lib/datadog/appsec/assets/blocked.text +5 -0
- data/lib/datadog/appsec/assets/waf_rules/recommended.json +35 -46
- data/lib/datadog/appsec/assets/waf_rules/risky.json +1 -1
- data/lib/datadog/appsec/assets/waf_rules/strict.json +46 -1
- data/lib/datadog/appsec/assets.rb +2 -2
- data/lib/datadog/appsec/configuration/settings.rb +6 -0
- data/lib/datadog/appsec/configuration.rb +4 -0
- data/lib/datadog/appsec/contrib/rack/reactive/request.rb +4 -8
- data/lib/datadog/appsec/contrib/rack/request.rb +17 -0
- data/lib/datadog/appsec/contrib/rack/request_body_middleware.rb +2 -2
- data/lib/datadog/appsec/contrib/rack/request_middleware.rb +2 -2
- data/lib/datadog/appsec/contrib/rails/patcher.rb +3 -6
- data/lib/datadog/appsec/contrib/sinatra/ext.rb +1 -0
- data/lib/datadog/appsec/contrib/sinatra/gateway/watcher.rb +1 -1
- data/lib/datadog/appsec/contrib/sinatra/patcher.rb +11 -8
- data/lib/datadog/appsec/extensions.rb +10 -0
- data/lib/datadog/appsec/processor.rb +18 -0
- data/lib/datadog/appsec/response.rb +54 -0
- data/lib/datadog/core/runtime/ext.rb +1 -1
- data/lib/datadog/opentracer/distributed_headers.rb +5 -7
- data/lib/datadog/opentracer/rack_propagator.rb +0 -3
- data/lib/datadog/opentracer/text_map_propagator.rb +5 -7
- data/lib/datadog/profiling/collectors/cpu_and_wall_time.rb +10 -4
- data/lib/datadog/profiling/collectors/cpu_and_wall_time_worker.rb +4 -0
- data/lib/datadog/profiling/collectors/old_stack.rb +7 -0
- data/lib/datadog/profiling/exporter.rb +5 -0
- data/lib/datadog/profiling/old_recorder.rb +8 -0
- data/lib/datadog/profiling/profiler.rb +7 -0
- data/lib/datadog/profiling/scheduler.rb +4 -7
- data/lib/datadog/profiling/stack_recorder.rb +22 -0
- data/lib/datadog/profiling/tasks/setup.rb +0 -7
- data/lib/datadog/tracing/contrib/delayed_job/plugin.rb +4 -0
- data/lib/datadog/tracing/contrib/grpc/datadog_interceptor/client.rb +2 -1
- data/lib/datadog/tracing/contrib/grpc/datadog_interceptor/server.rb +6 -12
- data/lib/datadog/tracing/contrib/grpc/distributed/fetcher.rb +27 -0
- data/lib/datadog/tracing/contrib/grpc/distributed/propagation.rb +38 -0
- data/lib/datadog/tracing/contrib/grpc/patcher.rb +0 -2
- data/lib/datadog/tracing/contrib/http/distributed/fetcher.rb +32 -0
- data/lib/datadog/tracing/contrib/http/distributed/propagation.rb +33 -0
- data/lib/datadog/tracing/contrib/kafka/consumer_event.rb +1 -0
- data/lib/datadog/tracing/contrib/kafka/events/produce_operation/send_messages.rb +1 -0
- data/lib/datadog/tracing/contrib/kafka/events/producer/deliver_messages.rb +1 -0
- data/lib/datadog/tracing/contrib/mongodb/subscribers.rb +2 -0
- data/lib/datadog/tracing/contrib/que/tracer.rb +2 -0
- data/lib/datadog/tracing/contrib/racecar/events/batch.rb +4 -1
- data/lib/datadog/tracing/contrib/racecar/events/message.rb +4 -1
- data/lib/datadog/tracing/contrib/rack/middlewares.rb +2 -0
- data/lib/datadog/tracing/contrib/redis/instrumentation.rb +2 -0
- data/lib/datadog/tracing/contrib/redis/integration.rb +2 -1
- data/lib/datadog/tracing/contrib/redis/patcher.rb +2 -3
- data/lib/datadog/tracing/contrib/resque/resque_job.rb +2 -0
- data/lib/datadog/tracing/contrib/shoryuken/tracer.rb +2 -0
- data/lib/datadog/tracing/contrib/sidekiq/client_tracer.rb +5 -0
- data/lib/datadog/tracing/contrib/sidekiq/server_tracer.rb +5 -0
- data/lib/datadog/tracing/contrib/sneakers/tracer.rb +2 -0
- data/lib/datadog/tracing/distributed/b3.rb +66 -0
- data/lib/datadog/tracing/distributed/b3_single.rb +66 -0
- data/lib/datadog/tracing/distributed/datadog.rb +153 -0
- data/lib/datadog/tracing/distributed/datadog_tags_codec.rb +1 -0
- data/lib/datadog/tracing/distributed/fetcher.rb +30 -0
- data/lib/datadog/tracing/distributed/headers/ext.rb +18 -16
- data/lib/datadog/tracing/distributed/helpers.rb +7 -6
- data/lib/datadog/tracing/distributed/propagation.rb +127 -0
- data/lib/datadog/tracing/propagation/http.rb +3 -106
- data/lib/datadog/tracing/trace_segment.rb +1 -1
- data/lib/ddtrace/transport/trace_formatter.rb +2 -5
- data/lib/ddtrace/version.rb +1 -1
- metadata +19 -14
- data/lib/datadog/tracing/distributed/headers/b3.rb +0 -55
- data/lib/datadog/tracing/distributed/headers/b3_single.rb +0 -67
- data/lib/datadog/tracing/distributed/headers/datadog.rb +0 -144
- data/lib/datadog/tracing/distributed/headers/parser.rb +0 -37
- data/lib/datadog/tracing/distributed/metadata/b3.rb +0 -55
- data/lib/datadog/tracing/distributed/metadata/b3_single.rb +0 -66
- data/lib/datadog/tracing/distributed/metadata/datadog.rb +0 -73
- data/lib/datadog/tracing/distributed/metadata/parser.rb +0 -34
- data/lib/datadog/tracing/propagation/grpc.rb +0 -98
@@ -1,98 +0,0 @@
|
|
1
|
-
# typed: false
|
2
|
-
|
3
|
-
require_relative '../distributed/metadata/datadog'
|
4
|
-
require_relative '../distributed/metadata/b3'
|
5
|
-
require_relative '../distributed/metadata/b3_single'
|
6
|
-
|
7
|
-
require_relative '../span'
|
8
|
-
require_relative '../trace_digest'
|
9
|
-
require_relative '../trace_operation'
|
10
|
-
|
11
|
-
module Datadog
|
12
|
-
module Tracing
|
13
|
-
module Propagation
|
14
|
-
# opentracing.io compliant methods for distributing trace headers
|
15
|
-
# between two or more distributed services. Note this is very close
|
16
|
-
# to the Propagation::HTTP; the key difference is the way gRPC handles
|
17
|
-
# header information (called "metadata") as it operates over HTTP2
|
18
|
-
module GRPC
|
19
|
-
PROPAGATION_STYLES = {
|
20
|
-
Configuration::Ext::Distributed::PROPAGATION_STYLE_B3 => Distributed::Metadata::B3,
|
21
|
-
Configuration::Ext::Distributed::PROPAGATION_STYLE_B3_SINGLE_HEADER => Distributed::Metadata::B3Single,
|
22
|
-
Configuration::Ext::Distributed::PROPAGATION_STYLE_DATADOG => Distributed::Metadata::Datadog
|
23
|
-
}.freeze
|
24
|
-
|
25
|
-
def self.inject!(digest, metadata)
|
26
|
-
return if digest.nil?
|
27
|
-
|
28
|
-
digest = digest.to_digest if digest.is_a?(TraceOperation)
|
29
|
-
|
30
|
-
Datadog.configuration.tracing.distributed_tracing.propagation_inject_style.each do |style|
|
31
|
-
propagator = PROPAGATION_STYLES[style]
|
32
|
-
begin
|
33
|
-
propagator.inject!(digest, metadata) unless propagator.nil?
|
34
|
-
rescue => e
|
35
|
-
Datadog.logger.error(
|
36
|
-
'Error injecting propagated trace headers into the environment. ' \
|
37
|
-
"Cause: #{e} Location: #{Array(e.backtrace).first}"
|
38
|
-
)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
def self.extract(metadata)
|
44
|
-
trace_digest = nil
|
45
|
-
dd_trace_digest = nil
|
46
|
-
|
47
|
-
Datadog.configuration.tracing.distributed_tracing.propagation_extract_style.each do |style|
|
48
|
-
propagator = PROPAGATION_STYLES[style]
|
49
|
-
|
50
|
-
next if propagator.nil?
|
51
|
-
|
52
|
-
# Extract trace headers
|
53
|
-
begin
|
54
|
-
extracted_trace_digest = propagator.extract(metadata)
|
55
|
-
rescue => e
|
56
|
-
Datadog.logger.error(
|
57
|
-
'Error extracting propagated trace headers from the environment. ' \
|
58
|
-
"Cause: #{e} Location: #{Array(e.backtrace).first}"
|
59
|
-
)
|
60
|
-
end
|
61
|
-
|
62
|
-
# Skip this style if no valid headers were found
|
63
|
-
next if extracted_trace_digest.nil?
|
64
|
-
|
65
|
-
# Keep track of the Datadog extract trace headers, we want to return
|
66
|
-
# this one if we have one
|
67
|
-
if extracted_trace_digest && style == Configuration::Ext::Distributed::PROPAGATION_STYLE_DATADOG
|
68
|
-
dd_trace_digest = extracted_trace_digest
|
69
|
-
end
|
70
|
-
|
71
|
-
# No previously extracted trace headers, use the one we just extracted
|
72
|
-
if trace_digest.nil?
|
73
|
-
trace_digest = extracted_trace_digest
|
74
|
-
else
|
75
|
-
unless trace_digest.trace_id == extracted_trace_digest.trace_id \
|
76
|
-
&& trace_digest.span_id == extracted_trace_digest.span_id
|
77
|
-
# Return an empty/new trace headers if we have a mismatch in values extracted
|
78
|
-
msg = "#{trace_digest.trace_id} != #{extracted_trace_digest.trace_id} && " \
|
79
|
-
"#{trace_digest.span_id} != #{extracted_trace_digest.span_id}"
|
80
|
-
Datadog.logger.debug(
|
81
|
-
"Cannot extract trace headers from HTTP: extracted trace headers differ, #{msg}"
|
82
|
-
)
|
83
|
-
# DEV: This will return from `self.extract` not this `each` block
|
84
|
-
return TraceDigest.new
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
# Return the extracted trace headers if we found one or else a new empty trace headers
|
90
|
-
# Always return the Datadog trace headers if one exists since it has more
|
91
|
-
# information than the B3 headers e.g. origin, expanded priority
|
92
|
-
# sampling values, etc
|
93
|
-
dd_trace_digest || trace_digest || nil
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|