ddtrace 0.34.0 → 0.34.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 717c60b6febb326c72e9361843a18053a750286a
4
- data.tar.gz: 64048e72e26379dc63c48e48511f0b05190ad462
3
+ metadata.gz: 693e84ab50a280cbb8bf7b9aff22a6a946299116
4
+ data.tar.gz: 12288885ea1d1fcde3bfb598e83283233742fc87
5
5
  SHA512:
6
- metadata.gz: 43197310ce4fb1599f272721f47a764ceba75ab11344521089b5e70d8ca6e9eabefec7138de86e9d3001bbe3983f5c501e198822ecc270a1b6542b8832f1af0b
7
- data.tar.gz: d3902ad6888f33faf5feea994d0abeed8625b094809407beb88de25fd43a35fc84bb0ce14d5589138f9b52e19932ad421c4f7f13005ef6f3890f6ca0301ecc40
6
+ metadata.gz: 3510e628728248839225a76f20b9241375f447da044afe84f77e99b46db6ec9895702f938be873779364c5b1342a92b93c991ef7ef84f462da1783b138373da1
7
+ data.tar.gz: 26455c489bc375b7305dfcb998498337b9a2506530481759de75b9e599ccb798d8eca24aa1de784cc7bdc1d7470d93abeaccf0e5198ca731b948938260ab9f82
@@ -2,6 +2,20 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.34.1] - 2020-04-02
6
+
7
+ Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.34.1
8
+
9
+ Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.34.0...v0.34.1
10
+
11
+ ### Changed
12
+
13
+ - Rails applications set default `service` and `env` if none are configured. (#990)
14
+
15
+ ### Fixed
16
+
17
+ - Some configuration settings not applying (#989, #990) (@rahul342)
18
+
5
19
  ## [0.34.0] - 2020-03-31
6
20
 
7
21
  Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.34.0
@@ -1140,7 +1154,8 @@ Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.3.1
1140
1154
 
1141
1155
  Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
1142
1156
 
1143
- [Unreleased]: https://github.com/DataDog/dd-trace-rb/compare/v0.34.0...master
1157
+ [Unreleased]: https://github.com/DataDog/dd-trace-rb/compare/v0.34.1...master
1158
+ [0.34.0]: https://github.com/DataDog/dd-trace-rb/compare/v0.34.0...v0.34.1
1144
1159
  [0.34.0]: https://github.com/DataDog/dd-trace-rb/compare/v0.33.1...v0.34.0
1145
1160
  [0.33.1]: https://github.com/DataDog/dd-trace-rb/compare/v0.33.0...v0.33.1
1146
1161
  [0.33.0]: https://github.com/DataDog/dd-trace-rb/compare/v0.32.0...v0.33.0
@@ -63,6 +63,7 @@ module Datadog
63
63
  option :env do |o|
64
64
  o.default { ENV.fetch(Ext::Environment::ENV_ENVIRONMENT, nil) }
65
65
  o.lazy
66
+ o.on_set { |value| get_option(:tracer).set_tags('env' => value) }
66
67
  end
67
68
 
68
69
  option :report_hostname do |o|
@@ -100,6 +101,7 @@ module Datadog
100
101
  option :service do |o|
101
102
  o.default { ENV.fetch(Ext::Environment::ENV_SERVICE, nil) }
102
103
  o.lazy
104
+ o.on_set { |value| get_option(:tracer).default_service = value }
103
105
  end
104
106
 
105
107
  option :tags do |o|
@@ -119,6 +121,16 @@ module Datadog
119
121
  tags
120
122
  end
121
123
 
124
+ o.setter do |new_value, old_value|
125
+ # Coerce keys to strings
126
+ string_tags = Hash[new_value.collect { |k, v| [k.to_s, v] }]
127
+
128
+ # Merge with previous tags
129
+ (old_value || {}).merge(string_tags)
130
+ end
131
+
132
+ o.on_set { |value| get_option(:tracer).set_tags(value) }
133
+
122
134
  o.lazy
123
135
  end
124
136
 
@@ -168,6 +180,7 @@ module Datadog
168
180
  option :version do |o|
169
181
  o.default { ENV.fetch(Ext::Environment::ENV_VERSION, nil) }
170
182
  o.lazy
183
+ o.on_set { |value| get_option(:tracer).set_tags('version' => value) }
171
184
  end
172
185
  end
173
186
  end
@@ -32,14 +32,27 @@ module Datadog
32
32
 
33
33
  # By default, default service would be guessed from the script
34
34
  # being executed, but here we know better, get it from Rails config.
35
- config[:tracer].default_service = config[:service_name]
35
+ # Don't set this if service has been explicitly provided by the user.
36
+ Datadog.configuration.service ||= config[:service_name]
37
+
38
+ # Set the environment to the Rails environment.
39
+ # Don't set this if env has been explicitly provided by the user.
40
+ Datadog.configuration.env ||= ::Rails.env if ::Rails.respond_to?(:env)
41
+
42
+ # Update the tracer if its not the default tracer.
43
+ if config[:tracer] != Datadog.configuration.tracer
44
+ config[:tracer].default_service = config[:service_name]
45
+
46
+ env = Datadog.configuration.env || (::Rails.respond_to?(:env) && ::Rails.env)
47
+ config[:tracer].set_tags('env' => env) if env
48
+ end
36
49
  end
37
50
 
38
51
  def self.config_with_defaults
39
52
  # We set defaults here instead of in the patcher because we need to wait
40
53
  # for the Rails application to be fully initialized.
41
54
  Datadog.configuration[:rails].tap do |config|
42
- config[:service_name] ||= Utils.app_name
55
+ config[:service_name] ||= (Datadog.configuration.service || Utils.app_name)
43
56
  config[:database_service] ||= "#{config[:service_name]}-#{Contrib::ActiveRecord::Utils.adapter_name}"
44
57
  config[:controller_service] ||= config[:service_name]
45
58
  config[:cache_service] ||= "#{config[:service_name]}-cache"
@@ -173,7 +173,7 @@ module Datadog
173
173
  # spans without a service would be dropped, so here we provide a default.
174
174
  # This should really never happen with integrations in contrib, as a default
175
175
  # service is always set. It's only for custom instrumentation.
176
- @service ||= (Datadog.configuration.service || (@tracer && @tracer.default_service))
176
+ @service ||= (@tracer && @tracer.default_service)
177
177
 
178
178
  begin
179
179
  @context.close_span(self)
@@ -85,6 +85,7 @@ module Datadog
85
85
 
86
86
  @mutex = Mutex.new
87
87
  @tags = options.fetch(:tags, Datadog.configuration.tags)
88
+ @default_service = options.fetch(:default_service, Datadog.configuration.service)
88
89
 
89
90
  # Enable priority sampling by default
90
91
  activate_priority_sampling!(@sampler)
@@ -2,7 +2,7 @@ module Datadog
2
2
  module VERSION
3
3
  MAJOR = 0
4
4
  MINOR = 34
5
- PATCH = 0
5
+ PATCH = 1
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.34.0
4
+ version: 0.34.1
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-03-31 00:00:00.000000000 Z
11
+ date: 2020-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack