ddtrace 0.34.1 → 0.36.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.circleci/config.yml +58 -9
- data/.circleci/images/primary/Dockerfile-jruby-9.2 +77 -0
- data/.rubocop.yml +4 -0
- data/Appraisals +9 -7
- data/CHANGELOG.md +89 -3
- data/Rakefile +11 -2
- data/ddtrace.gemspec +5 -3
- data/docker-compose.yml +35 -0
- data/docs/DevelopmentGuide.md +1 -1
- data/docs/GettingStarted.md +89 -36
- data/lib/ddtrace.rb +1 -1
- data/lib/ddtrace/buffer.rb +9 -9
- data/lib/ddtrace/chunker.rb +34 -0
- data/lib/ddtrace/configuration.rb +28 -5
- data/lib/ddtrace/configuration/base.rb +1 -1
- data/lib/ddtrace/configuration/components.rb +154 -0
- data/lib/ddtrace/configuration/options.rb +1 -1
- data/lib/ddtrace/configuration/settings.rb +131 -63
- data/lib/ddtrace/context.rb +6 -6
- data/lib/ddtrace/context_flush.rb +1 -1
- data/lib/ddtrace/contrib/action_cable/instrumentation.rb +1 -1
- data/lib/ddtrace/contrib/action_pack/action_controller/instrumentation.rb +2 -2
- data/lib/ddtrace/contrib/action_view/events/render_partial.rb +1 -1
- data/lib/ddtrace/contrib/action_view/events/render_template.rb +1 -1
- data/lib/ddtrace/contrib/action_view/instrumentation/partial_renderer.rb +1 -1
- data/lib/ddtrace/contrib/action_view/instrumentation/template_renderer.rb +2 -2
- data/lib/ddtrace/contrib/action_view/patcher.rb +1 -1
- data/lib/ddtrace/contrib/active_record/events/instantiation.rb +1 -1
- data/lib/ddtrace/contrib/active_record/events/sql.rb +1 -1
- data/lib/ddtrace/contrib/active_support/cache/instrumentation.rb +2 -2
- data/lib/ddtrace/contrib/active_support/notifications/subscription.rb +2 -2
- data/lib/ddtrace/contrib/analytics.rb +1 -1
- data/lib/ddtrace/contrib/configuration/settings.rb +1 -1
- data/lib/ddtrace/contrib/dalli/patcher.rb +1 -1
- data/lib/ddtrace/contrib/dalli/quantize.rb +1 -1
- data/lib/ddtrace/contrib/elasticsearch/patcher.rb +1 -1
- data/lib/ddtrace/contrib/excon/middleware.rb +2 -2
- data/lib/ddtrace/contrib/extensions.rb +29 -5
- data/lib/ddtrace/contrib/faraday/patcher.rb +1 -1
- data/lib/ddtrace/contrib/grape/endpoint.rb +5 -5
- data/lib/ddtrace/contrib/grape/patcher.rb +1 -1
- data/lib/ddtrace/contrib/grpc/datadog_interceptor/client.rb +1 -1
- data/lib/ddtrace/contrib/grpc/datadog_interceptor/server.rb +2 -2
- data/lib/ddtrace/contrib/grpc/patcher.rb +1 -1
- data/lib/ddtrace/contrib/http/circuit_breaker.rb +8 -32
- data/lib/ddtrace/contrib/http/instrumentation.rb +2 -2
- data/lib/ddtrace/contrib/mongodb/subscribers.rb +2 -2
- data/lib/ddtrace/contrib/patchable.rb +1 -1
- data/lib/ddtrace/contrib/patcher.rb +3 -3
- data/lib/ddtrace/contrib/presto/instrumentation.rb +3 -3
- data/lib/ddtrace/contrib/presto/patcher.rb +1 -1
- data/lib/ddtrace/contrib/rack/middlewares.rb +2 -2
- data/lib/ddtrace/contrib/rack/patcher.rb +2 -2
- data/lib/ddtrace/contrib/rack/request_queue.rb +1 -1
- data/lib/ddtrace/contrib/rails/configuration/settings.rb +14 -0
- data/lib/ddtrace/contrib/rails/framework.rb +54 -48
- data/lib/ddtrace/contrib/rails/integration.rb +1 -1
- data/lib/ddtrace/contrib/rake/instrumentation.rb +2 -2
- data/lib/ddtrace/contrib/redis/quantize.rb +1 -1
- data/lib/ddtrace/contrib/resque/resque_job.rb +2 -2
- data/lib/ddtrace/contrib/sidekiq/tracing.rb +1 -1
- data/lib/ddtrace/contrib/sinatra/env.rb +20 -0
- data/lib/ddtrace/contrib/sinatra/ext.rb +6 -0
- data/lib/ddtrace/contrib/sinatra/patcher.rb +1 -0
- data/lib/ddtrace/contrib/sinatra/tracer.rb +98 -35
- data/lib/ddtrace/contrib/sinatra/tracer_middleware.rb +16 -13
- data/lib/ddtrace/correlation.rb +9 -6
- data/lib/ddtrace/diagnostics/health.rb +2 -6
- data/lib/ddtrace/encoding.rb +13 -39
- data/lib/ddtrace/event.rb +1 -1
- data/lib/ddtrace/ext/correlation.rb +1 -0
- data/lib/ddtrace/ext/diagnostics.rb +2 -0
- data/lib/ddtrace/ext/environment.rb +1 -0
- data/lib/ddtrace/ext/forced_tracing.rb +1 -1
- data/lib/ddtrace/logger.rb +3 -44
- data/lib/ddtrace/metrics.rb +5 -5
- data/lib/ddtrace/monkey.rb +1 -1
- data/lib/ddtrace/opentracer/global_tracer.rb +1 -1
- data/lib/ddtrace/pin.rb +18 -17
- data/lib/ddtrace/pipeline.rb +1 -1
- data/lib/ddtrace/propagation/http_propagator.rb +2 -2
- data/lib/ddtrace/runtime/cgroup.rb +1 -1
- data/lib/ddtrace/runtime/container.rb +1 -1
- data/lib/ddtrace/runtime/metrics.rb +5 -2
- data/lib/ddtrace/sampler.rb +2 -2
- data/lib/ddtrace/sampling/rule.rb +1 -1
- data/lib/ddtrace/sampling/rule_sampler.rb +1 -1
- data/lib/ddtrace/span.rb +4 -4
- data/lib/ddtrace/sync_writer.rb +3 -8
- data/lib/ddtrace/tracer.rb +26 -31
- data/lib/ddtrace/transport/http.rb +1 -1
- data/lib/ddtrace/transport/http/api/instance.rb +4 -0
- data/lib/ddtrace/transport/http/builder.rb +3 -5
- data/lib/ddtrace/transport/http/client.rb +7 -64
- data/lib/ddtrace/transport/http/response.rb +1 -1
- data/lib/ddtrace/transport/http/statistics.rb +1 -1
- data/lib/ddtrace/transport/http/traces.rb +10 -7
- data/lib/ddtrace/transport/io.rb +1 -1
- data/lib/ddtrace/transport/io/client.rb +2 -2
- data/lib/ddtrace/transport/io/response.rb +3 -1
- data/lib/ddtrace/transport/io/traces.rb +50 -3
- data/lib/ddtrace/transport/parcel.rb +0 -4
- data/lib/ddtrace/transport/statistics.rb +2 -2
- data/lib/ddtrace/transport/traces.rb +160 -10
- data/lib/ddtrace/utils.rb +1 -1
- data/lib/ddtrace/version.rb +2 -2
- data/lib/ddtrace/workers.rb +5 -13
- data/lib/ddtrace/workers/async.rb +2 -2
- data/lib/ddtrace/workers/runtime_metrics.rb +47 -0
- data/lib/ddtrace/workers/trace_writer.rb +199 -0
- data/lib/ddtrace/writer.rb +20 -27
- metadata +22 -32
data/lib/ddtrace/context.rb
CHANGED
@@ -95,12 +95,12 @@ module Datadog
|
|
95
95
|
if @max_length > 0 && @trace.length >= @max_length
|
96
96
|
# Detach the span from any context, it's being dropped and ignored.
|
97
97
|
span.context = nil
|
98
|
-
Datadog
|
98
|
+
Datadog.logger.debug("context full, ignoring span #{span.name}")
|
99
99
|
|
100
100
|
# If overflow has already occurred, don't send this metric.
|
101
101
|
# Prevents metrics spam if buffer repeatedly overflows for the same trace.
|
102
102
|
unless @overflow
|
103
|
-
|
103
|
+
Datadog.health_metrics.error_context_overflow(1, tags: ["max_length:#{@max_length}"])
|
104
104
|
@overflow = true
|
105
105
|
end
|
106
106
|
|
@@ -124,14 +124,14 @@ module Datadog
|
|
124
124
|
set_current_span(span.parent)
|
125
125
|
return if span.tracer.nil?
|
126
126
|
if span.parent.nil? && !all_spans_finished?
|
127
|
-
if Datadog
|
127
|
+
if Datadog.configuration.diagnostics.debug
|
128
128
|
opened_spans = @trace.length - @finished_spans
|
129
|
-
Datadog
|
129
|
+
Datadog.logger.debug("root span #{span.name} closed but has #{opened_spans} unfinished spans:")
|
130
130
|
end
|
131
131
|
|
132
132
|
@trace.reject(&:finished?).group_by(&:name).each do |unfinished_span_name, unfinished_spans|
|
133
|
-
Datadog
|
134
|
-
|
133
|
+
Datadog.logger.debug("unfinished span: #{unfinished_spans.first}") if Datadog.configuration.diagnostics.debug
|
134
|
+
Datadog.health_metrics.error_unfinished_spans(
|
135
135
|
unfinished_spans.length,
|
136
136
|
tags: ["name:#{unfinished_span_name}"]
|
137
137
|
)
|
@@ -58,7 +58,7 @@ module Datadog
|
|
58
58
|
if trace[0]
|
59
59
|
context.annotate_for_flush!(trace[0])
|
60
60
|
else
|
61
|
-
Datadog
|
61
|
+
Datadog.logger.debug('Tried to retrieve trace from context, but got nothing. ' \
|
62
62
|
"Is there another consumer for this context? #{context.trace_id}")
|
63
63
|
end
|
64
64
|
|
@@ -18,7 +18,7 @@ module Datadog
|
|
18
18
|
rack_request_span = env[Datadog::Contrib::Rack::TraceMiddleware::RACK_REQUEST_SPAN]
|
19
19
|
rack_request_span.resource = span.resource if rack_request_span
|
20
20
|
rescue StandardError => e
|
21
|
-
Datadog
|
21
|
+
Datadog.logger.error("Error preparing span for ActionCable::Connection: #{e}")
|
22
22
|
end
|
23
23
|
|
24
24
|
super
|
@@ -24,7 +24,7 @@ module Datadog
|
|
24
24
|
tracing_context = payload.fetch(:tracing_context)
|
25
25
|
tracing_context[:dd_request_span] = span
|
26
26
|
rescue StandardError => e
|
27
|
-
Datadog
|
27
|
+
Datadog.logger.error(e.message)
|
28
28
|
end
|
29
29
|
|
30
30
|
def finish_processing(payload)
|
@@ -71,7 +71,7 @@ module Datadog
|
|
71
71
|
span.finish
|
72
72
|
end
|
73
73
|
rescue StandardError => e
|
74
|
-
Datadog
|
74
|
+
Datadog.logger.error(e.message)
|
75
75
|
end
|
76
76
|
|
77
77
|
def exception_controller?(payload)
|
@@ -54,7 +54,7 @@ module Datadog
|
|
54
54
|
# Measure service stats
|
55
55
|
Contrib::Analytics.set_measured(active_datadog_span)
|
56
56
|
rescue StandardError => e
|
57
|
-
Datadog
|
57
|
+
Datadog.logger.debug(e.message)
|
58
58
|
end
|
59
59
|
|
60
60
|
# execute the original function anyway
|
@@ -103,7 +103,7 @@ module Datadog
|
|
103
103
|
|
104
104
|
datadog_render_template(template, layout_name)
|
105
105
|
rescue StandardError => e
|
106
|
-
Datadog
|
106
|
+
Datadog.logger.debug(e.message)
|
107
107
|
end
|
108
108
|
|
109
109
|
# execute the original function anyway
|
@@ -38,7 +38,7 @@ module Datadog
|
|
38
38
|
::ActionView::Rendering.send(:prepend, Instrumentation::TemplateRenderer::Rails30)
|
39
39
|
::ActionView::Partials::PartialRenderer.send(:prepend, Instrumentation::PartialRenderer::RailsLessThan4)
|
40
40
|
else
|
41
|
-
Datadog
|
41
|
+
Datadog.logger.debug('Expected Template/Partial classes not found; template rendering disabled')
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
@@ -51,7 +51,7 @@ module Datadog
|
|
51
51
|
span.set_tag(Ext::TAG_INSTANTIATION_CLASS_NAME, payload.fetch(:class_name))
|
52
52
|
span.set_tag(Ext::TAG_INSTANTIATION_RECORD_COUNT, payload.fetch(:record_count))
|
53
53
|
rescue StandardError => e
|
54
|
-
Datadog
|
54
|
+
Datadog.logger.debug(e.message)
|
55
55
|
end
|
56
56
|
end
|
57
57
|
end
|
@@ -55,7 +55,7 @@ module Datadog
|
|
55
55
|
span.set_tag(Datadog::Ext::NET::TARGET_HOST, config[:host]) if config[:host]
|
56
56
|
span.set_tag(Datadog::Ext::NET::TARGET_PORT, config[:port]) if config[:port]
|
57
57
|
rescue StandardError => e
|
58
|
-
Datadog
|
58
|
+
Datadog.logger.debug(e.message)
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
@@ -31,7 +31,7 @@ module Datadog
|
|
31
31
|
span.resource = payload.fetch(:action)
|
32
32
|
tracing_context[:dd_cache_span] = span
|
33
33
|
rescue StandardError => e
|
34
|
-
Datadog
|
34
|
+
Datadog.logger.debug(e.message)
|
35
35
|
end
|
36
36
|
|
37
37
|
def finish_trace_cache(payload)
|
@@ -56,7 +56,7 @@ module Datadog
|
|
56
56
|
span.finish
|
57
57
|
end
|
58
58
|
rescue StandardError => e
|
59
|
-
Datadog
|
59
|
+
Datadog.logger.debug(e.message)
|
60
60
|
end
|
61
61
|
|
62
62
|
# Defines instrumentation for ActiveSupport cache reading
|
@@ -114,7 +114,7 @@ module Datadog
|
|
114
114
|
def run(span, name, id, payload)
|
115
115
|
run!(span, name, id, payload)
|
116
116
|
rescue StandardError => e
|
117
|
-
Datadog
|
117
|
+
Datadog.logger.debug("ActiveSupport::Notifications handler for '#{name}' failed: #{e.message}")
|
118
118
|
end
|
119
119
|
|
120
120
|
def run!(*args)
|
@@ -139,7 +139,7 @@ module Datadog
|
|
139
139
|
begin
|
140
140
|
callback.call(event, key, *args)
|
141
141
|
rescue StandardError => e
|
142
|
-
Datadog
|
142
|
+
Datadog.logger.debug(
|
143
143
|
"ActiveSupport::Notifications '#{key}' callback for '#{event}' failed: #{e.message}"
|
144
144
|
)
|
145
145
|
end
|
@@ -9,7 +9,7 @@ module Datadog
|
|
9
9
|
# Checks whether analytics should be enabled.
|
10
10
|
# `flag` is a truthy/falsey value that represents a setting on the integration.
|
11
11
|
def enabled?(flag = nil)
|
12
|
-
(Datadog.configuration.
|
12
|
+
(Datadog.configuration.analytics.enabled && flag != false) || flag == true
|
13
13
|
end
|
14
14
|
|
15
15
|
def set_sample_rate(span, sample_rate)
|
@@ -13,7 +13,7 @@ module Datadog
|
|
13
13
|
command = Utils.utf8_encode(command, binary: true, placeholder: placeholder)
|
14
14
|
Utils.truncate(command, Ext::QUANTIZE_MAX_CMD_LENGTH)
|
15
15
|
rescue => e
|
16
|
-
|
16
|
+
Datadog.logger.debug("Error sanitizing Dalli operation: #{e}")
|
17
17
|
placeholder
|
18
18
|
end
|
19
19
|
end
|
@@ -97,7 +97,7 @@ module Datadog
|
|
97
97
|
quantized_url = Datadog::Contrib::Elasticsearch::Quantize.format_url(url)
|
98
98
|
span.resource = "#{method} #{quantized_url}"
|
99
99
|
rescue StandardError => e
|
100
|
-
Datadog
|
100
|
+
Datadog.logger.error(e.message)
|
101
101
|
ensure
|
102
102
|
# the call is still executed
|
103
103
|
response = perform_request_without_datadog(*args)
|
@@ -34,7 +34,7 @@ module Datadog
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
rescue StandardError => e
|
37
|
-
Datadog
|
37
|
+
Datadog.logger.debug(e.message)
|
38
38
|
end
|
39
39
|
|
40
40
|
@stack.request_call(datum)
|
@@ -137,7 +137,7 @@ module Datadog
|
|
137
137
|
end
|
138
138
|
end
|
139
139
|
rescue StandardError => e
|
140
|
-
Datadog
|
140
|
+
Datadog.logger.debug(e.message)
|
141
141
|
end
|
142
142
|
|
143
143
|
def propagate!(span, datum)
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'set'
|
1
2
|
require 'ddtrace/contrib/registry'
|
2
3
|
|
3
4
|
module Datadog
|
@@ -7,6 +8,7 @@ module Datadog
|
|
7
8
|
module Extensions
|
8
9
|
def self.extended(base)
|
9
10
|
Datadog.send(:extend, Helpers)
|
11
|
+
Datadog.send(:extend, Configuration)
|
10
12
|
Datadog::Configuration::Settings.send(:include, Configuration::Settings)
|
11
13
|
end
|
12
14
|
|
@@ -17,7 +19,24 @@ module Datadog
|
|
17
19
|
end
|
18
20
|
end
|
19
21
|
|
22
|
+
# Configuration methods for Datadog module.
|
20
23
|
module Configuration
|
24
|
+
def configure(target = configuration, opts = {})
|
25
|
+
# Reconfigure core settings
|
26
|
+
super
|
27
|
+
|
28
|
+
# Activate integrations
|
29
|
+
if target.respond_to?(:integrations_pending_activation)
|
30
|
+
target.integrations_pending_activation.each do |integration|
|
31
|
+
integration.patch if integration.respond_to?(:patch)
|
32
|
+
end
|
33
|
+
|
34
|
+
target.integrations_pending_activation.clear
|
35
|
+
end
|
36
|
+
|
37
|
+
target
|
38
|
+
end
|
39
|
+
|
21
40
|
# Extensions for Datadog::Configuration::Settings
|
22
41
|
module Settings
|
23
42
|
InvalidIntegrationError = Class.new(StandardError)
|
@@ -34,22 +53,27 @@ module Datadog
|
|
34
53
|
integration.configuration(configuration_name) unless integration.nil?
|
35
54
|
end
|
36
55
|
|
37
|
-
def
|
56
|
+
def instrument(integration_name, options = {}, &block)
|
38
57
|
integration = fetch_integration(integration_name)
|
39
58
|
|
40
59
|
unless integration.nil?
|
41
60
|
configuration_name = options[:describes] || :default
|
42
61
|
filtered_options = options.reject { |k, _v| k == :describes }
|
43
62
|
integration.configure(configuration_name, filtered_options, &block)
|
44
|
-
end
|
45
63
|
|
46
|
-
|
64
|
+
# Add to activation list
|
65
|
+
integrations_pending_activation << integration
|
66
|
+
end
|
47
67
|
end
|
48
68
|
|
49
|
-
|
69
|
+
alias_method :use, :instrument
|
70
|
+
|
71
|
+
def integrations_pending_activation
|
72
|
+
@integrations_pending_activation ||= Set.new
|
73
|
+
end
|
50
74
|
|
51
75
|
def fetch_integration(name)
|
52
|
-
|
76
|
+
registry[name] ||
|
53
77
|
raise(InvalidIntegrationError, "'#{name}' is not a valid integration.")
|
54
78
|
end
|
55
79
|
end
|
@@ -46,7 +46,7 @@ module Datadog
|
|
46
46
|
|
47
47
|
Thread.current[KEY_RUN] = true
|
48
48
|
rescue StandardError => e
|
49
|
-
Datadog
|
49
|
+
Datadog.logger.error(e.message)
|
50
50
|
end
|
51
51
|
|
52
52
|
def endpoint_run(name, start, finish, id, payload)
|
@@ -99,7 +99,7 @@ module Datadog
|
|
99
99
|
span.finish(finish)
|
100
100
|
end
|
101
101
|
rescue StandardError => e
|
102
|
-
Datadog
|
102
|
+
Datadog.logger.error(e.message)
|
103
103
|
end
|
104
104
|
|
105
105
|
def endpoint_start_render(*)
|
@@ -115,7 +115,7 @@ module Datadog
|
|
115
115
|
|
116
116
|
Thread.current[KEY_RENDER] = true
|
117
117
|
rescue StandardError => e
|
118
|
-
Datadog
|
118
|
+
Datadog.logger.error(e.message)
|
119
119
|
end
|
120
120
|
|
121
121
|
def endpoint_render(name, start, finish, id, payload)
|
@@ -138,7 +138,7 @@ module Datadog
|
|
138
138
|
span.finish(finish)
|
139
139
|
end
|
140
140
|
rescue StandardError => e
|
141
|
-
Datadog
|
141
|
+
Datadog.logger.error(e.message)
|
142
142
|
end
|
143
143
|
|
144
144
|
def endpoint_run_filters(name, start, finish, id, payload)
|
@@ -173,7 +173,7 @@ module Datadog
|
|
173
173
|
span.finish(finish)
|
174
174
|
end
|
175
175
|
rescue StandardError => e
|
176
|
-
Datadog
|
176
|
+
Datadog.logger.error(e.message)
|
177
177
|
end
|
178
178
|
|
179
179
|
private
|
@@ -40,7 +40,7 @@ module Datadog
|
|
40
40
|
Datadog::GRPCPropagator
|
41
41
|
.inject!(span.context, metadata)
|
42
42
|
rescue StandardError => e
|
43
|
-
Datadog
|
43
|
+
Datadog.logger.debug("GRPC client trace failed: #{e}")
|
44
44
|
end
|
45
45
|
|
46
46
|
def format_resource(proto_method)
|
@@ -35,7 +35,7 @@ module Datadog
|
|
35
35
|
tracer.provider.context = Datadog::GRPCPropagator
|
36
36
|
.extract(metadata)
|
37
37
|
rescue StandardError => e
|
38
|
-
Datadog
|
38
|
+
Datadog.logger.debug(
|
39
39
|
"unable to propagate GRPC metadata to context: #{e}"
|
40
40
|
)
|
41
41
|
end
|
@@ -52,7 +52,7 @@ module Datadog
|
|
52
52
|
# Measure service stats
|
53
53
|
Contrib::Analytics.set_measured(span)
|
54
54
|
rescue StandardError => e
|
55
|
-
Datadog
|
55
|
+
Datadog.logger.debug("GRPC client trace failed: #{e}")
|
56
56
|
end
|
57
57
|
|
58
58
|
def reserved_headers
|
@@ -4,8 +4,8 @@ module Datadog
|
|
4
4
|
# HTTP integration circuit breaker behavior
|
5
5
|
# For avoiding recursive traces.
|
6
6
|
module CircuitBreaker
|
7
|
-
def should_skip_tracing?(
|
8
|
-
return true if datadog_http_request?(
|
7
|
+
def should_skip_tracing?(request, tracer)
|
8
|
+
return true if datadog_http_request?(request)
|
9
9
|
|
10
10
|
# we don't want a "shotgun" effect with two nested traces for one
|
11
11
|
# logical get, and request is likely to call itself recursively
|
@@ -16,38 +16,14 @@ module Datadog
|
|
16
16
|
end
|
17
17
|
|
18
18
|
# We don't want to trace our own call to the API (they use net/http)
|
19
|
-
# TODO: We don't want this kind of
|
19
|
+
# TODO: We don't want this kind of soft-check on HTTP requests.
|
20
20
|
# Remove this when transport implements its own "skip tracing" mechanism.
|
21
|
-
def datadog_http_request?(
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
# Get settings from transport, if available.
|
28
|
-
case transport
|
29
|
-
when Datadog::Transport::HTTP::Client
|
30
|
-
adapter = transport.current_api.adapter
|
31
|
-
if adapter.is_a?(Datadog::Transport::HTTP::Adapters::Net)
|
32
|
-
transport_hostname = adapter.hostname.to_s
|
33
|
-
transport_port = adapter.port.to_i
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
# When we know the host & port (from the URI) we use it, else (most-likely
|
38
|
-
# called with a block) rely on the URL at the end.
|
39
|
-
if req.respond_to?(:uri) && req.uri
|
40
|
-
if req.uri.host.to_s == transport_hostname &&
|
41
|
-
req.uri.port.to_i == transport_port
|
42
|
-
return true
|
43
|
-
end
|
44
|
-
elsif address && port &&
|
45
|
-
address.to_s == transport_hostname &&
|
46
|
-
port.to_i == transport_port
|
47
|
-
return true
|
21
|
+
def datadog_http_request?(request)
|
22
|
+
if request[Datadog::Ext::Transport::HTTP::HEADER_META_TRACER_VERSION]
|
23
|
+
true
|
24
|
+
else
|
25
|
+
false
|
48
26
|
end
|
49
|
-
|
50
|
-
false
|
51
27
|
end
|
52
28
|
|
53
29
|
def should_skip_distributed_tracing?(pin)
|