rorvswild 1.5.15 → 1.5.17

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
  SHA256:
3
- metadata.gz: 29d23fa806fe2d9547169a35795b4b313bf7510264aba4d0f8f3471ae7acf047
4
- data.tar.gz: 681d88bef1fb76ede952387ef1d8ffbdf4bfa4cbf08f990f7964624401ff71a9
3
+ metadata.gz: 6ce241e0d917e560c8a5683bdc210dbd4f5158cd7bf49444ced9548d85b61e5e
4
+ data.tar.gz: b354848c0048368c615e4c2dd5231864a164c127af0aaf590fbfcd5c2a1cb36c
5
5
  SHA512:
6
- metadata.gz: e54dba0143bdb8e94677519698857c7ddc62f91ecb0a876ecc9e0e2fb402e4d11055a59f03cca1c2ca5a2e73b82cf5380574d9e3e4c73d1a66e21c7ea54cfe6c
7
- data.tar.gz: 92d4cb2e15015929ccc609b6b81837fb1a78ea12ebe4538555e0a023266fc852001d1aa17d7e620b50dd6ac3f856cbf08bba1d3cb9e4f24f10333b1faa26064d
6
+ metadata.gz: fc3e48e9328b450bfb3cb7e7e4536e249470bcf7cb1fd2b3c7f67416daa66e1c281e742446a97f868276ac3028a573a84247b80b7f3053fbaeb9f9dfe4209c57
7
+ data.tar.gz: eab70d88fd705bdd5d679b625a9b6e06b6612cff6eaa6dc5080d6cd80a38f6f28e1a198f475b683cecdb25be7ac98d54a67eecfb8ee8cea230d987248e846823
@@ -159,6 +159,17 @@ module RorVsWild
159
159
  @os_description = RbConfig::CONFIG["host_os"]
160
160
  end
161
161
 
162
+ def hostname
163
+ if gae_instance = ENV["GAE_INSTANCE"] || ENV["CLOUD_RUN_EXECUTION"]
164
+ gae_instance
165
+ elsif dyno = ENV["DYNO"] # Heroku
166
+ dyno.start_with?("run.") ? "run.*" :
167
+ dyno.start_with?("release.") ? "release.*" : dyno
168
+ else
169
+ Socket.gethostname
170
+ end
171
+ end
172
+
162
173
  #######################
163
174
  ### Private methods ###
164
175
  #######################
@@ -25,7 +25,7 @@ module RorVsWild
25
25
 
26
26
  def to_h
27
27
  {
28
- hostname: Socket.gethostname,
28
+ hostname: RorVsWild.agent.hostname,
29
29
  os: RorVsWild.agent.os_description,
30
30
  cpu_user: cpu.user,
31
31
  cpu_system: cpu.system,
@@ -1,31 +1,45 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RorVsWild
2
4
  module Plugin
3
5
  class Redis
4
6
  def self.setup
5
7
  return if !defined?(::Redis)
6
- return if ::Redis::Client.method_defined?(:process_without_rorvswild)
7
- ::Redis::Client.class_eval do
8
- alias_method :process_without_rorvswild, :process
8
+ if ::Redis::Client.method_defined?(:process)
9
+ ::Redis::Client.prepend(V4)
10
+ else
11
+ ::Redis.prepend(V5)
12
+ end
13
+ end
9
14
 
10
- def process(commands, &block)
11
- string = RorVsWild::Plugin::Redis.commands_to_string(commands)
12
- appendable = RorVsWild::Plugin::Redis.appendable_commands?(commands)
13
- RorVsWild.agent.measure_section(string, appendable_command: appendable, kind: "redis".freeze) do
14
- process_without_rorvswild(commands, &block)
15
- end
15
+ module V4
16
+ def process(commands, &block)
17
+ string = commands.map(&:first).join("\n")
18
+ appendable = APPENDABLE_COMMANDS.include?(commands[0][0])
19
+ RorVsWild.agent.measure_section(string, appendable_command: appendable, kind: "redis") do
20
+ super(commands, &block)
16
21
  end
17
22
  end
18
23
  end
19
24
 
20
- def self.commands_to_string(commands)
21
- commands.map { |c| c[0] }.join("\n".freeze)
22
- end
25
+ module V5
26
+ def send_command(command, &block)
27
+ appendable = APPENDABLE_COMMANDS.include?(command)
28
+ RorVsWild.agent.measure_section(command[0], appendable_command: appendable, kind: "redis") do
29
+ super(command, &block)
30
+ end
31
+ end
23
32
 
24
- APPENDABLE_COMMANDS = [:auth, :select]
33
+ def pipelined
34
+ RorVsWild.agent.measure_section("pipeline", kind: "redis") { super }
35
+ end
25
36
 
26
- def self.appendable_commands?(commands)
27
- commands.size == 1 && APPENDABLE_COMMANDS.include?(commands.first.first)
37
+ def multi
38
+ RorVsWild.agent.measure_section("multi", kind: "redis") { super }
39
+ end
28
40
  end
41
+
42
+ APPENDABLE_COMMANDS = [:auth, :select]
29
43
  end
30
44
  end
31
45
  end
@@ -1,3 +1,3 @@
1
1
  module RorVsWild
2
- VERSION = "1.5.15".freeze
2
+ VERSION = "1.5.17".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rorvswild
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.15
4
+ version: 1.5.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexis Bernard
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-08-17 00:00:00.000000000 Z
12
+ date: 2022-10-25 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Performances and errors insights for rails developers.
15
15
  email: