ddtrace 0.4.2 → 0.4.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: 76d73e549b6967c251ed2a24da73b2745be09bab
4
- data.tar.gz: d277e842f72258951601bccb39922a5159df6c3c
3
+ metadata.gz: 9dc26d3b7ce6a1750bd273655bfb068604249878
4
+ data.tar.gz: 9c431f39db93b20c1d3c854e8efa1cb3b8d030b4
5
5
  SHA512:
6
- metadata.gz: 0b4f2105c282e56f3e7ec30bba4b728b57ef934f7479f9308aee09eb4e8ad936cd5ff64ae7073892f09ef24b0867c71e158aceb1f93348c32639c8360b24193b
7
- data.tar.gz: 6f1c67ab6bafc6d2e94e436a21cca2d0a4c5b220c8acfe3fcb0255f09c08efe02e86d13fd69d8d97c9c90b6eec024375702103a39323d43df2e5e637aa546d9d
6
+ metadata.gz: 044bc1ebc2a9e74f66754fbe3514563a8f8ad735e3547bcdc7ca61e508cbd3fac52a7f16d451d719c5402f05272a5f3ea7951b57a7c155fcc27b897cae063a62
7
+ data.tar.gz: 29ce52bf23933396a5d45b2467d43c0a9b1642769f6119fe22c8f38b544b2c796cf309366de063498f3ad07e4026dd48d18ac03179f24952cf31d96fb5b7597c
@@ -41,3 +41,9 @@ Metrics/BlockLength:
41
41
 
42
42
  Metrics/ParameterLists:
43
43
  Enabled: false
44
+
45
+ Metrics/CyclomaticComplexity:
46
+ Max: 15
47
+
48
+ Metrics/PerceivedComplexity:
49
+ Max: 15
@@ -36,20 +36,28 @@ module Datadog
36
36
  url = full_url.path
37
37
  response = nil
38
38
  pin.tracer.trace('elasticsearch.query') do |span|
39
- span.service = pin.service
40
- span.span_type = SPAN_TYPE
39
+ begin
40
+ span.service = pin.service
41
+ span.span_type = SPAN_TYPE
41
42
 
42
- span.set_tag(METHOD, method)
43
- span.set_tag(URL, url)
44
- span.set_tag(PARAMS, JSON.generate(params)) if params
45
- span.set_tag(BODY, JSON.generate(body)) if body
43
+ # load JSON for the following fields unless they're already strings
44
+ params = JSON.generate(params) if params && !params.is_a?(String)
45
+ body = JSON.generate(body) if body && !body.is_a?(String)
46
46
 
47
- quantized_url = Datadog::Contrib::Elasticsearch::Quantize.format_url(url)
48
- span.resource = "#{method} #{quantized_url}"
47
+ span.set_tag(METHOD, method)
48
+ span.set_tag(URL, url)
49
+ span.set_tag(PARAMS, params) if params
50
+ span.set_tag(BODY, body) if body
49
51
 
50
- response = super(*args)
52
+ quantized_url = Datadog::Contrib::Elasticsearch::Quantize.format_url(url)
53
+ span.resource = "#{method} #{quantized_url}"
54
+ rescue StandardError => e
55
+ Datadog::Tracer.log.error(e.message)
56
+ ensure
57
+ # the call is still executed
58
+ response = super(*args)
59
+ end
51
60
  end
52
-
53
61
  response
54
62
  end
55
63
  end
@@ -14,8 +14,6 @@ module Datadog
14
14
 
15
15
  module_function
16
16
 
17
- # rubocop:disable Metrics/CyclomaticComplexity
18
- # rubocop:disable Metrics/PerceivedComplexity
19
17
  def should_skip_tracing?(req, address, port, transport, pin)
20
18
  # we don't want to trace our own call to the API (they use net/http)
21
19
  # when we know the host & port (from the URI) we use it, else (most-likely
@@ -93,7 +93,9 @@ module Datadog
93
93
  begin
94
94
  # finish the tracing and update the execution time
95
95
  span.resource = resource
96
- span.set_tag('rails.cache.backend', ::Rails.configuration.cache_store)
96
+ # discard parameters from the cache_store configuration
97
+ store, = *Array.wrap(::Rails.configuration.cache_store).flatten
98
+ span.set_tag('rails.cache.backend', store)
97
99
  span.set_tag('rails.cache.key', payload.fetch(:key))
98
100
 
99
101
  if payload[:exception]
@@ -85,9 +85,7 @@ module Datadog
85
85
  end
86
86
 
87
87
  # rubocop:disable Metrics/AbcSize
88
- # rubocop:disable Metrics/CyclomaticComplexity
89
88
  # rubocop:disable Metrics/MethodLength
90
- # rubocop:disable Metrics/PerceivedComplexity
91
89
  def self.registered(app)
92
90
  ::Sinatra::Base.module_eval do
93
91
  def render(engine, data, *)
@@ -2,7 +2,7 @@ module Datadog
2
2
  module VERSION
3
3
  MAJOR = 0
4
4
  MINOR = 4
5
- PATCH = 2
5
+ PATCH = 3
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  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.4.2
4
+ version: 0.4.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: 2017-02-14 00:00:00.000000000 Z
11
+ date: 2017-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack