log_sense 2.5.0 → 2.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.org +4 -0
- data/Gemfile.lock +1 -1
- data/lib/log_sense/formatting_util.rb +17 -0
- data/lib/log_sense/rails_aggregator.rb +17 -6
- data/lib/log_sense/report_shaper.rb +3 -2
- data/lib/log_sense/version.rb +1 -1
- data/lib/log_sense.rb +1 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f8391c34a76ec3e73970663c4636b30b357a0393b37d226cf11b28cf280e690
|
4
|
+
data.tar.gz: edf38e10347cee43dd31ca77bc4631da40c3dd1504949eba04806533914ee048
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d54dd1a3014112cb2065d359e8309821321af2aa8dfd60effccf36f03735c796035be41e66f9a52f16809ea9fb3e0a179d70c7952554714b799cc74b18604ca1
|
7
|
+
data.tar.gz: e499045dbe77afb688b56ba01108a6d9bcbb2033c59df0c568d12c5807218f8f62579cdebc7fe35356271c51f8b86ba8aad7b72084025ec5ac6969d2b8afcf15
|
data/CHANGELOG.org
CHANGED
data/Gemfile.lock
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module LogSense
|
4
|
+
module FormattingUtil
|
5
|
+
##
|
6
|
+
# Number with thousand separator
|
7
|
+
#
|
8
|
+
def self.with_thousands(number, separator: ",", comma: ".")
|
9
|
+
return unless number
|
10
|
+
|
11
|
+
decimal, fraction = number.to_s.split(comma)
|
12
|
+
with_thousands = decimal.reverse.gsub(/(\d\d\d)/, "\\1#{separator}")
|
13
|
+
|
14
|
+
"#{with_thousands.reverse}#{comma if fraction}#{fraction}"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -5,6 +5,9 @@ module LogSense
|
|
5
5
|
class RailsAggregator < Aggregator
|
6
6
|
WORDS_SEPARATOR = ' · '
|
7
7
|
|
8
|
+
# with thousands
|
9
|
+
include LogSense::FormattingUtil
|
10
|
+
|
8
11
|
def initialize(db, options = { limit: 900 })
|
9
12
|
@table = "Event"
|
10
13
|
@date_field = "started_at"
|
@@ -81,18 +84,26 @@ module LogSense
|
|
81
84
|
}
|
82
85
|
end
|
83
86
|
|
84
|
-
|
85
|
-
SELECT SUM(queries), SUM(cached_queries),
|
86
|
-
ROUND(SUM(
|
87
|
+
queries = @db.execute %Q(
|
88
|
+
SELECT SUM(DISTINCT(id)), SUM(queries), SUM(cached_queries),
|
89
|
+
ROUND(1.0 * SUM(cached_queries) / SUM(queries), 2)
|
87
90
|
FROM Event
|
88
91
|
)
|
89
92
|
|
93
|
+
@queries = queries.map do |row|
|
94
|
+
row.map do |element|
|
95
|
+
FormattingUtil.with_thousands(element)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
90
99
|
@queries_by_controller = @db.execute %Q(
|
91
100
|
SELECT controller,
|
92
|
-
|
101
|
+
COUNT(DISTINCT(id)),
|
102
|
+
MIN(queries), MAX(queries),
|
103
|
+
ROUND(AVG(queries), 2),
|
93
104
|
SUM(queries), SUM(cached_queries),
|
94
|
-
ROUND(SUM(cached_queries) / SUM(queries), 2),
|
95
|
-
SUM(gc_duration)
|
105
|
+
ROUND(1.0 * SUM(cached_queries) / SUM(queries), 2),
|
106
|
+
ROUND(SUM(gc_duration), 2)
|
96
107
|
FROM Event
|
97
108
|
GROUP BY Event.controller
|
98
109
|
)
|
@@ -139,8 +139,8 @@ module LogSense
|
|
139
139
|
def queries(data, colors: [], col: "small-12 cell")
|
140
140
|
{
|
141
141
|
title: "Number of queries",
|
142
|
-
header: %w[Queries Cached Perc_Cached],
|
143
|
-
column_alignment: %i[
|
142
|
+
header: %w[Queries Total Cached Perc_Cached],
|
143
|
+
column_alignment: %i[center center center center],
|
144
144
|
rows: data[:queries],
|
145
145
|
col: col,
|
146
146
|
}
|
@@ -150,6 +150,7 @@ module LogSense
|
|
150
150
|
{
|
151
151
|
title: "Queries by Controller",
|
152
152
|
header: ["Controller",
|
153
|
+
"Events",
|
153
154
|
"Min queries", "Max queries", "Avg Queries",
|
154
155
|
"Total queries", "Cached queries", "Perc",
|
155
156
|
"Total GC"],
|
data/lib/log_sense/version.rb
CHANGED
data/lib/log_sense.rb
CHANGED
@@ -6,6 +6,7 @@ require "log_sense/options/checker"
|
|
6
6
|
require "log_sense/apache/log_parser"
|
7
7
|
require "log_sense/rails/log_parser"
|
8
8
|
|
9
|
+
require "log_sense/formatting_util"
|
9
10
|
require "log_sense/aggregator"
|
10
11
|
require "log_sense/apache_aggregator"
|
11
12
|
require "log_sense/rails_aggregator"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: log_sense
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.5.
|
4
|
+
version: 2.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adolfo Villafiorita
|
@@ -196,6 +196,7 @@ files:
|
|
196
196
|
- lib/log_sense/apache_aggregator.rb
|
197
197
|
- lib/log_sense/apache_report_shaper.rb
|
198
198
|
- lib/log_sense/emitter.rb
|
199
|
+
- lib/log_sense/formatting_util.rb
|
199
200
|
- lib/log_sense/ip_locator.rb
|
200
201
|
- lib/log_sense/options/checker.rb
|
201
202
|
- lib/log_sense/options/parser.rb
|