ddtrace 0.35.2 → 0.36.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9f9f3da5a5aec215ac1141352d819ad2126dc5334d2ca7c16a98a93c0853def6
4
- data.tar.gz: d1a751907768587840896e49945413dcc7682ebb41cc149ccbacdfb34af24687
3
+ metadata.gz: d7736a0630cef1812e8e2a69fa420a97913cf9c1c47e1c173e0039c6e12558f0
4
+ data.tar.gz: 4eb212df3b7c240a3d8ddf83555fe862cffad98208c037d2cab4120c9a6a7217
5
5
  SHA512:
6
- metadata.gz: 85895df7a3bc35105d02d8eaacf669b8a8dc7bf4c9c0e6de5fecdd13a28a33f84154c203f71863501a34fa3633e9f69d93b30b898c88da28c6cd20c3d440a8df
7
- data.tar.gz: 842367ce941fb9d572c74edd78901b4787f0bde39f37ad6de1b5e0fa18525f4166f23ede14dcc11af02fda4ad5b88fa7c4defb39a39e7afdd969063c4ad23606
6
+ metadata.gz: 8fc864b6eb9180e82c5362f45b3ffe05d4d5e4a845372a158293c8514e9b574d59930f84fdea86f534f50faf9cca15167ad25a2b8985699143d2f3b78578b919
7
+ data.tar.gz: e1cd1855fcf6b31579b84c93a2477a47c87d8a9fdbd0361de59be09969825eb5afd0daa79802036d03c04a3b747a7cff214e74b5053d3108b0fd8b86dd97efff
@@ -67,6 +67,10 @@ Metrics/PerceivedComplexity:
67
67
  Lint/UnusedMethodArgument:
68
68
  Enabled: false
69
69
 
70
+ # alias and alias_method are not equivalent
71
+ Style/Alias:
72
+ Enabled: false
73
+
70
74
  # Disabling advices that would lead to incompatible Ruby 1.9 code
71
75
  Style/SymbolArray:
72
76
  Enabled: false
data/Appraisals CHANGED
@@ -292,33 +292,33 @@ elsif Gem::Version.new('2.2.0') <= Gem::Version.new(RUBY_VERSION) \
292
292
  end
293
293
 
294
294
  appraise 'rails5-mysql2' do
295
- gem 'rails', '~> 5.2.1', '!= 5.2.4.1', '!= 5.2.4.2'
295
+ gem 'rails', '5.2.3'
296
296
  gem 'mysql2', '< 1', platform: :ruby
297
297
  gem 'sprockets', '< 4'
298
298
  end
299
299
 
300
300
  appraise 'rails5-postgres' do
301
- gem 'rails', '~> 5.2.1', '!= 5.2.4.1', '!= 5.2.4.2'
301
+ gem 'rails', '5.2.3'
302
302
  gem 'pg', '< 1.0', platform: :ruby
303
303
  gem 'sprockets', '< 4'
304
304
  end
305
305
 
306
306
  appraise 'rails5-postgres-redis' do
307
- gem 'rails', '~> 5.2.1', '!= 5.2.4.1', '!= 5.2.4.2'
307
+ gem 'rails', '5.2.3'
308
308
  gem 'pg', '< 1.0', platform: :ruby
309
309
  gem 'redis', '>= 4.0.1'
310
310
  gem 'sprockets', '< 4'
311
311
  end
312
312
 
313
313
  appraise 'rails5-postgres-redis-activesupport' do
314
- gem 'rails', '~> 5.2.1', '!= 5.2.4.1', '!= 5.2.4.2'
314
+ gem 'rails', '5.2.3'
315
315
  gem 'pg', '< 1.0', platform: :ruby
316
316
  gem 'redis', '>= 4.0.1'
317
317
  gem 'sprockets', '< 4'
318
318
  end
319
319
 
320
320
  appraise 'rails5-postgres-sidekiq' do
