log_stats 0.4.3 → 0.4.4

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: a2d41ac522f442b77ac7626e31fb585bc79efde4
4
- data.tar.gz: b1585a93945b1296d2c66a16dc2fb38d8b27317a
3
+ metadata.gz: 30f0494b6189d8e2b56e0d6ab972fd363d8f0d79
4
+ data.tar.gz: 9fe334eca41cb6e932af200872eb4c294b0a1b49
5
5
  SHA512:
6
- metadata.gz: 6839efa1ef45c97ac75ba8db6c5c4179dd0fb5ac45ebebeafb33d06d478db366da0232c77a33b8138320f5c2697c001534ae77d346ab3d57f9be2059be6d80a1
7
- data.tar.gz: da3dda45aba36b4b0aa58e59f709e423783c3abd08949a1d62cf85cc39312e6749f75297c1402ab6056b09b2d31835866efb3d0daf08700688c7d3dfdca5d414
6
+ metadata.gz: 7aebdc1fe8fee0cd706110bb520800a7a19f76fce170ff49833b58467e27d0dbf50b12fdafea3f966ca27815223a9fd9f514c86b734e6e53f65ee68be088f9fc
7
+ data.tar.gz: 8638a776727c81992058fcb5f06a12a72413a8a418c5cd896bcabf337a6b417ffccaf79e4598a20affa7974998ce9b6101bb408c25619632667ed1dc571a2b9d
@@ -1,3 +1,3 @@
1
1
  module LogStats
2
- VERSION = "0.4.3"
2
+ VERSION = "0.4.4"
3
3
  end
data/lib/log_stats.rb CHANGED
@@ -58,13 +58,28 @@ module LogStats
58
58
  Requests::Stats.stats(requests, requests_config))
59
59
  acc
60
60
  end
61
+ limit = requests_config[:limit] || 500
62
+ requests_4xx = requests_by_status.reduce({}) do |acc, (status, requests)|
63
+ if status / 100 == 4
64
+ acc[status] = requests.first(limit)
65
+ end
66
+ acc
67
+ end
68
+ requests_5xx = requests_by_status.reduce({}) do |acc, (status, requests)|
69
+ if status / 100 == 5
70
+ acc[status] = requests.first(limit)
71
+ end
72
+ acc
73
+ end
61
74
  result = {
62
75
  requests_count: requests_count,
63
76
  kpi: kpi,
64
- kpi_by_status: kpi_by_status
77
+ kpi_by_status: kpi_by_status,
78
+ requests_4xx: requests_4xx.first(limit),
79
+ requests_5xx: requests_5xx.first(limit)
65
80
  }
66
81
  # NOTE: stats is one entry per request path and can get very large so don't include it by default
67
- result[:stats] = stats if requests_config[:events]
82
+ result[:stats] = stats if requests_config[:stats]
68
83
  result
69
84
  end
70
85
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: log_stats
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Marklund
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-06 00:00:00.000000000 Z
11
+ date: 2017-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler