ddtrace 0.18.2 → 0.18.3

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: 583094c453fd00bbe1415cbda7ca72c14e455c71
4
- data.tar.gz: 52c5f11dc8eda8f027f4a7b0837a6b112939db31
3
+ metadata.gz: 690c74d7e00a2fabf4ad03e30b0b40656c8337e9
4
+ data.tar.gz: dc9f24349943d09fd472b0e5cb9c3b1cff1685ca
5
5
  SHA512:
6
- metadata.gz: 33d2fb397612dd3e61e36306b55d10c3eb6d8700a36874ae99b09657ab2f701195faf257896b219a7d7f8b3a2baee8612aa1f15f88778b16687f07dfb04296dc
7
- data.tar.gz: 7a2adbd4fb324bd2ce46b584bacaf21437defc36f893f5c285e1c94f3cc3f6d0c67317ed42b44a87fe0e762966c54b8e55cf52a133c6fd5cde57964daa6376f3
6
+ metadata.gz: e996f0517f9be72b1b81d36eeedf099f997e66b0d00da4ad4cd93e169a93b6dbcb7e5a8b7df466b11b6487a82236ecfb9c997c908b1337a336c34e07ac78a7be
7
+ data.tar.gz: 6973e5ff265f3660a19836dd7b02fba398583429c5364e4140cf3231341b855c06596ef33a2a92376f70ead4545326f591a1275ff342f0aba043c1f9ef9dbe46
data/CHANGELOG.md CHANGED
@@ -4,6 +4,18 @@
4
4
 
5
5
  ## [Unreleased (beta)]
6
6
 
7
+ ## [0.18.3] - 2019-01-17
8
+
9
+ Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.18.3
10
+
11
+ Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.18.2...v0.18.3
12
+
13
+ ### Fixed
14
+
15
+ - Mongo `NoMethodError` when no span available during `#failed`. (#674, #675) (@Azure7111)
16
+ - Rack deprecation warnings firing with some 3rd party libraries present. (#672)
17
+ - Shoryuken resource name when used with ActiveJob. (#671) (@aurelian)
18
+
7
19
  ## [0.18.2] - 2019-01-03
8
20
 
9
21
  Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.18.2
@@ -615,9 +627,10 @@ Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.3.1
615
627
 
616
628
  Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
617
629
 
618
- [Unreleased (stable)]: https://github.com/DataDog/dd-trace-rb/compare/v0.18.2...master
619
- [Unreleased (beta)]: https://github.com/DataDog/dd-trace-rb/compare/v0.18.2...0.19-dev
620
- [0.18.1]: https://github.com/DataDog/dd-trace-rb/compare/v0.18.1...v0.18.2
630
+ [Unreleased (stable)]: https://github.com/DataDog/dd-trace-rb/compare/v0.18.3...master
631
+ [Unreleased (beta)]: https://github.com/DataDog/dd-trace-rb/compare/v0.18.3...0.19-dev
632
+ [0.18.3]: https://github.com/DataDog/dd-trace-rb/compare/v0.18.2...v0.18.3
633
+ [0.18.2]: https://github.com/DataDog/dd-trace-rb/compare/v0.18.1...v0.18.2
621
634
  [0.18.1]: https://github.com/DataDog/dd-trace-rb/compare/v0.18.0...v0.18.1
622
635
  [0.18.0]: https://github.com/DataDog/dd-trace-rb/compare/v0.17.3...v0.18.0
623
636
  [0.17.3]: https://github.com/DataDog/dd-trace-rb/compare/v0.17.2...v0.17.3
@@ -17,8 +17,7 @@ module Datadog
17
17
  # https://github.com/mongodb/mongo-ruby-driver/blob/master/lib/mongo/monitoring.rb#L70
18
18
  # https://github.com/mongodb/mongo-ruby-driver/blob/master/lib/mongo/monitoring/publishable.rb#L38-L56
19
19
  span = pin.tracer.trace(Ext::SPAN_COMMAND, service: pin.service, span_type: Ext::SPAN_TYPE_COMMAND)
20
- Thread.current[:datadog_mongo_span] ||= {}
21
- Thread.current[:datadog_mongo_span][event.request_id] = span
20
+ set_span(event, span)
22
21
 
23
22
  # build a quantized Query using the Parser module
24
23
  query = MongoDB.query_builder(event.command_name, event.database_name, event.command)
@@ -38,7 +37,7 @@ module Datadog
38
37
  end
39
38
 
40
39
  def failed(event)
41
- span = Thread.current[:datadog_mongo_span][event.request_id]
40
+ span = get_span(event)
42
41
  return unless span
43
42
 
44
43
  # the failure is not a real exception because it's handled by
@@ -50,11 +49,11 @@ module Datadog
50
49
  # whatever happens, the Span must be removed from the local storage and
51
50
  # it must be finished to prevent any leak
52
51
  span.finish unless span.nil?
53
- Thread.current[:datadog_mongo_span].delete(event.request_id)
52
+ clear_span(event)
54
53
  end
55
54
 
56
55
  def succeeded(event)
57
- span = Thread.current[:datadog_mongo_span][event.request_id]
56
+ span = get_span(event)
58
57
  return unless span
59
58
 
60
59
  # add fields that are available only after executing the query
@@ -66,6 +65,23 @@ module Datadog
66
65
  # whatever happens, the Span must be removed from the local storage and
67
66
  # it must be finished to prevent any leak
68
67
  span.finish unless span.nil?
68
+ clear_span(event)
69
+ end
70
+
71
+ private
72
+
73
+ def get_span(event)
74
+ Thread.current[:datadog_mongo_span] \
75
+ && Thread.current[:datadog_mongo_span][event.request_id]
76
+ end
77
+
78
+ def set_span(event, span)
79
+ Thread.current[:datadog_mongo_span] ||= {}
80
+ Thread.current[:datadog_mongo_span][event.request_id] = span
81
+ end
82
+
83
+ def clear_span(event)
84
+ return if Thread.current[:datadog_mongo_span].nil?
69
85
  Thread.current[:datadog_mongo_span].delete(event.request_id)
70
86
  end
71
87
  end
@@ -62,12 +62,16 @@ module Datadog
62
62
  request_span = tracer.trace(Ext::SPAN_REQUEST, trace_options)
63
63
  env[RACK_REQUEST_SPAN] = request_span
64
64
 
65
- # Add deprecation warnings
66
- add_deprecation_warnings(env)
67
- env.without_datadog_warnings do
68
- # TODO: For backwards compatibility; this attribute is deprecated.
69
- env[:datadog_rack_request_span] = env[RACK_REQUEST_SPAN]
70
- end
65
+ # TODO: Add deprecation warnings back in
66
+ # DEV: Some third party Gems will loop over the rack env causing our deprecation
67
+ # warnings to be shown even when the user is not accessing them directly
68
+ #
69
+ # add_deprecation_warnings(env)
70
+ # env.without_datadog_warnings do
71
+ # # TODO: For backwards compatibility; this attribute is deprecated.
72
+ # env[:datadog_rack_request_span] = env[RACK_REQUEST_SPAN]
73
+ # end
74
+ env[:datadog_rack_request_span] = env[RACK_REQUEST_SPAN]
71
75
 
72
76
  # Copy the original env, before the rest of the stack executes.
73
77
  # Values may change; we want values before that happens.
@@ -11,7 +11,7 @@ module Datadog
11
11
 
12
12
  def call(worker_instance, queue, sqs_msg, body)
13
13
  @tracer.trace(Ext::SPAN_JOB, service: @shoryuken_service, span_type: Datadog::Ext::AppTypes::WORKER) do |span|
14
- span.resource = worker_instance.class.name
14
+ span.resource = resource(worker_instance, body)
15
15
  span.set_tag(Ext::TAG_JOB_ID, sqs_msg.message_id)
16
16
  span.set_tag(Ext::TAG_JOB_QUEUE, queue)
17
17
  span.set_tag(Ext::TAG_JOB_ATTRIBUTES, sqs_msg.attributes) if sqs_msg.respond_to?(:attributes)
@@ -23,6 +23,14 @@ module Datadog
23
23
 
24
24
  private
25
25
 
26
+ def resource(worker_instance, body)
27
+ # If it's a Hash, try to get the job class from it.
28
+ # This is for ActiveJob compatibility.
29
+ job_class = body['job_class'] if body.is_a?(Hash)
30
+ # If nothing is available, use the worker class name.
31
+ job_class || worker_instance.class.name
32
+ end
33
+
26
34
  def set_service_info(service)
27
35
  return if @tracer.services[service]
28
36
  @tracer.set_service_info(
@@ -2,7 +2,7 @@ module Datadog
2
2
  module VERSION
3
3
  MAJOR = 0
4
4
  MINOR = 18
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.18.2
4
+ version: 0.18.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: 2019-01-03 00:00:00.000000000 Z
11
+ date: 2019-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack