redis-rails-instrumentation 1.0.0 → 1.0.1

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: f77ad22f3ab95a646a40999de5e772ac9eca1107
4
- data.tar.gz: 0ae988ec9866cb2443aee39a0c2d4d046fa0c499
3
+ metadata.gz: 1d418b58a6ea59c34e95c91b1d87d46b25a9f866
4
+ data.tar.gz: e48976db5221830f7662151ec552b5e78d0b9a16
5
5
  SHA512:
6
- metadata.gz: bb535484b3e4870dc4ed2f784fc443264924df4a324dceedf2a888b4d8ff436357f2da65af48a605032fa8671877672f12c10d276669acc8df8b1b4c7ffafc94
7
- data.tar.gz: 7511ba14bc0345597d7da545e84dbad4bc895ea16595c362b8788cccb5cd5d03218c48bf87518a7f19760a8ff42c6c9a320d09ce8710f040a05838bbffc5b055
6
+ metadata.gz: bf2f31155b84b0ddf1c1a73c004e516fe592be8b4fe4eaf18a8f862ed2126bbf0260fc2f91059514f760f14d2f0ca8858cf281af34b32d55c8d766f5d88cc224
7
+ data.tar.gz: 32aec6f8232e929462dd043a0d0da301a2a2d7103787f19ea33b2453c60cb73f2dd7af5f991256305ebf6c8125eb400c937e24e5231a55fcb6f412e120855769
@@ -5,7 +5,7 @@ rvm:
5
5
  - 2.1.10
6
6
  - 2.2.6
7
7
  - 2.3.3
8
- - 2.4.0
9
- - jruby-9.1.7.0
8
+ - 2.4.1
9
+ - jruby-9.1.8.0
10
10
  services:
11
11
  - redis-server
@@ -17,7 +17,7 @@ class Redis
17
17
 
18
18
  output = cmds.map do |name, *args|
19
19
  if !args.empty?
20
- "[ #{name.to_s.upcase} #{args.join(' ')} ]"
20
+ "[ #{name.to_s.upcase} #{format_arguments(args)} ]"
21
21
  else
22
22
  "[ #{name.to_s.upcase} ]"
23
23
  end
@@ -25,6 +25,18 @@ class Redis
25
25
 
26
26
  debug message(event, 'Redis', output)
27
27
  end
28
+
29
+ private
30
+
31
+ def format_arguments(args)
32
+ args.map do |arg|
33
+ if arg.respond_to?(:encoding) && arg.encoding == Encoding::ASCII_8BIT
34
+ '<BINARY DATA>'
35
+ else
36
+ arg
37
+ end
38
+ end.join(' ')
39
+ end
28
40
  end
29
41
  end
30
42
  end
@@ -1,7 +1,7 @@
1
1
  class Redis
2
2
  module Rails
3
3
  module Instrumentation
4
- VERSION = "1.0.0".freeze
4
+ VERSION = "1.0.1".freeze
5
5
  end
6
6
  end
7
7
  end
@@ -1,5 +1,6 @@
1
1
  require 'spec_helper'
2
2
  require 'redis'
3
+ require 'base64'
3
4
 
4
5
  class Redis
5
6
  module Rails
@@ -42,6 +43,14 @@ class Redis
42
43
  .to match(/Redis \(\d+\.\d+ms\) \[ GET test \]/)
43
44
  end
44
45
 
46
+ it 'truncates binary data' do
47
+ @logger.level = Logger::DEBUG
48
+ Instrumentation::Railtie.run_initializers
49
+ redis.set('test', Base64.decode64("R0lGODlhAQABAPAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="))
50
+ expect(@logger.logged(:debug)[0])
51
+ .to match(/Redis \(\d+\.\d+ms\) \[ SET test <BINARY DATA> \]/)
52
+ end
53
+
45
54
  it 'omits debug logging in production' do
46
55
  @logger.level = Logger::ERROR
47
56
  Instrumentation::Railtie.run_initializers
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis-rails-instrumentation
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ville Lautanala
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-18 00:00:00.000000000 Z
11
+ date: 2017-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis