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 +4 -4
- data/lib/log_stats/version.rb +1 -1
- data/lib/log_stats.rb +17 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30f0494b6189d8e2b56e0d6ab972fd363d8f0d79
|
4
|
+
data.tar.gz: 9fe334eca41cb6e932af200872eb4c294b0a1b49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7aebdc1fe8fee0cd706110bb520800a7a19f76fce170ff49833b58467e27d0dbf50b12fdafea3f966ca27815223a9fd9f514c86b734e6e53f65ee68be088f9fc
|
7
|
+
data.tar.gz: 8638a776727c81992058fcb5f06a12a72413a8a418c5cd896bcabf337a6b417ffccaf79e4598a20affa7974998ce9b6101bb408c25619632667ed1dc571a2b9d
|
data/lib/log_stats/version.rb
CHANGED
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[:
|
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.
|
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-
|
11
|
+
date: 2017-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|