321
- gem 'rails', '~> 5.2.1', '!= 5.2.4.1', '!= 5.2.4.2'
321
+ gem 'rails', '5.2.3'
322
322
  gem 'pg', '< 1.0', platform: :ruby
323
323
  gem 'sidekiq'
324
324
  gem 'activejob'
@@ -342,7 +342,7 @@ elsif Gem::Version.new('2.2.0') <= Gem::Version.new(RUBY_VERSION) \
342
342
  gem 'faraday'
343
343
  gem 'grape'
344
344
  gem 'graphql', '< 1.9.4'
345
- gem 'grpc'
345
+ gem 'grpc', '~> 1.21.0' # Last version to support Ruby < 2.3
346
346
  gem 'hiredis'
347
347
  gem 'mongo', '>= 2.8.0'
348
348
  gem 'mysql2', '< 0.5', platform: :ruby
@@ -501,6 +501,7 @@ elsif Gem::Version.new('2.3.0') <= Gem::Version.new(RUBY_VERSION) \
501
501
  gem 'grape'
502
502
  gem 'graphql'
503
503
  gem 'grpc'
504
+ gem 'google-protobuf', '~> 3.11.0' # Last version to support Ruby < 2.5
504
505
  gem 'hiredis'
505
506
  gem 'mongo', '>= 2.8.0'
506
507
  gem 'mysql2', '< 0.5', platform: :ruby
@@ -579,6 +580,7 @@ elsif Gem::Version.new('2.4.0') <= Gem::Version.new(RUBY_VERSION) \
579
580
  gem 'grape'
580
581
  gem 'graphql'
581
582
  gem 'grpc'
583
+ gem 'google-protobuf', '~> 3.11.0' # Last version to support Ruby < 2.5
582
584
  gem 'hiredis'
583
585
  gem 'mongo', '>= 2.8.0'
584
586
  gem 'mysql2', '< 0.5', platform: :ruby
@@ -2,6 +2,25 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.36.0] - 2020-05-27
6
+
7
+ Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.36.0
8
+
9
+ Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.35.2...v0.36.0
10
+
11
+ ### Changed
12
+
13
+ - Prevent trace components from being re-initialized multiple times during setup (#1037)
14
+
15
+ ### Fixed
16
+
17
+ - Allow Rails patching if Railties are loaded (#993, #1054) (@mustela, @bheemreddy181, @vramaiah)
18
+ - Pin delegates to default tracer unless configured (#1041)
19
+
20
+ ### Refactored
21
+
22
+ - Improvements to test suite (#1027, #1031, #1045, #1046, #1047)
23
+
5
24
  ## [0.35.2] - 2020-05-08
6
25
 
7
26
  Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.35.2
@@ -1216,7 +1235,8 @@ Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.3.1
1216
1235
 
1217
1236
  Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
1218
1237
 
1219
- [Unreleased]: https://github.com/DataDog/dd-trace-rb/compare/v0.35.2...master
1238
+ [Unreleased]: https://github.com/DataDog/dd-trace-rb/compare/v0.36.0...master
1239
+ [0.36.0]: https://github.com/DataDog/dd-trace-rb/compare/v0.35.2...v0.36.0
1220
1240
  [0.35.2]: https://github.com/DataDog/dd-trace-rb/compare/v0.35.1...v0.35.2
1221
1241
  [0.35.1]: https://github.com/DataDog/dd-trace-rb/compare/v0.35.0...v0.35.1
1222
1242
  [0.35.0]: https://github.com/DataDog/dd-trace-rb/compare/v0.34.2...v0.35.0
@@ -1,5 +1,6 @@
1
1
  version: '3.2'
2
2
  services:
3
+ # MRI
3
4
  tracer-2.0:
4
5
  image: palazzem/docker-library:ddtrace_rb_2_0_0
5
6
  command: /bin/bash
@@ -247,6 +248,38 @@ services:
247
248
  - .:/app
248
249
  - bundle-2.7:/usr/local/bundle
249
250
  - gemfiles-2.7:/app/gemfiles
251
+ # JRuby
252
+ tracer-jruby-9.2:
253
+ image: marcotc/docker-library:ddtrace_rb_jruby_9_2
254
+ command: /bin/bash
255
+ depends_on:
256
+ - ddagent
257
+ - elasticsearch
258
+ - memcached
259
+ - mongodb
260
+ - mysql
261
+ - postgres
262
+ - presto
263
+ - redis
264
+ env_file: ./.env
265
+ environment:
266
+ - BUNDLE_GEMFILE=/app/Gemfile
267
+ - DD_AGENT_HOST=ddagent
268
+ - TEST_DATADOG_INTEGRATION=1
269
+ - TEST_ELASTICSEARCH_HOST=elasticsearch
270
+ - TEST_MEMCACHED_HOST=memcached
271
+ - TEST_MONGODB_HOST=mongodb
272
+ - TEST_MYSQL_HOST=mysql
273
+ - TEST_POSTGRES_HOST=postgres
274
+ - TEST_PRESTO_HOST=presto
275
+ - TEST_PRESTO_PORT=8080
276
+ - TEST_REDIS_HOST=redis
277
+ stdin_open: true
278
+ tty: true
279
+ volumes:
280
+ - .:/app
281
+ - bundle-jruby-9.2:/usr/local/bundle
282
+ - gemfiles-jruby-9.2:/app/gemfiles
250
283
  ddagent:
251
284
  image: datadog/docker-dd-agent
252
285
  environment:
@@ -325,6 +358,7 @@ volumes:
325
358
  bundle-2.5:
326
359
  bundle-2.6:
327
360
  bundle-2.7:
361
+ bundle-jruby-9.2:
328
362
  gemfiles-2.0:
329
363
  gemfiles-2.1:
330
364
  gemfiles-2.2:
@@ -333,3 +367,4 @@ volumes:
333
367
  gemfiles-2.5:
334
368
  gemfiles-2.6:
335
369
  gemfiles-2.7:
370
+ gemfiles-jruby-9.2:
@@ -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 use(integration_name, options = {}, &block)
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
- integration.patch if integration.respond_to?(:patch)
64
+ # Add to activation list
65
+ integrations_pending_activation << integration
66
+ end
47
67
  end
48
68
 
49
- private
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
- get_option(:registry)[name] ||
76
+ registry[name] ||
53
77
  raise(InvalidIntegrationError, "'#{name}' is not a valid integration.")
54
78
  end
55
79
  end
@@ -85,6 +85,7 @@ module Datadog
85
85
  Datadog.configuration[:active_support][:tracer] = value
86
86
  Datadog.configuration[:action_pack][:tracer] = value
87
87
  Datadog.configuration[:action_view][:tracer] = value
88
+ Datadog.configuration[:rack][:tracer] = value
88
89
  end
89
90
  end
90
91
  end
@@ -21,23 +21,32 @@ module Datadog
21
21
  module Framework
22
22
  # configure Datadog settings
23
23
  def self.setup
24
- config = config_with_defaults
25
-
26
- activate_rack!(config)
27
- activate_action_cable!(config)
28
- activate_active_support!(config)
29
- activate_action_pack!(config)
30
- activate_action_view!(config)
31
- activate_active_record!(config)
32
-
33
- # By default, default service would be guessed from the script
34
- # being executed, but here we know better, get it from Rails config.
35
- # Don't set this if service has been explicitly provided by the user.
36
- Datadog.configuration.service ||= config[:service_name]
24
+ rails_config = config_with_defaults
25
+
26
+ # NOTE: #configure has the side effect of rebuilding trace components.
27
+ # During a typical Rails application lifecycle, we will see trace
28
+ # components initialized twice because of this. This is necessary
29
+ # because key configuration is not available until after the Rails
30
+ # application has fully loaded, and some of this configuration is
31
+ # used to reconfigure tracer components with Rails-sourced defaults.
32
+ # This is a trade-off we take to get nice defaults.
33
+ Datadog.configure do |datadog_config|
34
+ # By default, default service would be guessed from the script
35
+ # being executed, but here we know better, get it from Rails config.
36
+ # Don't set this if service has been explicitly provided by the user.
37
+ datadog_config.service ||= rails_config[:service_name]
38
+
39
+ activate_rack!(datadog_config, rails_config)
40
+ activate_action_cable!(datadog_config, rails_config)
41
+ activate_active_support!(datadog_config, rails_config)
42
+ activate_action_pack!(datadog_config, rails_config)
43
+ activate_action_view!(datadog_config, rails_config)
44
+ activate_active_record!(datadog_config, rails_config)
45
+ end
37
46
 
38
47
  # Update the tracer if its not the default tracer.
39
- if config[:tracer] != Datadog.configuration.tracer
40
- config[:tracer].default_service = config[:service_name]
48
+ if rails_config[:tracer] != Datadog.configuration.tracer
49
+ rails_config[:tracer].default_service = rails_config[:service_name]
41
50
  end
42
51
  end
43
52
 
@@ -52,64 +61,68 @@ module Datadog
52
61
  end
53
62
  end
54
63
 
55
- def self.activate_rack!(config)
56
- Datadog.configuration.use(
64
+ def self.activate_rack!(datadog_config, rails_config)
65
+ datadog_config.use(
57
66
  :rack,
58
- tracer: config[:tracer],
67
+ tracer: rails_config[:tracer],
59
68
  application: ::Rails.application,
60
- service_name: config[:service_name],
61
- middleware_names: config[:middleware_names],
62
- distributed_tracing: config[:distributed_tracing]
69
+ service_name: rails_config[:service_name],
70
+ middleware_names: rails_config[:middleware_names],
71
+ distributed_tracing: rails_config[:distributed_tracing]
63
72
  )
64
73
  end
65
74
 
66
- def self.activate_active_support!(config)
75
+ def self.activate_active_support!(datadog_config, rails_config)
67
76
  return unless defined?(::ActiveSupport)
68
77
 
69
- Datadog.configuration.use(
78
+ datadog_config.use(
70
79
  :active_support,
71
- cache_service: config[:cache_service],
72
- tracer: config[:tracer]
80
+ cache_service: rails_config[:cache_service],
81
+ tracer: rails_config[:tracer]
73
82
  )
74
83
  end
75
84
 
76
- def self.activate_action_cable!(config)
85
+ def self.activate_action_cable!(datadog_config, rails_config)
77
86
  return unless defined?(::ActionCable)
78
87
 
79
- Datadog.configuration.use(
88
+ datadog_config.use(
80
89
  :action_cable,
81
- service_name: "#{config[:service_name]}-#{Contrib::ActionCable::Ext::SERVICE_NAME}",
82
- tracer: config[:tracer]
90
+ service_name: "#{rails_config[:service_name]}-#{Contrib::ActionCable::Ext::SERVICE_NAME}",
91
+ tracer: rails_config[:tracer]
83
92
  )
84
93
  end
85
94
 
86
- def self.activate_action_pack!(config)
95
+ def self.activate_action_pack!(datadog_config, rails_config)
87
96
  return unless defined?(::ActionPack)
88
97
 
89
- Datadog.configuration.use(
98
+ # TODO: This is configuring ActionPack but not patching. It will queue ActionPack
99
+ # for patching, but patching won't take place until Datadog.configure completes.
100
+ # Should we manually patch here?
101
+
102
+ datadog_config.use(
90
103
  :action_pack,
91
- service_name: config[:service_name],
92
- tracer: config[:tracer]
104
+ service_name: rails_config[:service_name],
105
+ tracer: rails_config[:tracer]
93
106
  )
94
107
  end
95
108
 
96
- def self.activate_action_view!(config)
109
+ def self.activate_action_view!(datadog_config, rails_config)
97
110
  return unless defined?(::ActionView)
98
111
 
99
- Datadog.configuration.use(
112
+ datadog_config.use(
100
113
  :action_view,
101
- service_name: config[:service_name],
102
- tracer: config[:tracer]
114
+ service_name: rails_config[:service_name],
115
+ tracer: rails_config[:tracer]
103
116
  )
104
117
  end
105
118
 
106
- def self.activate_active_record!(config)
119
+ def self.activate_active_record!(datadog_config, rails_config)
107
120
  return unless defined?(::ActiveRecord)
108
121
 
109
- Datadog.configuration.use(
122
+ datadog_config.use(
110
123
  :active_record,
111
- service_name: config[:database_service],
112
- tracer: config[:tracer]
124
+ service_name: rails_config[:database_service],
125
+ tracer: rails_config[:tracer]
113
126
  )
114
127
  end
115
128
  end
@@ -16,7 +16,7 @@ module Datadog
16
16
  register_as :rails, auto_patch: false
17
17
 
18
18
  def self.version
19
- Gem.loaded_specs['rails'] && Gem.loaded_specs['rails'].version
19
+ Gem.loaded_specs['railties'] && Gem.loaded_specs['railties'].version
20
20
  end
21
21
 
22
22
  def self.loaded?
@@ -12,26 +12,34 @@ module Datadog
12
12
  obj.datadog_pin
13
13
  end
14
14
 
15
- attr_reader :service_name
16
15
  attr_accessor :app
17
- attr_accessor :tags
18
16
  attr_accessor :app_type
19
- attr_accessor :name
20
- attr_accessor :tracer
21
17
  attr_accessor :config
18
+ attr_accessor :name
19
+ attr_accessor :service_name
20
+ attr_accessor :tags
21
+ attr_writer :tracer
22
+ attr_accessor :writer
23
+
24
+ alias service= service_name=
25
+ alias service service_name
22
26
 
23
27
  def initialize(service_name, options = {})
24
28
  @app = options[:app]
25
- @tags = options[:tags]
26
29
  @app_type = options[:app_type]
27
- @name = nil # this would rarely be overriden as it's really span-specific
28
- @tracer = options[:tracer] || Datadog.tracer
29
30
  @config = options[:config]
30
- self.service_name = service_name
31
+ @name = nil # this would rarely be overriden as it's really span-specific
32
+ @service_name = service_name
33
+ @tags = options[:tags]
34
+ @tracer = options[:tracer]
35
+ end
36
+
37
+ def tracer
38
+ @tracer || Datadog.tracer
31
39
  end
32
40
 
33
41
  def enabled?
34
- return @tracer.enabled if @tracer
42
+ return tracer.enabled if tracer
35
43
  false
36
44
  end
37
45
 
@@ -56,13 +64,6 @@ module Datadog
56
64
  obj.datadog_pin = self
57
65
  end
58
66
 
59
- def service_name=(name)
60
- @service_name = name
61
- end
62
-
63
- alias service= service_name=
64
- alias service service_name
65
-
66
67
  def to_s
67
68
  "Pin(service:#{service},app:#{app},app_type:#{app_type},name:#{name})"
68
69
  end
@@ -1,8 +1,8 @@
1
1
  module Datadog
2
2
  module VERSION
3
3
  MAJOR = 0
4
- MINOR = 35
5
- PATCH = 2
4
+ MINOR = 36
5
+ PATCH = 0
6
6
  PRE = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
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.35.2
4
+ version: 0.36.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: 2020-05-11 00:00:00.000000000 Z
11
+ date: 2020-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack
@@ -713,8 +713,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
713
713
  - !ruby/object:Gem::Version
714
714
  version: 2.0.0
715
715
  requirements: []
716
- rubyforge_project:
717
- rubygems_version: 2.7.6.2
716
+ rubygems_version: 3.0.3
718
717
  signing_key:
719
718
  specification_version: 4
720
719
  summary: Datadog tracing code for your Ruby applications