ddtrace 0.17.2 → 0.17.3

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
- SHA256:
3
- metadata.gz: 6b98c7693f06abe337bbc38c713ea7115a3964e584d8508670b65d43811235aa
4
- data.tar.gz: 147c7f9e7225927b9bc7f6dd8c4aff8134d2eb2a28f7aab063ad3ba369139217
2
+ SHA1:
3
+ metadata.gz: da8890d2a4acda28dea666623f0b497fceedea7c
4
+ data.tar.gz: 4bda7e12410130c575411289d8400ad281099b5d
5
5
  SHA512:
6
- metadata.gz: 310e51596c88f0bdccaef1851dace5302fe93fb11ccd0bb8eaddbdeb817e775ac9267ebb10cee73fe34b4a7686742201a7105da4c8313b9714724e3ad6fec67b
7
- data.tar.gz: 335c7994b68a6b498add3f6bc9cc7dd64840f14337fa7c304264fda84aa74c78e0b45b2cb6f34f75550c38d887f23913df39a9ee047741216d207d7ef9ff2e1c
6
+ metadata.gz: f6ef938aedbe689cded02861e70a5a791ddff979c6ae78bc1bfbfb74d095592f17f0125ede4a06f76a2549d18afc9ab43d6fcf9a2ee6da24d4de0b9acdb6e97f
7
+ data.tar.gz: b41dcf5846930f2edbfd0fd8a5accf52c5d282569a4bc083924d56336d598c246fad8d5d12223ff8417ccec7dfbecaf8bd50dec53f1d4bc4caed9df8a26f7055
@@ -4,6 +4,18 @@
4
4
 
5
5
  ## [Unreleased (beta)]
6
6
 
