traceview 3.0.4 → 3.0.5

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
  SHA1:
3
- metadata.gz: 851cfffb5ecd5503573c7a1674fc5d121041d9ed
4
- data.tar.gz: 4ad25c56896ad27b8c81e83eb99ff6a9d55d45e1
3
+ metadata.gz: c2284d42530b2ec6252db379fc6370a378bd56d4
4
+ data.tar.gz: c9985e9de191c6a7bf7bea724023acc2018ab810
5
5
  SHA512:
6
- metadata.gz: f53d8f9ebe0f8545cc9636aff8821ceedb5b1ea5d9264358a2efd72b176387e3b232040912608a90996a3b5c40110283ab6c24b506a258c1a9a0e7290d8d27b5
7
- data.tar.gz: f7295210d1a9c5ff6ac49247c3a98ae30aae26932f4800e6f224d68b1289649142500c8097f2dd76a6284ccecafc1388eae80eb34a7fa3da8bcc18c6eee2ec78
6
+ metadata.gz: 13954be81725c72efc6cb6d635883539ea92cd1a1dea46be838fa34f4b1665c087955c79d630a0eab024bd926c975700dcdcfc47d9f98e148ddf250e4b53c233
7
+ data.tar.gz: 0d487b99dd015b6a1544de7210d489b51c676e3fbd06c919ea74891de3c2dc7dbf4105a06ada896e6500f8a6241415e8f82fc8bf2c685c5e9ed968abfb28a711
@@ -38,7 +38,7 @@ module TraceView
38
38
  def do_request_with_traceview(method, uri, query, body, header, &block)
39
39
  # If we're not tracing, just do a fast return.
40
40
  if !TraceView.tracing?
41
- return request_without_traceview(method, uri, query, body, header, &block)
41
+ return do_request_without_traceview(method, uri, query, body, header, &block)
42
42
  end
43
43
 
44
44
  begin
@@ -97,11 +97,23 @@ module TraceView
97
97
  case op
98
98
  when :set
99
99
  if command.count > 3
100
- options = command[3]
101
- kvs[:ex] = options[:ex] if options.key?(:ex)
102
- kvs[:px] = options[:px] if options.key?(:px)
103
- kvs[:nx] = options[:nx] if options.key?(:nx)
104
- kvs[:xx] = options[:xx] if options.key?(:xx)
100
+ if command[3].is_a?(Hash)
101
+ options = command[3]
102
+ kvs[:ex] = options[:ex] if options.key?(:ex)
103
+ kvs[:px] = options[:px] if options.key?(:px)
104
+ kvs[:nx] = options[:nx] if options.key?(:nx)
105
+ kvs[:xx] = options[:xx] if options.key?(:xx)
106
+ else
107
+ options = command[3..-1]
108
+ until (opts = options.shift(2)).empty?
109
+ case opts[0]
110
+ when "EX"; kvs[:ex] = opts[1]
111
+ when "PX"; kvs[:px] = opts[1]
112
+ when "NX"; kvs[:nx] = opts[1]
113
+ when "XX"; kvs[:xx] = opts[1]
114
+ end
115
+ end
116
+ end
105
117
  end
106
118
 
107
119
  when :get
@@ -8,7 +8,7 @@ module TraceView
8
8
  module Version
9
9
  MAJOR = 3
10
10
  MINOR = 0
11
- PATCH = 4
11
+ PATCH = 5
12
12
  BUILD = nil
13
13
 
14
14
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
@@ -295,5 +295,28 @@ class HTTPClientTest < Minitest::Test
295
295
 
296
296
  TraceView::Config[:httpclient][:log_args] = @log_args
297
297
  end
298
+
299
+ def test_without_tracing
300
+ clear_all_traces
301
+
302
+ @tm = TraceView::Config[:tracing_mode]
303
+ TraceView::Config[:tracing_mode] = :never
304
+
305
+ response = nil
306
+
307
+ TraceView::API.start_trace('httpclient_tests') do
308
+ clnt = HTTPClient.new
309
+ response = clnt.get('http://127.0.0.1:8101/', :query => { :keyword => 'ruby', :lang => 'en' })
310
+ end
311
+
312
+ xtrace = response.headers['X-Trace']
313
+ assert xtrace == nil
314
+
315
+ traces = get_all_traces
316
+
317
+ assert_equal traces.count, 0
318
+
319
+ TraceView::Config[:tracing_mode] = @tm
320
+ end
298
321
  end
299
322
 
@@ -266,6 +266,18 @@ if defined?(::Redis)
266
266
  traces[2]['KVKey'].must_equal "one"
267
267
  end
268
268
 
269
+ it "should trace set + expiration" do
270
+ TraceView::API.start_trace('redis_test', '', {}) do
271
+ @redis.set("one", "hello", :ex => 12)
272
+ end
273
+
274
+ traces = get_all_traces
275
+ traces.count.must_equal 4
276
+ traces[2]['KVOp'].must_equal "set"
277
+ traces[2]['KVKey'].must_equal "one"
278
+ traces[2]['ex'].must_equal 12
279
+ end
280
+
269
281
  it "should trace setbit" do
270
282
  min_server_version(2.2)
271
283
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: traceview
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.4
4
+ version: 3.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Giacomo Lombardo
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-07-08 00:00:00.000000000 Z
12
+ date: 2015-07-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json