redis-rails-instrumentation 1.0.1 → 2.0.0
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 +5 -5
- data/.github/workflows/ci.yml +25 -0
- data/README.md +3 -1
- data/lib/redis/rails/instrumentation/middleware.rb +21 -0
- data/lib/redis/rails/instrumentation/version.rb +1 -1
- data/lib/redis/rails/instrumentation.rb +2 -2
- data/redis-rails-instrumentation.gemspec +2 -2
- data/spec/redis/rails/instrumentation_spec.rb +3 -3
- metadata +11 -15
- data/.travis.yml +0 -11
- data/lib/redis/rails/instrumentation/logging.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b0066f547a9c55c043c785fc3d811ade63174793c6c15e46609dc3fe7ce34a9c
|
4
|
+
data.tar.gz: a2b8dd463d10f4352b4957c4d266f906d7c3b424e722a6216b3231e810cb0428
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c045781ddca460be310dbe70b445207499fb0b93571fbfd31814112cacdb33ab5cb0388dc900eafa301f025668d235d7db2a4fa665feb4c5282bb5ce84e4077
|
7
|
+
data.tar.gz: d09c1414b73011e358410ed9baf6f0543ea78db2ab3f03c7e576fcd75194c10f9228298aeec516acf0aacfa131242516245bfcde8361d2196a27d0c50dd06879
|
@@ -0,0 +1,25 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
test:
|
7
|
+
name: >-
|
8
|
+
Test (${{ matrix.ruby }})
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
strategy:
|
11
|
+
fail-fast: false
|
12
|
+
matrix:
|
13
|
+
ruby:
|
14
|
+
- "3.1"
|
15
|
+
- "3.2"
|
16
|
+
- "3.3"
|
17
|
+
- "3.4"
|
18
|
+
steps:
|
19
|
+
- uses: actions/checkout@v2
|
20
|
+
- uses: supercharge/redis-github-action@1.8.0
|
21
|
+
- uses: ruby/setup-ruby@v1
|
22
|
+
with:
|
23
|
+
ruby-version: ${{ matrix.ruby }}
|
24
|
+
bundler-cache: true
|
25
|
+
- run: bundle exec rake
|
data/README.md
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
-
# Redis Rails Instrumentation
|
1
|
+
# Redis Rails Instrumentation
|
2
2
|
|
3
3
|
Railtie to include Redis commands in Rails logging.
|
4
4
|
|
5
|
+
Version 2.0 and newer only supports redis-rb 5.x. If you need older version, please use 1.0.1.
|
6
|
+
|
5
7
|
## Installation
|
6
8
|
|
7
9
|
Add this line to your application's Gemfile:
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class Redis
|
2
|
+
module Rails
|
3
|
+
module Middleware
|
4
|
+
def connect(redis_config)
|
5
|
+
ActiveSupport::Notifications.instrument("connect.redis") { super }
|
6
|
+
end
|
7
|
+
|
8
|
+
def call(command, redis_config)
|
9
|
+
ActiveSupport::Notifications.instrument('command.redis', commands: [command]) do
|
10
|
+
super
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def call_pipelined(commands, redis_config)
|
15
|
+
ActiveSupport::Notifications.instrument('command.redis', commands: commands) do
|
16
|
+
super
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'redis'
|
2
|
-
require 'redis/rails/instrumentation/
|
2
|
+
require 'redis/rails/instrumentation/middleware'
|
3
3
|
require 'redis/rails/instrumentation/version'
|
4
4
|
require 'active_support'
|
5
5
|
require 'sweet_notifications'
|
@@ -42,4 +42,4 @@ class Redis
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
|
45
|
+
RedisClient.register(Redis::Rails::Middleware)
|
@@ -18,10 +18,10 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(/^(test|spec|features)\//)
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_dependency 'redis', '>=
|
21
|
+
spec.add_dependency 'redis', '>= 5', '< 6'
|
22
22
|
spec.add_dependency 'activesupport', '>= 3.0'
|
23
23
|
spec.add_dependency 'sweet_notifications', '~> 1.0'
|
24
|
-
spec.add_development_dependency 'bundler', '
|
24
|
+
spec.add_development_dependency 'bundler', '>= 1.6'
|
25
25
|
spec.add_development_dependency 'rake'
|
26
26
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
27
27
|
spec.required_ruby_version = '>= 2.0.0'
|
@@ -27,9 +27,9 @@ class Redis
|
|
27
27
|
it 'logs pipelined commands to a single line' do
|
28
28
|
@logger.level = Logger::DEBUG
|
29
29
|
Instrumentation::Railtie.run_initializers
|
30
|
-
redis.pipelined do
|
31
|
-
|
32
|
-
|
30
|
+
redis.pipelined do |pipeline|
|
31
|
+
pipeline.get('test1')
|
32
|
+
pipeline.get('test2')
|
33
33
|
end
|
34
34
|
expect(@logger.logged(:debug)[0])
|
35
35
|
.to match(/Redis \(\d+\.\d+ms\) \[ GET test1 \] \[ GET test2 \]/)
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis-rails-instrumentation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ville Lautanala
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-07-10 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: redis
|
@@ -16,20 +15,20 @@ dependencies:
|
|
16
15
|
requirements:
|
17
16
|
- - ">="
|
18
17
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
18
|
+
version: '5'
|
20
19
|
- - "<"
|
21
20
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
21
|
+
version: '6'
|
23
22
|
type: :runtime
|
24
23
|
prerelease: false
|
25
24
|
version_requirements: !ruby/object:Gem::Requirement
|
26
25
|
requirements:
|
27
26
|
- - ">="
|
28
27
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
28
|
+
version: '5'
|
30
29
|
- - "<"
|
31
30
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
31
|
+
version: '6'
|
33
32
|
- !ruby/object:Gem::Dependency
|
34
33
|
name: activesupport
|
35
34
|
requirement: !ruby/object:Gem::Requirement
|
@@ -62,14 +61,14 @@ dependencies:
|
|
62
61
|
name: bundler
|
63
62
|
requirement: !ruby/object:Gem::Requirement
|
64
63
|
requirements:
|
65
|
-
- - "
|
64
|
+
- - ">="
|
66
65
|
- !ruby/object:Gem::Version
|
67
66
|
version: '1.6'
|
68
67
|
type: :development
|
69
68
|
prerelease: false
|
70
69
|
version_requirements: !ruby/object:Gem::Requirement
|
71
70
|
requirements:
|
72
|
-
- - "
|
71
|
+
- - ">="
|
73
72
|
- !ruby/object:Gem::Version
|
74
73
|
version: '1.6'
|
75
74
|
- !ruby/object:Gem::Dependency
|
@@ -107,16 +106,16 @@ executables: []
|
|
107
106
|
extensions: []
|
108
107
|
extra_rdoc_files: []
|
109
108
|
files:
|
109
|
+
- ".github/workflows/ci.yml"
|
110
110
|
- ".gitignore"
|
111
111
|
- ".rubocop.yml"
|
112
|
-
- ".travis.yml"
|
113
112
|
- Gemfile
|
114
113
|
- LICENSE.txt
|
115
114
|
- README.md
|
116
115
|
- Rakefile
|
117
116
|
- lib/redis-rails-instrumentation.rb
|
118
117
|
- lib/redis/rails/instrumentation.rb
|
119
|
-
- lib/redis/rails/instrumentation/
|
118
|
+
- lib/redis/rails/instrumentation/middleware.rb
|
120
119
|
- lib/redis/rails/instrumentation/version.rb
|
121
120
|
- redis-rails-instrumentation.gemspec
|
122
121
|
- spec/redis/rails/instrumentation_spec.rb
|
@@ -125,7 +124,6 @@ homepage: https://github.com/lautis/redis-rails-instrumentation
|
|
125
124
|
licenses:
|
126
125
|
- MIT
|
127
126
|
metadata: {}
|
128
|
-
post_install_message:
|
129
127
|
rdoc_options: []
|
130
128
|
require_paths:
|
131
129
|
- lib
|
@@ -140,9 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
138
|
- !ruby/object:Gem::Version
|
141
139
|
version: '0'
|
142
140
|
requirements: []
|
143
|
-
|
144
|
-
rubygems_version: 2.6.8
|
145
|
-
signing_key:
|
141
|
+
rubygems_version: 3.6.2
|
146
142
|
specification_version: 4
|
147
143
|
summary: Railtie to include Redis commands in Rails logging.
|
148
144
|
test_files:
|
data/.travis.yml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
class Redis
|
2
|
-
module Rails
|
3
|
-
module Instrumentation
|
4
|
-
# Logging monkeypatch for Redis to emit ActiveSupport::Notification events
|
5
|
-
module Logging
|
6
|
-
def logging(commands, &block)
|
7
|
-
ActiveSupport::Notifications.instrument('command.redis',
|
8
|
-
commands: commands) do
|
9
|
-
return super(commands, &block)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|