7
+ ## [0.17.3] - 2018-11-29
8
+
9
+ Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.17.3
10
+
11
+ Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.17.2...v0.17.3
12
+
13
+ ### Fixed
14
+
15
+ - Bad resource names for Grape::API objects in Grape 1.2.0 (#639)
16
+ - RestClient raising NoMethodError when response is `nil` (#636, #642) (@frsantos)
17
+ - Rack middleware inserted twice in some Rails applications (#641)
18
+
7
19
  ## [0.17.2] - 2018-11-23
8
20
 
9
21
  Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.17.2
@@ -564,8 +576,10 @@ Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.3.1
564
576
 
565
577
  Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
566
578
 
567
- [Unreleased (stable)]: https://github.com/DataDog/dd-trace-rb/compare/v0.17.1...master
568
- [Unreleased (beta)]: https://github.com/DataDog/dd-trace-rb/compare/v0.17.1...0.18-dev
579
+ [Unreleased (stable)]: https://github.com/DataDog/dd-trace-rb/compare/v0.17.3...master
580
+ [Unreleased (beta)]: https://github.com/DataDog/dd-trace-rb/compare/v0.17.3...0.18-dev
581
+ [0.17.3]: https://github.com/DataDog/dd-trace-rb/compare/v0.17.2...v0.17.3
582
+ [0.17.2]: https://github.com/DataDog/dd-trace-rb/compare/v0.17.1...v0.17.2
569
583
  [0.17.1]: https://github.com/DataDog/dd-trace-rb/compare/v0.17.0...v0.17.1
570
584
  [0.17.0]: https://github.com/DataDog/dd-trace-rb/compare/v0.16.1...v0.17.0
571
585
  [0.16.1]: https://github.com/DataDog/dd-trace-rb/compare/v0.16.0...v0.16.1
@@ -63,7 +63,16 @@ module Datadog
63
63
 
64
64
  begin
65
65
  # collect endpoint details
66
- api_view = payload[:endpoint].options[:for].to_s
66
+ api = payload[:endpoint].options[:for]
67
+ # If the API inherits from Grape::API in version >= 1.2.0
68
+ # then the API will be an instance and the name must be derived from the base.
69
+ # See https://github.com/ruby-grape/grape/issues/1825
70
+ api_view = if defined?(::Grape::API::Instance) && api <= ::Grape::API::Instance
71
+ api.base.to_s
72
+ else
73
+ api.to_s
74
+ end
75
+
67
76
  path = payload[:endpoint].options[:path].join('/')
68
77
  resource = "#{api_view}##{path}"
69
78
  span.resource = resource
@@ -78,7 +87,7 @@ module Datadog
78
87
  span.set_error(payload[:exception_object]) unless payload[:exception_object].nil?
79
88
 
80
89
  # override the current span with this notification values
81
- span.set_tag(Ext::TAG_ROUTE_ENDPOINT, api_view)
90
+ span.set_tag(Ext::TAG_ROUTE_ENDPOINT, api_view) unless api_view.nil?
82
91
  span.set_tag(Ext::TAG_ROUTE_PATH, path)
83
92
  ensure
84
93
  span.start_time = start
@@ -32,10 +32,12 @@ module Datadog
32
32
  end
33
33
 
34
34
  def before_intialize(app)
35
- # Middleware must be added before the application is initialized.
36
- # Otherwise the middleware stack will be frozen.
37
- # Sometimes we don't want to activate middleware e.g. OpenTracing, etc.
38
- add_middleware(app) if Datadog.configuration[:rails][:middleware]
35
+ do_once(:rails_before_initialize, for: app) do
36
+ # Middleware must be added before the application is initialized.
37
+ # Otherwise the middleware stack will be frozen.
38
+ # Sometimes we don't want to activate middleware e.g. OpenTracing, etc.
39
+ add_middleware(app) if Datadog.configuration[:rails][:middleware]
40
+ end
39
41
  end
40
42
 
41
43
  def add_middleware(app)
@@ -59,10 +61,12 @@ module Datadog
59
61
  end
60
62
 
61
63
  def after_intialize(app)
62
- # Finish configuring the tracer after the application is initialized.
63
- # We need to wait for some things, like application name, middleware stack, etc.
64
- setup_tracer
65
- instrument_rails
64
+ do_once(:rails_after_initialize, for: app) do
65
+ # Finish configuring the tracer after the application is initialized.
66
+ # We need to wait for some things, like application name, middleware stack, etc.
67
+ setup_tracer
68
+ instrument_rails
69
+ end
66
70
  end
67
71
 
68
72
  # Configure Rails tracing with settings
@@ -60,10 +60,13 @@ module Datadog
60
60
 
61
61
  datadog_tag_request(uri, span)
62
62
 
63
- response = yield(span)
64
-
65
- span.set_tag(Datadog::Ext::HTTP::STATUS_CODE, response.code)
66
- response
63
+ yield(span).tap do |response|
64
+ # Verify return value is a response
65
+ # If so, add additional tags.
66
+ if response.is_a?(::RestClient::Response)
67
+ span.set_tag(Datadog::Ext::HTTP::STATUS_CODE, response.code)
68
+ end
69
+ end
67
70
  rescue ::RestClient::ExceptionWithResponse => e
68
71
  span.set_error(e) if Datadog::Ext::HTTP::ERROR_RANGE.cover?(e.http_code)
69
72
  span.set_tag(Datadog::Ext::HTTP::STATUS_CODE, e.http_code)
@@ -21,21 +21,23 @@ module Datadog
21
21
  end
22
22
  end
23
23
 
24
- def do_once(key = nil)
24
+ def do_once(key = nil, options = {})
25
25
  # If already done, don't do again
26
- @done_once ||= {}
27
- return @done_once[key] if @done_once.key?(key)
26
+ @done_once ||= Hash.new { |h, k| h[k] = {} }
27
+ if @done_once.key?(key) && @done_once[key].key?(options[:for])
28
+ return @done_once[key][options[:for]]
29
+ end
28
30
 
29
31
  # Otherwise 'do'
30
32
  yield.tap do
31
33
  # Then add the key so we don't do again.
32
- @done_once[key] = true
34
+ @done_once[key][options[:for]] = true
33
35
  end
34
36
  end
35
37
 
36
- def done?(key)
38
+ def done?(key, options = {})
37
39
  return false unless instance_variable_defined?(:@done_once)
38
- !@done_once.nil? && @done_once.key?(key)
40
+ !@done_once.nil? && @done_once.key?(key) && @done_once[key].key?(options[:for])
39
41
  end
40
42
  end
41
43
 
@@ -2,7 +2,7 @@ module Datadog
2
2
  module VERSION
3
3
  MAJOR = 0
4
4
  MINOR = 17
5
- PATCH = 2
5
+ PATCH = 3
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.17.2
4
+ version: 0.17.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Datadog, Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-23 00:00:00.000000000 Z
11
+ date: 2018-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack
@@ -544,7 +544,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
544
544
  version: '0'
545
545
  requirements: []
546
546
  rubyforge_project:
547
- rubygems_version: 2.7.7
547
+ rubygems_version: 2.6.14
548
548
  signing_key:
549
549
  specification_version: 4
550
550
  summary: Datadog tracing code for your Ruby applications