ddtrace 0.29.1 → 0.30.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +4 -0
- data/CHANGELOG.md +18 -1
- data/lib/ddtrace/context.rb +26 -10
- data/lib/ddtrace/contrib/action_pack/action_controller/patcher.rb +3 -15
- data/lib/ddtrace/contrib/action_pack/patcher.rb +3 -9
- data/lib/ddtrace/contrib/action_view/event.rb +39 -0
- data/lib/ddtrace/contrib/action_view/events.rb +30 -0
- data/lib/ddtrace/contrib/action_view/events/render_partial.rb +40 -0
- data/lib/ddtrace/contrib/action_view/events/render_template.rb +43 -0
- data/lib/ddtrace/contrib/action_view/instrumentation/partial_renderer.rb +4 -12
- data/lib/ddtrace/contrib/action_view/instrumentation/template_renderer.rb +6 -14
- data/lib/ddtrace/contrib/action_view/patcher.rb +19 -25
- data/lib/ddtrace/contrib/active_model_serializers/patcher.rb +3 -10
- data/lib/ddtrace/contrib/active_record/patcher.rb +3 -9
- data/lib/ddtrace/contrib/active_support/cache/patcher.rb +10 -24
- data/lib/ddtrace/contrib/active_support/patcher.rb +3 -9
- data/lib/ddtrace/contrib/aws/patcher.rb +7 -13
- data/lib/ddtrace/contrib/concurrent_ruby/patcher.rb +4 -11
- data/lib/ddtrace/contrib/dalli/patcher.rb +4 -10
- data/lib/ddtrace/contrib/delayed_job/patcher.rb +4 -10
- data/lib/ddtrace/contrib/elasticsearch/patcher.rb +8 -14
- data/lib/ddtrace/contrib/ethon/patcher.rb +7 -9
- data/lib/ddtrace/contrib/excon/patcher.rb +4 -11
- data/lib/ddtrace/contrib/faraday/patcher.rb +6 -12
- data/lib/ddtrace/contrib/grape/patcher.rb +7 -13
- data/lib/ddtrace/contrib/graphql/patcher.rb +5 -11
- data/lib/ddtrace/contrib/grpc/patcher.rb +7 -13
- data/lib/ddtrace/contrib/http/patcher.rb +3 -9
- data/lib/ddtrace/contrib/mongodb/patcher.rb +5 -11
- data/lib/ddtrace/contrib/mysql2/patcher.rb +3 -9
- data/lib/ddtrace/contrib/patcher.rb +38 -10
- data/lib/ddtrace/contrib/racecar/patcher.rb +4 -10
- data/lib/ddtrace/contrib/rack/patcher.rb +56 -21
- data/lib/ddtrace/contrib/rails/patcher.rb +4 -8
- data/lib/ddtrace/contrib/rake/patcher.rb +4 -10
- data/lib/ddtrace/contrib/redis/patcher.rb +8 -14
- data/lib/ddtrace/contrib/resque/patcher.rb +4 -10
- data/lib/ddtrace/contrib/rest_client/patcher.rb +5 -7
- data/lib/ddtrace/contrib/sequel/patcher.rb +4 -10
- data/lib/ddtrace/contrib/shoryuken/patcher.rb +4 -10
- data/lib/ddtrace/contrib/sidekiq/patcher.rb +12 -18
- data/lib/ddtrace/contrib/sinatra/patcher.rb +4 -10
- data/lib/ddtrace/contrib/sucker_punch/patcher.rb +7 -13
- data/lib/ddtrace/diagnostics/health.rb +9 -2
- data/lib/ddtrace/ext/diagnostics.rb +6 -0
- data/lib/ddtrace/ext/sampling.rb +13 -0
- data/lib/ddtrace/sampler.rb +49 -8
- data/lib/ddtrace/sampling.rb +2 -0
- data/lib/ddtrace/sampling/matcher.rb +57 -0
- data/lib/ddtrace/sampling/rate_limiter.rb +127 -0
- data/lib/ddtrace/sampling/rule.rb +61 -0
- data/lib/ddtrace/sampling/rule_sampler.rb +111 -0
- data/lib/ddtrace/span.rb +12 -0
- data/lib/ddtrace/tracer.rb +1 -0
- data/lib/ddtrace/version.rb +2 -2
- metadata +27 -4
@@ -12,19 +12,12 @@ module Datadog
|
|
12
12
|
|
13
13
|
module_function
|
14
14
|
|
15
|
-
def
|
16
|
-
|
15
|
+
def target_version
|
16
|
+
Integration.version
|
17
17
|
end
|
18
18
|
|
19
19
|
def patch
|
20
|
-
|
21
|
-
begin
|
22
|
-
# Subscribe to ActiveModelSerializers events
|
23
|
-
Events.subscribe!
|
24
|
-
rescue StandardError => e
|
25
|
-
Datadog::Tracer.log.error("Unable to apply ActiveModelSerializers integration: #{e}")
|
26
|
-
end
|
27
|
-
end
|
20
|
+
Events.subscribe!
|
28
21
|
end
|
29
22
|
|
30
23
|
def get_option(option)
|
@@ -10,18 +10,12 @@ module Datadog
|
|
10
10
|
|
11
11
|
module_function
|
12
12
|
|
13
|
-
def
|
14
|
-
|
13
|
+
def target_version
|
14
|
+
Integration.version
|
15
15
|
end
|
16
16
|
|
17
17
|
def patch
|
18
|
-
|
19
|
-
begin
|
20
|
-
Events.subscribe!
|
21
|
-
rescue StandardError => e
|
22
|
-
Datadog::Tracer.log.error("Unable to apply Active Record integration: #{e}")
|
23
|
-
end
|
24
|
-
end
|
18
|
+
Events.subscribe!
|
25
19
|
end
|
26
20
|
end
|
27
21
|
end
|
@@ -11,21 +11,15 @@ module Datadog
|
|
11
11
|
|
12
12
|
module_function
|
13
13
|
|
14
|
-
def
|
15
|
-
|
14
|
+
def target_version
|
15
|
+
Integration.version
|
16
16
|
end
|
17
17
|
|
18
18
|
def patch
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
patch_cache_store_write
|
24
|
-
patch_cache_store_delete
|
25
|
-
rescue StandardError => e
|
26
|
-
Datadog::Tracer.log.error("Unable to apply Active Support cache integration: #{e}")
|
27
|
-
end
|
28
|
-
end
|
19
|
+
patch_cache_store_read
|
20
|
+
patch_cache_store_fetch
|
21
|
+
patch_cache_store_write
|
22
|
+
patch_cache_store_delete
|
29
23
|
end
|
30
24
|
|
31
25
|
def cache_store_class(meth)
|
@@ -33,27 +27,19 @@ module Datadog
|
|
33
27
|
end
|
34
28
|
|
35
29
|
def patch_cache_store_read
|
36
|
-
|
37
|
-
cache_store_class(:read).send(:prepend, Cache::Instrumentation::Read)
|
38
|
-
end
|
30
|
+
cache_store_class(:read).send(:prepend, Cache::Instrumentation::Read)
|
39
31
|
end
|
40
32
|
|
41
33
|
def patch_cache_store_fetch
|
42
|
-
|
43
|
-
cache_store_class(:fetch).send(:prepend, Cache::Instrumentation::Fetch)
|
44
|
-
end
|
34
|
+
cache_store_class(:fetch).send(:prepend, Cache::Instrumentation::Fetch)
|
45
35
|
end
|
46
36
|
|
47
37
|
def patch_cache_store_write
|
48
|
-
|
49
|
-
cache_store_class(:write).send(:prepend, Cache::Instrumentation::Write)
|
50
|
-
end
|
38
|
+
cache_store_class(:write).send(:prepend, Cache::Instrumentation::Write)
|
51
39
|
end
|
52
40
|
|
53
41
|
def patch_cache_store_delete
|
54
|
-
|
55
|
-
cache_store_class(:delete).send(:prepend, Cache::Instrumentation::Delete)
|
56
|
-
end
|
42
|
+
cache_store_class(:delete).send(:prepend, Cache::Instrumentation::Delete)
|
57
43
|
end
|
58
44
|
end
|
59
45
|
end
|
@@ -10,18 +10,12 @@ module Datadog
|
|
10
10
|
|
11
11
|
module_function
|
12
12
|
|
13
|
-
def
|
14
|
-
|
13
|
+
def target_version
|
14
|
+
Integration.version
|
15
15
|
end
|
16
16
|
|
17
17
|
def patch
|
18
|
-
|
19
|
-
begin
|
20
|
-
Cache::Patcher.patch
|
21
|
-
rescue StandardError => e
|
22
|
-
Datadog::Tracer.log.error("Unable to apply Active Support integration: #{e}")
|
23
|
-
end
|
24
|
-
end
|
18
|
+
Cache::Patcher.patch
|
25
19
|
end
|
26
20
|
end
|
27
21
|
end
|
@@ -11,22 +11,16 @@ module Datadog
|
|
11
11
|
|
12
12
|
module_function
|
13
13
|
|
14
|
-
def
|
15
|
-
|
14
|
+
def target_version
|
15
|
+
Integration.version
|
16
16
|
end
|
17
17
|
|
18
18
|
def patch
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
add_plugin(Seahorse::Client::Base, *loaded_constants)
|
26
|
-
rescue StandardError => e
|
27
|
-
Datadog::Tracer.log.error("Unable to apply AWS integration: #{e}")
|
28
|
-
end
|
29
|
-
end
|
19
|
+
require 'ddtrace/contrib/aws/parsed_context'
|
20
|
+
require 'ddtrace/contrib/aws/instrumentation'
|
21
|
+
require 'ddtrace/contrib/aws/services'
|
22
|
+
|
23
|
+
add_plugin(Seahorse::Client::Base, *loaded_constants)
|
30
24
|
end
|
31
25
|
|
32
26
|
def add_plugin(*targets)
|
@@ -9,20 +9,13 @@ module Datadog
|
|
9
9
|
|
10
10
|
module_function
|
11
11
|
|
12
|
-
def
|
13
|
-
|
12
|
+
def target_version
|
13
|
+
Integration.version
|
14
14
|
end
|
15
15
|
|
16
16
|
def patch
|
17
|
-
|
18
|
-
|
19
|
-
require 'ddtrace/contrib/concurrent_ruby/future_patch'
|
20
|
-
|
21
|
-
patch_future
|
22
|
-
rescue StandardError => e
|
23
|
-
Datadog::Tracer.log.error("Unable to apply Future integration: #{e}")
|
24
|
-
end
|
25
|
-
end
|
17
|
+
require 'ddtrace/contrib/concurrent_ruby/future_patch'
|
18
|
+
patch_future
|
26
19
|
end
|
27
20
|
|
28
21
|
# Propagate tracing context in Concurrent::Future
|
@@ -12,19 +12,13 @@ module Datadog
|
|
12
12
|
|
13
13
|
module_function
|
14
14
|
|
15
|
-
def
|
16
|
-
|
15
|
+
def target_version
|
16
|
+
Integration.version
|
17
17
|
end
|
18
18
|
|
19
19
|
def patch
|
20
|
-
|
21
|
-
|
22
|
-
add_pin!
|
23
|
-
::Dalli::Server.send(:include, Instrumentation)
|
24
|
-
rescue StandardError => e
|
25
|
-
Datadog::Tracer.log.error("Unable to apply Dalli integration: #{e}")
|
26
|
-
end
|
27
|
-
end
|
20
|
+
add_pin!
|
21
|
+
::Dalli::Server.send(:include, Instrumentation)
|
28
22
|
end
|
29
23
|
|
30
24
|
# DEPRECATED: Only kept for users still using `Dalli.datadog_pin` to configure.
|
@@ -10,19 +10,13 @@ module Datadog
|
|
10
10
|
|
11
11
|
module_function
|
12
12
|
|
13
|
-
def
|
14
|
-
|
13
|
+
def target_version
|
14
|
+
Integration.version
|
15
15
|
end
|
16
16
|
|
17
17
|
def patch
|
18
|
-
|
19
|
-
|
20
|
-
require 'ddtrace/contrib/delayed_job/plugin'
|
21
|
-
add_instrumentation(::Delayed::Worker)
|
22
|
-
rescue StandardError => e
|
23
|
-
Datadog::Tracer.log.error("Unable to apply DelayedJob integration: #{e}")
|
24
|
-
end
|
25
|
-
end
|
18
|
+
require 'ddtrace/contrib/delayed_job/plugin'
|
19
|
+
add_instrumentation(::Delayed::Worker)
|
26
20
|
end
|
27
21
|
|
28
22
|
def add_instrumentation(klass)
|
@@ -13,23 +13,17 @@ module Datadog
|
|
13
13
|
|
14
14
|
module_function
|
15
15
|
|
16
|
-
def
|
17
|
-
|
16
|
+
def target_version
|
17
|
+
Integration.version
|
18
18
|
end
|
19
19
|
|
20
20
|
def patch
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
patch_elasticsearch_transport_client
|
29
|
-
rescue StandardError => e
|
30
|
-
Datadog::Tracer.log.error("Unable to apply Elasticsearch integration: #{e}")
|
31
|
-
end
|
32
|
-
end
|
21
|
+
require 'uri'
|
22
|
+
require 'json'
|
23
|
+
require 'ddtrace/pin'
|
24
|
+
require 'ddtrace/contrib/elasticsearch/quantize'
|
25
|
+
|
26
|
+
patch_elasticsearch_transport_client
|
33
27
|
end
|
34
28
|
|
35
29
|
# rubocop:disable Metrics/MethodLength
|
@@ -7,19 +7,17 @@ module Datadog
|
|
7
7
|
|
8
8
|
module_function
|
9
9
|
|
10
|
-
def
|
11
|
-
|
10
|
+
def target_version
|
11
|
+
Integration.version
|
12
12
|
end
|
13
13
|
|
14
14
|
def patch
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
require 'ddtrace/contrib/ethon/multi_patch'
|
15
|
+
require 'ddtrace/ext/app_types'
|
16
|
+
require 'ddtrace/contrib/ethon/easy_patch'
|
17
|
+
require 'ddtrace/contrib/ethon/multi_patch'
|
19
18
|
|
20
|
-
|
21
|
-
|
22
|
-
end
|
19
|
+
::Ethon::Easy.send(:include, EasyPatch)
|
20
|
+
::Ethon::Multi.send(:include, MultiPatch)
|
23
21
|
end
|
24
22
|
end
|
25
23
|
end
|
@@ -9,20 +9,13 @@ module Datadog
|
|
9
9
|
|
10
10
|
module_function
|
11
11
|
|
12
|
-
def
|
13
|
-
|
12
|
+
def target_version
|
13
|
+
Integration.version
|
14
14
|
end
|
15
15
|
|
16
16
|
def patch
|
17
|
-
|
18
|
-
|
19
|
-
require 'ddtrace/contrib/excon/middleware'
|
20
|
-
|
21
|
-
add_middleware
|
22
|
-
rescue StandardError => e
|
23
|
-
Datadog::Tracer.log.error("Unable to apply Excon integration: #{e}")
|
24
|
-
end
|
25
|
-
end
|
17
|
+
require 'ddtrace/contrib/excon/middleware'
|
18
|
+
add_middleware
|
26
19
|
end
|
27
20
|
|
28
21
|
def add_middleware
|
@@ -12,22 +12,16 @@ module Datadog
|
|
12
12
|
|
13
13
|
module_function
|
14
14
|
|
15
|
-
def
|
16
|
-
|
15
|
+
def target_version
|
16
|
+
Integration.version
|
17
17
|
end
|
18
18
|
|
19
19
|
def patch
|
20
|
-
|
21
|
-
begin
|
22
|
-
require 'ddtrace/contrib/faraday/middleware'
|
20
|
+
require 'ddtrace/contrib/faraday/middleware'
|
23
21
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
rescue StandardError => e
|
28
|
-
Datadog::Tracer.log.error("Unable to apply Faraday integration: #{e}")
|
29
|
-
end
|
30
|
-
end
|
22
|
+
add_pin!
|
23
|
+
register_middleware!
|
24
|
+
add_default_middleware!
|
31
25
|
end
|
32
26
|
|
33
27
|
def add_pin!
|
@@ -14,24 +14,18 @@ module Datadog
|
|
14
14
|
|
15
15
|
module_function
|
16
16
|
|
17
|
-
def
|
18
|
-
|
17
|
+
def target_version
|
18
|
+
Integration.version
|
19
19
|
end
|
20
20
|
|
21
21
|
def patch
|
22
|
-
|
23
|
-
|
24
|
-
# Patch endpoints
|
25
|
-
::Grape::Endpoint.send(:include, Instrumentation)
|
22
|
+
# Patch endpoints
|
23
|
+
::Grape::Endpoint.send(:include, Instrumentation)
|
26
24
|
|
27
|
-
|
25
|
+
add_pin!
|
28
26
|
|
29
|
-
|
30
|
-
|
31
|
-
rescue StandardError => e
|
32
|
-
Datadog::Tracer.log.error("Unable to apply Grape integration: #{e}")
|
33
|
-
end
|
34
|
-
end
|
27
|
+
# Subscribe to ActiveSupport events
|
28
|
+
Datadog::Contrib::Grape::Endpoint.subscribe
|
35
29
|
end
|
36
30
|
|
37
31
|
def add_pin!
|
@@ -9,22 +9,16 @@ module Datadog
|
|
9
9
|
|
10
10
|
module_function
|
11
11
|
|
12
|
-
def
|
13
|
-
|
12
|
+
def target_version
|
13
|
+
Integration.version
|
14
14
|
end
|
15
15
|
|
16
16
|
def patch
|
17
17
|
return if get_option(:schemas).nil?
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
require 'ddtrace/ext/http'
|
23
|
-
get_option(:schemas).each { |s| patch_schema!(s) }
|
24
|
-
rescue StandardError => e
|
25
|
-
Datadog::Tracer.log.error("Unable to apply GraphQL integration: #{e}")
|
26
|
-
end
|
27
|
-
end
|
19
|
+
require 'ddtrace/ext/app_types'
|
20
|
+
require 'ddtrace/ext/http'
|
21
|
+
get_option(:schemas).each { |s| patch_schema!(s) }
|
28
22
|
end
|
29
23
|
|
30
24
|
def patch_schema!(schema)
|
@@ -10,24 +10,18 @@ module Datadog
|
|
10
10
|
|
11
11
|
module_function
|
12
12
|
|
13
|
-
def
|
14
|
-
|
13
|
+
def target_version
|
14
|
+
Integration.version
|
15
15
|
end
|
16
16
|
|
17
17
|
def patch
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
require 'ddtrace/contrib/grpc/datadog_interceptor'
|
22
|
-
require 'ddtrace/contrib/grpc/intercept_with_datadog'
|
18
|
+
require 'ddtrace/propagation/grpc_propagator'
|
19
|
+
require 'ddtrace/contrib/grpc/datadog_interceptor'
|
20
|
+
require 'ddtrace/contrib/grpc/intercept_with_datadog'
|
23
21
|
|
24
|
-
|
22
|
+
add_pin!
|
25
23
|
|
26
|
-
|
27
|
-
rescue StandardError => e
|
28
|
-
Datadog::Tracer.log.error("Unable to apply gRPC integration: #{e}")
|
29
|
-
end
|
30
|
-
end
|
24
|
+
prepend_interceptor
|
31
25
|
end
|
32
26
|
|
33
27
|
def add_pin!
|
@@ -12,19 +12,13 @@ module Datadog
|
|
12
12
|
|
13
13
|
module_function
|
14
14
|
|
15
|
-
def
|
16
|
-
|
15
|
+
def target_version
|
16
|
+
Integration.version
|
17
17
|
end
|
18
18
|
|
19
19
|
# patch applies our patch if needed
|
20
20
|
def patch
|
21
|
-
|
22
|
-
begin
|
23
|
-
::Net::HTTP.send(:include, Instrumentation)
|
24
|
-
rescue StandardError => e
|
25
|
-
Datadog::Tracer.log.error("Unable to apply net/http integration: #{e}")
|
26
|
-
end
|
27
|
-
end
|
21
|
+
::Net::HTTP.send(:include, Instrumentation)
|
28
22
|
end
|
29
23
|
end
|
30
24
|
end
|