rack-lineprof 0.0.2 → 0.0.3

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: 7ad9c752240b1e88b98668f40ae787054efc1a2d
4
- data.tar.gz: 410e88432c20acaf0ee7a1dfc2acd874286ead2c
3
+ metadata.gz: 4c671bd62ed01d6e795f86c4707f3c63009e23af
4
+ data.tar.gz: 7a4119942165738a119d97f7261b4dbba1865e25
5
5
  SHA512:
6
- metadata.gz: d1fdeecc6a26e26ed2334f526d1d8f20ff9450295b7155f996cc485c1b3ef7b10f6e3059a2d5aabccc3bf1c4423546312a6e0248e769e713b7f1dacd1e8c81f1
7
- data.tar.gz: ecbdbd6b97797def5853af8ee37b1ef02296de2634f85c36a2196dd999be4762d6ad3babc625fd04db1d434c799d38bcf6c518ad93313aff77f7bf3974ee59a8
6
+ metadata.gz: f2d30923f4976336eb6e0d2fd1f9eb031901a32990e00846ac918625935a2dc6d3428561d78babcabd365863ac36c296c0b7cb3283f887c263096537e7cc91c3
7
+ data.tar.gz: 36feda5c2153b34a6a3b9fd91bf76ee3c4446c62541fa63fdcd6e9b066b795bb26ab130a0e5e77ea4bb766d5495337d1e3d82b85c2b30b1cf917c2ff62484a5c
@@ -20,7 +20,7 @@ module Rack
20
20
 
21
21
  def call env
22
22
  request = Rack::Request.new env
23
- matcher = request.params['lineprof']
23
+ matcher = request.params['lineprof'] || options[:profile]
24
24
 
25
25
  return @app.call env unless matcher
26
26
 
@@ -36,16 +36,16 @@ module Rack
36
36
  ms = sample[0] / 1000.0
37
37
  calls = sample[2]
38
38
 
39
- clocked = ms >= 0.2 # info
40
- near_clocked = (line-context..line+context).any? do |near|
39
+ abnormal = ms >= thresholds[NOMINAL]
40
+ near_abnormal = (line-context..line+context).any? do |near|
41
41
  near = [1, near].max
42
42
  next unless raw_samples[near]
43
- (raw_samples[near][0] / 1000.0) >= 0.2 # info
43
+ (raw_samples[near][0] / 1000.0) >= thresholds[NOMINAL]
44
44
  end
45
45
 
46
- next unless clocked or near_clocked
46
+ next unless abnormal or near_abnormal
47
47
 
48
- threshold = thresholds.detect { |boundary, _| ms > boundary }
48
+ threshold = thresholds.invert.detect { |th, _| ms > th }
49
49
  level = threshold ? threshold.last : CONTEXT
50
50
 
51
51
  next unless code = source_lines[line - 1]
@@ -75,7 +75,7 @@ module Rack
75
75
  CRITICAL => 50,
76
76
  WARNING => 5,
77
77
  NOMINAL => 0.2
78
- }.merge(options.fetch :thresholds, {}).invert
78
+ }.merge(options.fetch :thresholds, {})
79
79
  end
80
80
 
81
81
  end
metadata CHANGED
@@ -1,57 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-lineprof
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Owen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-19 00:00:00.000000000 Z
11
+ date: 2014-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '1.5'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '1.5'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rblineprof
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.3.1
33
+ version: 0.3.6
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.3.1
40
+ version: 0.3.6
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: term-ansicolor
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '1.3'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '1.3'
55
55
  description: Rack middleware for rblineprof (github.com/tmm1/rblineprof)
56
56
  email:
57
57
  - kainosnoema@gmail.com
@@ -59,10 +59,10 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
+ - lib/rack-lineprof.rb
63
+ - lib/rack/lineprof.rb
62
64
  - lib/rack/lineprof/sample.rb
63
65
  - lib/rack/lineprof/source.rb
64
- - lib/rack/lineprof.rb
65
- - lib/rack-lineprof.rb
66
66
  homepage: https://github.com/kainosnoema/rack-lineprof
67
67
  licenses:
68
68
  - MIT
@@ -73,17 +73,17 @@ require_paths:
73
73
  - lib
74
74
  required_ruby_version: !ruby/object:Gem::Requirement
75
75
  requirements:
76
- - - '>='
76
+ - - ">="
77
77
  - !ruby/object:Gem::Version
78
78
  version: '0'
79
79
  required_rubygems_version: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - '>='
81
+ - - ">="
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  requirements: []
85
85
  rubyforge_project:
86
- rubygems_version: 2.0.0
86
+ rubygems_version: 2.2.2
87
87
  signing_key:
88
88
  specification_version: 4
89
89
  summary: Makes line-by-line source code profiling easy.