ddtrace 0.11.0.beta2 → 0.11.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/.rspec +1 -0
- data/Appraisals +11 -11
- data/Gemfile +3 -0
- data/README.md +1 -1
- data/Rakefile +67 -5
- data/ddtrace.gemspec +6 -4
- data/docs/GettingStarted.md +239 -432
- data/gemfiles/contrib.gemfile +2 -1
- data/gemfiles/contrib_old.gemfile +5 -3
- data/gemfiles/rails30_postgres.gemfile +1 -0
- data/gemfiles/rails30_postgres_sidekiq.gemfile +1 -0
- data/gemfiles/rails32_mysql2.gemfile +1 -0
- data/gemfiles/rails32_postgres.gemfile +1 -0
- data/gemfiles/rails32_postgres_redis.gemfile +1 -0
- data/gemfiles/rails32_postgres_sidekiq.gemfile +1 -0
- data/gemfiles/rails4_mysql2.gemfile +1 -0
- data/gemfiles/rails4_postgres.gemfile +2 -1
- data/gemfiles/rails4_postgres_redis.gemfile +2 -1
- data/gemfiles/rails4_postgres_sidekiq.gemfile +2 -1
- data/gemfiles/rails5_mysql2.gemfile +1 -0
- data/gemfiles/rails5_postgres.gemfile +2 -1
- data/gemfiles/rails5_postgres_redis.gemfile +3 -2
- data/gemfiles/rails5_postgres_sidekiq.gemfile +2 -1
- data/lib/ddtrace.rb +6 -2
- data/lib/ddtrace/configuration.rb +2 -0
- data/lib/ddtrace/configuration/pin_setup.rb +30 -0
- data/lib/ddtrace/contrib/active_record/patcher.rb +6 -0
- data/lib/ddtrace/contrib/aws/patcher.rb +3 -4
- data/lib/ddtrace/contrib/dalli/patcher.rb +3 -4
- data/lib/ddtrace/contrib/dalli/quantize.rb +5 -2
- data/lib/ddtrace/contrib/elasticsearch/patcher.rb +0 -1
- data/lib/ddtrace/contrib/faraday/patcher.rb +6 -5
- data/lib/ddtrace/contrib/grape/patcher.rb +0 -3
- data/lib/ddtrace/contrib/mongodb/patcher.rb +0 -3
- data/lib/ddtrace/contrib/rack/patcher.rb +12 -4
- data/lib/ddtrace/contrib/rails/active_record.rb +2 -5
- data/lib/ddtrace/contrib/rails/active_support.rb +2 -1
- data/lib/ddtrace/contrib/rails/core_extensions.rb +24 -7
- data/lib/ddtrace/contrib/rails/utils.rb +6 -4
- data/lib/ddtrace/contrib/redis/patcher.rb +7 -20
- data/lib/ddtrace/contrib/redis/quantize.rb +4 -4
- data/lib/ddtrace/contrib/resque/patcher.rb +3 -3
- data/lib/ddtrace/contrib/resque/resque_job.rb +0 -1
- data/lib/ddtrace/contrib/sidekiq/patcher.rb +33 -0
- data/lib/ddtrace/contrib/sidekiq/tracer.rb +1 -15
- data/lib/ddtrace/contrib/sucker_punch/patcher.rb +1 -2
- data/lib/ddtrace/error.rb +3 -13
- data/lib/ddtrace/ext/cache.rb +1 -0
- data/lib/ddtrace/ext/priority.rb +16 -0
- data/lib/ddtrace/monkey.rb +1 -0
- data/lib/ddtrace/pin.rb +17 -9
- data/lib/ddtrace/sampler.rb +4 -2
- data/lib/ddtrace/utils.rb +22 -3
- metadata +41 -9
|
@@ -83,24 +83,30 @@ module Datadog
|
|
|
83
83
|
def patch_partial_renderer(klass)
|
|
84
84
|
klass.class_eval do
|
|
85
85
|
def render_with_datadog(*args, &block)
|
|
86
|
-
#
|
|
87
|
-
|
|
88
|
-
Datadog::Contrib::Rails::ActionView.start_render_partial(tracing_context:
|
|
86
|
+
# Create a tracing context and start the rendering span
|
|
87
|
+
tracing_context = {}
|
|
88
|
+
Datadog::Contrib::Rails::ActionView.start_render_partial(tracing_context: tracing_context)
|
|
89
|
+
tracing_contexts[current_span_id] = tracing_context
|
|
90
|
+
|
|
89
91
|
render_without_datadog(*args)
|
|
90
92
|
rescue Exception => e
|
|
91
93
|
# attach the exception to the tracing context if any
|
|
92
|
-
|
|
94
|
+
tracing_contexts[current_span_id][:exception] = e
|
|
93
95
|
raise e
|
|
94
96
|
ensure
|
|
95
|
-
#
|
|
96
|
-
|
|
97
|
+
# Ensure that the template `Span` is finished even during exceptions
|
|
98
|
+
# Remove the existing tracing context (to avoid leaks)
|
|
99
|
+
tracing_contexts.delete(current_span_id)
|
|
100
|
+
|
|
101
|
+
# Then finish the span associated with the context
|
|
102
|
+
Datadog::Contrib::Rails::ActionView.finish_render_partial(tracing_context: tracing_context)
|
|
97
103
|
end
|
|
98
104
|
|
|
99
105
|
def render_partial_with_datadog(*args)
|
|
100
106
|
begin
|
|
101
107
|
# update the tracing context with computed values before the rendering
|
|
102
108
|
template_name = Datadog::Contrib::Rails::Utils.normalize_template_name(@template.try('identifier'))
|
|
103
|
-
|
|
109
|
+
tracing_contexts[current_span_id][:template_name] = template_name
|
|
104
110
|
rescue StandardError => e
|
|
105
111
|
Datadog::Tracer.log.debug(e.message)
|
|
106
112
|
end
|
|
@@ -109,6 +115,17 @@ module Datadog
|
|
|
109
115
|
render_partial_without_datadog(*args)
|
|
110
116
|
end
|
|
111
117
|
|
|
118
|
+
# Table of tracing contexts, one per partial/span, keyed by span_id
|
|
119
|
+
# because there will be multiple concurrent contexts, depending on how
|
|
120
|
+
# many partials are nested within one another.
|
|
121
|
+
def tracing_contexts
|
|
122
|
+
@tracing_contexts ||= {}
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
def current_span_id
|
|
126
|
+
Datadog.configuration[:rails][:tracer].call_context.current_span.span_id
|
|
127
|
+
end
|
|
128
|
+
|
|
112
129
|
# method aliasing to patch the class
|
|
113
130
|
alias_method :render_without_datadog, :render
|
|
114
131
|
alias_method :render, :render_with_datadog
|
|
@@ -63,10 +63,12 @@ module Datadog
|
|
|
63
63
|
end
|
|
64
64
|
|
|
65
65
|
def self.connection_config
|
|
66
|
-
|
|
67
|
-
::ActiveRecord::Base.connection_config
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
@connection_config ||= begin
|
|
67
|
+
if defined?(::ActiveRecord::Base.connection_config)
|
|
68
|
+
::ActiveRecord::Base.connection_config
|
|
69
|
+
else
|
|
70
|
+
::ActiveRecord::Base.connection_pool.spec.config
|
|
71
|
+
end
|
|
70
72
|
end
|
|
71
73
|
end
|
|
72
74
|
|
|
@@ -12,6 +12,7 @@ module Datadog
|
|
|
12
12
|
include Base
|
|
13
13
|
register_as :redis, auto_patch: true
|
|
14
14
|
option :service_name, default: SERVICE
|
|
15
|
+
option :tracer, default: Datadog.tracer
|
|
15
16
|
|
|
16
17
|
@patched = false
|
|
17
18
|
|
|
@@ -19,8 +20,7 @@ module Datadog
|
|
|
19
20
|
|
|
20
21
|
# patch applies our patch if needed
|
|
21
22
|
def patch
|
|
22
|
-
if !@patched &&
|
|
23
|
-
Gem::Version.new(::Redis::VERSION) >= Gem::Version.new('3.0.0'))
|
|
23
|
+
if !@patched && compatible?
|
|
24
24
|
begin
|
|
25
25
|
# do not require these by default, but only when actually patching
|
|
26
26
|
require 'ddtrace/monkey'
|
|
@@ -28,8 +28,7 @@ module Datadog
|
|
|
28
28
|
require 'ddtrace/contrib/redis/tags'
|
|
29
29
|
require 'ddtrace/contrib/redis/quantize'
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
patch_redis_client()
|
|
31
|
+
patch_redis_client
|
|
33
32
|
@patched = true
|
|
34
33
|
RailsCachePatcher.reload_cache_store if Datadog.registry[:rails].patched?
|
|
35
34
|
rescue StandardError => e
|
|
@@ -39,18 +38,8 @@ module Datadog
|
|
|
39
38
|
@patched
|
|
40
39
|
end
|
|
41
40
|
|
|
42
|
-
def
|
|
43
|
-
::Redis.
|
|
44
|
-
def datadog_pin=(pin)
|
|
45
|
-
# Forward the pin to client, which actually traces calls.
|
|
46
|
-
Datadog::Pin.onto(client, pin)
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def datadog_pin
|
|
50
|
-
# Get the pin from client, which actually traces calls.
|
|
51
|
-
Datadog::Pin.get_from(client)
|
|
52
|
-
end
|
|
53
|
-
end
|
|
41
|
+
def compatible?
|
|
42
|
+
defined?(::Redis::VERSION) && Gem::Version.new(::Redis::VERSION) >= Gem::Version.new('3.0.0')
|
|
54
43
|
end
|
|
55
44
|
|
|
56
45
|
# rubocop:disable Metrics/MethodLength
|
|
@@ -64,11 +53,9 @@ module Datadog
|
|
|
64
53
|
|
|
65
54
|
def initialize(*args)
|
|
66
55
|
service = Datadog.configuration[:redis][:service_name]
|
|
67
|
-
|
|
56
|
+
tracer = Datadog.configuration[:redis][:tracer]
|
|
57
|
+
pin = Datadog::Pin.new(service, app: 'redis', app_type: Datadog::Ext::AppTypes::DB, tracer: tracer)
|
|
68
58
|
pin.onto(self)
|
|
69
|
-
if pin.tracer && pin.service
|
|
70
|
-
pin.tracer.set_service_info(pin.service, pin.app, pin.app_type)
|
|
71
|
-
end
|
|
72
59
|
initialize_without_datadog(*args)
|
|
73
60
|
end
|
|
74
61
|
|
|
@@ -5,16 +5,16 @@ module Datadog
|
|
|
5
5
|
module Quantize
|
|
6
6
|
PLACEHOLDER = '?'.freeze
|
|
7
7
|
TOO_LONG_MARK = '...'.freeze
|
|
8
|
-
VALUE_MAX_LEN =
|
|
9
|
-
CMD_MAX_LEN =
|
|
8
|
+
VALUE_MAX_LEN = 50
|
|
9
|
+
CMD_MAX_LEN = 500
|
|
10
10
|
|
|
11
11
|
module_function
|
|
12
12
|
|
|
13
13
|
def format_arg(arg)
|
|
14
14
|
str = arg.is_a?(Symbol) ? arg.to_s.upcase : arg.to_s
|
|
15
|
-
str =
|
|
15
|
+
str = Utils.utf8_encode(str, binary: true, placeholder: PLACEHOLDER)
|
|
16
16
|
Utils.truncate(str, VALUE_MAX_LEN, TOO_LONG_MARK)
|
|
17
|
-
rescue
|
|
17
|
+
rescue => e
|
|
18
18
|
Datadog::Tracer.log.debug("non formattable Redis arg #{str}: #{e}")
|
|
19
19
|
PLACEHOLDER
|
|
20
20
|
end
|
|
@@ -40,9 +40,9 @@ module Datadog
|
|
|
40
40
|
private
|
|
41
41
|
|
|
42
42
|
def add_pin
|
|
43
|
-
Pin
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
Pin
|
|
44
|
+
.new(get_option(:service_name), app: 'resque', app_type: Ext::AppTypes::WORKER)
|
|
45
|
+
.onto(::Resque)
|
|
46
46
|
end
|
|
47
47
|
end
|
|
48
48
|
end
|
|
@@ -25,7 +25,6 @@ end
|
|
|
25
25
|
Resque.before_first_fork do
|
|
26
26
|
pin = Datadog::Pin.get_from(Resque)
|
|
27
27
|
next unless pin && pin.tracer
|
|
28
|
-
pin.tracer.set_service_info(pin.service, 'resque', Datadog::Ext::AppTypes::WORKER)
|
|
29
28
|
|
|
30
29
|
# Create SyncWriter instance before forking
|
|
31
30
|
sync_writer = Datadog::SyncWriter.new(transport: pin.tracer.writer.transport)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module Datadog
|
|
2
|
+
module Contrib
|
|
3
|
+
module Sidekiq
|
|
4
|
+
# Provides instrumentation support for Sidekiq
|
|
5
|
+
module Patcher
|
|
6
|
+
include Base
|
|
7
|
+
VERSION_REQUIRED = Gem::Version.new('4.0.0')
|
|
8
|
+
register_as :sidekiq
|
|
9
|
+
option :service_name, default: 'sidekiq'
|
|
10
|
+
option :tracer, default: Datadog.tracer
|
|
11
|
+
|
|
12
|
+
module_function
|
|
13
|
+
|
|
14
|
+
def patch
|
|
15
|
+
return unless compatible?
|
|
16
|
+
|
|
17
|
+
require_relative 'tracer'
|
|
18
|
+
|
|
19
|
+
::Sidekiq.configure_server do |config|
|
|
20
|
+
config.server_middleware do |chain|
|
|
21
|
+
chain.add(Sidekiq::Tracer)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def compatible?
|
|
27
|
+
defined?(::Sidekiq) &&
|
|
28
|
+
Gem::Version.new(::Sidekiq::VERSION) >= VERSION_REQUIRED
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -2,25 +2,11 @@ require 'sidekiq/api'
|
|
|
2
2
|
|
|
3
3
|
require 'ddtrace/ext/app_types'
|
|
4
4
|
|
|
5
|
-
sidekiq_vs = Gem::Version.new(Sidekiq::VERSION)
|
|
6
|
-
sidekiq_min_vs = Gem::Version.new('4.0.0')
|
|
7
|
-
if sidekiq_vs < sidekiq_min_vs
|
|
8
|
-
raise "sidekiq version #{sidekiq_vs} is not supported yet " \
|
|
9
|
-
+ "(supporting versions >=#{sidekiq_min_vs})"
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
Datadog::Tracer.log.debug("Activating instrumentation for Sidekiq '#{sidekiq_vs}'")
|
|
13
|
-
|
|
14
5
|
module Datadog
|
|
15
6
|
module Contrib
|
|
16
7
|
module Sidekiq
|
|
17
|
-
#
|
|
8
|
+
# Tracer is a Sidekiq server-side middleware which traces executed jobs
|
|
18
9
|
class Tracer
|
|
19
|
-
include Base
|
|
20
|
-
register_as :sidekiq
|
|
21
|
-
option :service_name, default: 'sidekiq'
|
|
22
|
-
option :tracer, default: Datadog.tracer
|
|
23
|
-
|
|
24
10
|
def initialize(options = {})
|
|
25
11
|
config = Datadog.configuration[:sidekiq].merge(options)
|
|
26
12
|
@tracer = config[:tracer]
|
|
@@ -24,7 +24,6 @@ module Datadog
|
|
|
24
24
|
add_pin!
|
|
25
25
|
ExceptionHandler.patch!
|
|
26
26
|
Instrumentation.patch!
|
|
27
|
-
Datadog.tracer.set_service_info(get_option(:service_name), 'sucker_punch', Ext::AppTypes::WORKER)
|
|
28
27
|
|
|
29
28
|
@patched = true
|
|
30
29
|
rescue => e
|
|
@@ -43,7 +42,7 @@ module Datadog
|
|
|
43
42
|
end
|
|
44
43
|
|
|
45
44
|
def add_pin!
|
|
46
|
-
Pin.new(get_option(:service_name), app_type: Ext::AppTypes::WORKER).tap do |pin|
|
|
45
|
+
Pin.new(get_option(:service_name), app: 'sucker_punch', app_type: Ext::AppTypes::WORKER).tap do |pin|
|
|
47
46
|
pin.onto(::SuckerPunch)
|
|
48
47
|
end
|
|
49
48
|
end
|
data/lib/ddtrace/error.rb
CHANGED
|
@@ -16,19 +16,9 @@ module Datadog
|
|
|
16
16
|
|
|
17
17
|
def initialize(type = nil, message = nil, backtrace = nil)
|
|
18
18
|
backtrace = Array(backtrace).join("\n")
|
|
19
|
-
@type =
|
|
20
|
-
@message =
|
|
21
|
-
@backtrace =
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
private
|
|
25
|
-
|
|
26
|
-
def sanitize(value)
|
|
27
|
-
value = value.to_s
|
|
28
|
-
|
|
29
|
-
return value if value.encoding == ::Encoding::UTF_8
|
|
30
|
-
|
|
31
|
-
value.encode(::Encoding::UTF_8)
|
|
19
|
+
@type = Utils.utf8_encode(type)
|
|
20
|
+
@message = Utils.utf8_encode(message)
|
|
21
|
+
@backtrace = Utils.utf8_encode(backtrace)
|
|
32
22
|
end
|
|
33
23
|
|
|
34
24
|
BlankError = Error.new
|
data/lib/ddtrace/ext/cache.rb
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module Datadog
|
|
2
|
+
module Ext
|
|
3
|
+
# Priority is a hint given to the backend so that it knows which traces to reject or kept.
|
|
4
|
+
# In a distributed context, it should be set before any context propagation (fork, RPC calls) to be effective.
|
|
5
|
+
module Priority
|
|
6
|
+
# Use this to explicitely inform the backend that a trace should be rejected and not stored.
|
|
7
|
+
USER_REJECT = -1
|
|
8
|
+
# Used by the builtin sampler to inform the backend that a trace should be rejected and not stored.
|
|
9
|
+
AUTO_REJECT = 0
|
|
10
|
+
# Used by the builtin sampler to inform the backend that a trace should be kept and stored.
|
|
11
|
+
AUTO_KEEP = 1
|
|
12
|
+
# Use this to explicitely inform the backend that a trace should be kept and stored.
|
|
13
|
+
USER_KEEP = 2
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
data/lib/ddtrace/monkey.rb
CHANGED
|
@@ -18,6 +18,7 @@ require 'ddtrace/contrib/mongodb/patcher'
|
|
|
18
18
|
require 'ddtrace/contrib/dalli/patcher'
|
|
19
19
|
require 'ddtrace/contrib/resque/patcher'
|
|
20
20
|
require 'ddtrace/contrib/racecar/patcher'
|
|
21
|
+
require 'ddtrace/contrib/sidekiq/patcher'
|
|
21
22
|
|
|
22
23
|
module Datadog
|
|
23
24
|
# Monkey is used for monkey-patching 3rd party libs.
|
data/lib/ddtrace/pin.rb
CHANGED
|
@@ -10,7 +10,7 @@ module Datadog
|
|
|
10
10
|
obj.datadog_pin
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
attr_accessor :
|
|
13
|
+
attr_accessor :service_name
|
|
14
14
|
attr_accessor :app
|
|
15
15
|
attr_accessor :tags
|
|
16
16
|
attr_accessor :app_type
|
|
@@ -18,15 +18,14 @@ module Datadog
|
|
|
18
18
|
attr_accessor :tracer
|
|
19
19
|
attr_accessor :config
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
@
|
|
24
|
-
@
|
|
25
|
-
@tags = options.fetch(:tags, nil)
|
|
26
|
-
@app_type = options.fetch(:app_type, nil)
|
|
21
|
+
def initialize(service_name, options = {})
|
|
22
|
+
@app = options[:app]
|
|
23
|
+
@tags = options[:tags]
|
|
24
|
+
@app_type = options[:app_type]
|
|
27
25
|
@name = nil # this would rarely be overriden as it's really span-specific
|
|
28
26
|
@tracer = options[:tracer] || Datadog.tracer
|
|
29
|
-
@config = options
|
|
27
|
+
@config = options[:config]
|
|
28
|
+
self.service_name = service_name
|
|
30
29
|
end
|
|
31
30
|
|
|
32
31
|
def enabled?
|
|
@@ -55,8 +54,17 @@ module Datadog
|
|
|
55
54
|
obj.datadog_pin = self
|
|
56
55
|
end
|
|
57
56
|
|
|
57
|
+
def service_name=(name)
|
|
58
|
+
tracer.set_service_info(name, app, app_type) if name && app && app_type
|
|
59
|
+
|
|
60
|
+
@service_name = name
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
alias service= service_name=
|
|
64
|
+
alias service service_name
|
|
65
|
+
|
|
58
66
|
def to_s
|
|
59
|
-
"Pin(service:#{
|
|
67
|
+
"Pin(service:#{service},app:#{app},app_type:#{app_type},name:#{name})"
|
|
60
68
|
end
|
|
61
69
|
end
|
|
62
70
|
end
|
data/lib/ddtrace/sampler.rb
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
require 'forwardable'
|
|
2
2
|
|
|
3
|
+
require 'ddtrace/ext/priority'
|
|
4
|
+
|
|
3
5
|
module Datadog
|
|
4
6
|
# \Sampler performs client-side trace sampling.
|
|
5
7
|
class Sampler
|
|
@@ -96,10 +98,10 @@ module Datadog
|
|
|
96
98
|
end
|
|
97
99
|
|
|
98
100
|
def sample(span)
|
|
99
|
-
span.context.sampling_priority =
|
|
101
|
+
span.context.sampling_priority = Datadog::Ext::Priority::AUTO_REJECT if span.context
|
|
100
102
|
return unless @base_sampler.sample(span)
|
|
101
103
|
return unless @post_sampler.sample(span)
|
|
102
|
-
span.context.sampling_priority =
|
|
104
|
+
span.context.sampling_priority = Datadog::Ext::Priority::AUTO_KEEP if span.context
|
|
103
105
|
|
|
104
106
|
true
|
|
105
107
|
end
|
data/lib/ddtrace/utils.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
module Datadog
|
|
2
2
|
# Utils contains low-level utilities, typically to provide pseudo-random trace IDs.
|
|
3
3
|
module Utils
|
|
4
|
+
STRING_PLACEHOLDER = ''.encode(::Encoding::UTF_8).freeze
|
|
4
5
|
# We use a custom random number generator because we want no interference
|
|
5
6
|
# with the default one. Using the default prng, we could break code that
|
|
6
7
|
# would rely on srand/rand sequences.
|
|
@@ -21,6 +22,10 @@ module Datadog
|
|
|
21
22
|
Process.pid != @pid
|
|
22
23
|
end
|
|
23
24
|
|
|
25
|
+
private_class_method :reset!, :was_forked?
|
|
26
|
+
|
|
27
|
+
reset!
|
|
28
|
+
|
|
24
29
|
def self.truncate(value, size, omission = '...')
|
|
25
30
|
string = value.to_s
|
|
26
31
|
|
|
@@ -29,8 +34,22 @@ module Datadog
|
|
|
29
34
|
string.slice(0, size - omission.size) + omission
|
|
30
35
|
end
|
|
31
36
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
def self.utf8_encode(str, options = {})
|
|
38
|
+
str = str.to_s
|
|
39
|
+
|
|
40
|
+
if options[:binary]
|
|
41
|
+
# This option is useful for "gracefully" displaying binary data that
|
|
42
|
+
# often contains text such as marshalled objects
|
|
43
|
+
str.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')
|
|
44
|
+
elsif str.encoding == ::Encoding::UTF_8
|
|
45
|
+
str
|
|
46
|
+
else
|
|
47
|
+
str.encode(::Encoding::UTF_8)
|
|
48
|
+
end
|
|
49
|
+
rescue => e
|
|
50
|
+
Tracer.log.debug("Error encoding string in UTF-8: #{e}")
|
|
51
|
+
|
|
52
|
+
options.fetch(:placeholder, STRING_PLACEHOLDER)
|
|
53
|
+
end
|
|
35
54
|
end
|
|
36
55
|
end
|
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: 0.11.0
|
|
4
|
+
version: 0.11.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Datadog, Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2018-01-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: msgpack
|
|
@@ -52,6 +52,34 @@ dependencies:
|
|
|
52
52
|
- - '='
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: 0.49.1
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: rspec
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '3.0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '3.0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: rspec-collection_matchers
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - "~>"
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '1.1'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - "~>"
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '1.1'
|
|
55
83
|
- !ruby/object:Gem::Dependency
|
|
56
84
|
name: minitest
|
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -154,28 +182,28 @@ dependencies:
|
|
|
154
182
|
name: pry
|
|
155
183
|
requirement: !ruby/object:Gem::Requirement
|
|
156
184
|
requirements:
|
|
157
|
-
- - "
|
|
185
|
+
- - "~>"
|
|
158
186
|
- !ruby/object:Gem::Version
|
|
159
187
|
version: 0.10.4
|
|
160
188
|
type: :development
|
|
161
189
|
prerelease: false
|
|
162
190
|
version_requirements: !ruby/object:Gem::Requirement
|
|
163
191
|
requirements:
|
|
164
|
-
- - "
|
|
192
|
+
- - "~>"
|
|
165
193
|
- !ruby/object:Gem::Version
|
|
166
194
|
version: 0.10.4
|
|
167
195
|
- !ruby/object:Gem::Dependency
|
|
168
196
|
name: pry-stack_explorer
|
|
169
197
|
requirement: !ruby/object:Gem::Requirement
|
|
170
198
|
requirements:
|
|
171
|
-
- - "
|
|
199
|
+
- - "~>"
|
|
172
200
|
- !ruby/object:Gem::Version
|
|
173
201
|
version: 0.4.9.2
|
|
174
202
|
type: :development
|
|
175
203
|
prerelease: false
|
|
176
204
|
version_requirements: !ruby/object:Gem::Requirement
|
|
177
205
|
requirements:
|
|
178
|
-
- - "
|
|
206
|
+
- - "~>"
|
|
179
207
|
- !ruby/object:Gem::Version
|
|
180
208
|
version: 0.4.9.2
|
|
181
209
|
description: |
|
|
@@ -190,6 +218,7 @@ extra_rdoc_files: []
|
|
|
190
218
|
files:
|
|
191
219
|
- ".env"
|
|
192
220
|
- ".gitignore"
|
|
221
|
+
- ".rspec"
|
|
193
222
|
- ".rubocop.yml"
|
|
194
223
|
- ".yardopts"
|
|
195
224
|
- Appraisals
|
|
@@ -221,6 +250,7 @@ files:
|
|
|
221
250
|
- lib/ddtrace/buffer.rb
|
|
222
251
|
- lib/ddtrace/configurable.rb
|
|
223
252
|
- lib/ddtrace/configuration.rb
|
|
253
|
+
- lib/ddtrace/configuration/pin_setup.rb
|
|
224
254
|
- lib/ddtrace/configuration/proxy.rb
|
|
225
255
|
- lib/ddtrace/configuration/resolver.rb
|
|
226
256
|
- lib/ddtrace/context.rb
|
|
@@ -261,6 +291,7 @@ files:
|
|
|
261
291
|
- lib/ddtrace/contrib/redis/tags.rb
|
|
262
292
|
- lib/ddtrace/contrib/resque/patcher.rb
|
|
263
293
|
- lib/ddtrace/contrib/resque/resque_job.rb
|
|
294
|
+
- lib/ddtrace/contrib/sidekiq/patcher.rb
|
|
264
295
|
- lib/ddtrace/contrib/sidekiq/tracer.rb
|
|
265
296
|
- lib/ddtrace/contrib/sinatra/tracer.rb
|
|
266
297
|
- lib/ddtrace/contrib/sucker_punch/exception_handler.rb
|
|
@@ -275,6 +306,7 @@ files:
|
|
|
275
306
|
- lib/ddtrace/ext/http.rb
|
|
276
307
|
- lib/ddtrace/ext/mongo.rb
|
|
277
308
|
- lib/ddtrace/ext/net.rb
|
|
309
|
+
- lib/ddtrace/ext/priority.rb
|
|
278
310
|
- lib/ddtrace/ext/redis.rb
|
|
279
311
|
- lib/ddtrace/ext/sql.rb
|
|
280
312
|
- lib/ddtrace/logger.rb
|
|
@@ -313,12 +345,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
313
345
|
version: 1.9.1
|
|
314
346
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
315
347
|
requirements:
|
|
316
|
-
- - "
|
|
348
|
+
- - ">="
|
|
317
349
|
- !ruby/object:Gem::Version
|
|
318
|
-
version:
|
|
350
|
+
version: '0'
|
|
319
351
|
requirements: []
|
|
320
352
|
rubyforge_project:
|
|
321
|
-
rubygems_version: 2.
|
|
353
|
+
rubygems_version: 2.6.14
|
|
322
354
|
signing_key:
|
|
323
355
|
specification_version: 4
|
|
324
356
|
summary: Datadog tracing code for your Ruby applications
|