perf_check 0.4.0 → 0.4.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: f8cdfcd06c215cfa05e4267afa28abf9f8d8efba
4
- data.tar.gz: a895cac67e5622ea31c997239f7371aac08fce8a
3
+ metadata.gz: ad9c18545aaee3bdcba0a6bb28eb307b341ba78a
4
+ data.tar.gz: 89809449598f93009f78b0c353ab432f7da341f5
5
5
  SHA512:
6
- metadata.gz: a9c4c040e1d5e27d2f21b59f527efe287ebdfdacd794c447ada57c08c85c725406695f6759c2a305474875688fb7f6c6f13c4f0e10db4fc2094cc9e984564ea6
7
- data.tar.gz: eba0557a4d74c324892cf01a9a4c2a5abbf6f6b0c7cb78df3be9289f1d7fa0342900c43569b101d55d8b9e09b31ca661856275817794ac0daa06588377bb6dbc
6
+ metadata.gz: 51b79c492435781ae275d452045cc34ce6d7468b0ce756a43b1ead8692a3c15a42ca6f718854718aea189c4f9aafaf089da281767d44f34eb89a441ffddb1e41
7
+ data.tar.gz: 6963d6cf9bf01766168a87fc3962cbdd85b9a42b46b63128c9f9defb18d2c206219d0eb359c0da8c6dc3ef066c268023ceb2a3dba7f810f245824cf4367caac8
@@ -59,10 +59,10 @@ class PerfCheck
59
59
  test.cookie = options.cookie
60
60
 
61
61
  if options.diff
62
- logger.info("Issuing #{test.resource}")
62
+ PerfCheck.logger.info("Issuing #{test.resource}")
63
63
  else
64
- logger.info ''
65
- logger.info("Benchmarking #{test.resource}:")
64
+ PerfCheck.logger.info ''
65
+ PerfCheck.logger.info("Benchmarking #{test.resource}:")
66
66
  end
67
67
 
68
68
  test.run(server, options)
@@ -17,9 +17,9 @@ class PerfCheck
17
17
  def self.before_start_callbacks
18
18
  (@before_start_callbacks || []) + [
19
19
  proc {
20
- logger.info("=" * 77)
21
- logger.info("PERRRRF CHERRRK! Grab a ☕️ and don't touch your working tree (we automate git)")
22
- logger.info("=" * 77)
20
+ PerfCheck.logger.info("=" * 77)
21
+ PerfCheck.logger.info("PERRRRF CHERRRK! Grab a ☕️ and don't touch your working tree (we automate git)")
22
+ PerfCheck.logger.info("=" * 77)
23
23
  }
24
24
  ]
25
25
  end
@@ -3,7 +3,7 @@ require 'optparse'
3
3
  class PerfCheck
4
4
  def self.config
5
5
  @config ||= OpenStruct.new(
6
- number_of_requests: 10,
6
+ number_of_requests: 20,
7
7
  reference: 'master',
8
8
  cookie: nil,
9
9
  headers: {},
@@ -25,7 +25,7 @@ class PerfCheck
25
25
 
26
26
  opts.separator "\nBenchmark options:"
27
27
  opts.on('--requests N', '-n',
28
- 'Use N requests in benchmark, defaults to 10') do |n|
28
+ 'Use N requests in benchmark, defaults to 20') do |n|
29
29
  config.number_of_requests = n.to_i
30
30
  end
31
31
 
@@ -35,8 +35,7 @@ class PerfCheck
35
35
  end
36
36
 
37
37
  opts.on('--quick', '-q',
38
- 'Fire off 5 requests just on this branch, no comparison with master') do
39
- config.number_of_requests = 5
38
+ 'Fire off 20 requests just on this branch (no comparison with master)') do
40
39
  config.reference = nil
41
40
  end
42
41
 
@@ -11,7 +11,7 @@ class PerfCheck
11
11
  def self.checkout_reference(reference='master')
12
12
  checkout(reference)
13
13
  at_exit do
14
- logger.info ''
14
+ PerfCheck.logger.info ''
15
15
  Git.checkout_current_branch(false)
16
16
  end
17
17
  end
@@ -21,11 +21,11 @@ class PerfCheck
21
21
  end
22
22
 
23
23
  def self.checkout(branch, bundle=true)
24
- logger.info("Checking out #{branch} and bundling... ")
24
+ PerfCheck.logger.info("Checking out #{branch} and bundling... ")
25
25
  `git checkout #{branch} --quiet`
26
26
 
27
27
  unless $?.success?
28
- logger.fatal("Problem with git checkout! Bailing...") && abort
28
+ PerfCheck.logger.fatal("Problem with git checkout! Bailing...") && abort
29
29
  end
30
30
 
31
31
  `git submodule update --quiet`
@@ -33,18 +33,18 @@ class PerfCheck
33
33
  if bundle
34
34
  Bundler.with_clean_env{ `bundle` }
35
35
  unless $?.success?
36
- logger.fatal("Problem bundling! Bailing...") && abort
36
+ PerfCheck.logger.fatal("Problem bundling! Bailing...") && abort
37
37
  end
38
38
  end
39
39
  end
40
40
 
41
41
  def self.stash_if_needed
42
42
  if anything_to_stash?
43
- logger.info("Stashing your changes... ")
43
+ PerfCheck.logger.info("Stashing your changes... ")
44
44
  system('git stash -q >/dev/null')
45
45
 
46
46
  unless $?.success?
47
- logger.fatal("Problem with git stash! Bailing...") && abort
47
+ PerfCheck.logger.fatal("Problem with git stash! Bailing...") && abort
48
48
  end
49
49
 
50
50
  at_exit do
@@ -60,11 +60,11 @@ class PerfCheck
60
60
  end
61
61
 
62
62
  def self.pop
63
- logger.info("Git stash applying...")
63
+ PerfCheck.logger.info("Git stash applying...")
64
64
  system('git stash pop -q')
65
65
 
66
66
  unless $?.success?
67
- logger.fatal("Problem with git stash! Bailing...") && abort
67
+ PerfCheck.logger.fatal("Problem with git stash! Bailing...") && abort
68
68
  end
69
69
  end
70
70
 
@@ -12,8 +12,3 @@ class PerfCheck
12
12
 
13
13
  def logger; self.class.logger; end
14
14
  end
15
-
16
- class Object
17
- def self.logger; PerfCheck.logger; end
18
- def logger; PerfCheck.logger; end
19
- end
@@ -108,10 +108,10 @@ class PerfCheck
108
108
 
109
109
  def restart
110
110
  if !@running
111
- logger.info("starting rails...")
111
+ PerfCheck.logger.info("starting rails...")
112
112
  start
113
113
  else
114
- logger.info("re-starting rails...")
114
+ PerfCheck.logger.info("re-starting rails...")
115
115
  exit
116
116
  start
117
117
  end
@@ -20,7 +20,7 @@ class PerfCheck
20
20
 
21
21
  def run(server, options)
22
22
  unless options.diff
23
- logger.info("\t"+['request', 'latency', 'server rss', 'status', 'queries', 'profiler data'].map(&:underline).join(" "))
23
+ PerfCheck.logger.info("\t"+['request', 'latency', 'server rss', 'status', 'queries', 'profiler data'].map(&:underline).join(" "))
24
24
  end
25
25
 
26
26
  profiles = (@context == :reference) ? reference_profiles : this_profiles
@@ -40,9 +40,9 @@ class PerfCheck
40
40
  error_dump.write(profile.response_body)
41
41
  end
42
42
  error = sprintf("\t%2i:\tFAILED! (HTTP %d)", i, profile.response_code)
43
- logger.fatal(error.red.bold)
44
- logger.fatal("\t The server responded with a non-2xx status for this request.")
45
- logger.fatal("\t The response has been written to tmp/perf_check/failed_request.html")
43
+ PerfCheck.logger.fatal(error.red.bold)
44
+ PerfCheck.logger.fatal("\t The server responded with a non-2xx status for this request.")
45
+ PerfCheck.logger.fatal("\t The response has been written to tmp/perf_check/failed_request.html")
46
46
  abort
47
47
  end
48
48
  end
@@ -65,13 +65,13 @@ class PerfCheck
65
65
  row = sprintf("\t%2i:\t %.1fms %4dMB\t %s\t %s\t %s",
66
66
  i, profile.latency, profile.server_memory,
67
67
  profile.response_code, profile.query_count, profile.profile_url)
68
- logger.info(row)
68
+ PerfCheck.logger.info(row)
69
69
  end
70
70
 
71
71
  profiles << profile
72
72
  end
73
73
 
74
- logger.info '' unless options.diff # pretty!
74
+ PerfCheck.logger.info '' unless options.diff # pretty!
75
75
  end
76
76
 
77
77
  def this_latency
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: perf_check
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - rubytune
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-03 00:00:00.000000000 Z
11
+ date: 2016-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize