log_bench 0.5.2 → 0.5.3
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/lib/log_bench/log/call_line_entry.rb +2 -2
- data/lib/log_bench/log/entry.rb +1 -1
- data/lib/log_bench/log/parser.rb +19 -5
- data/lib/log_bench/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c3cadcab03882aae96975ccfc7af0ce41c0e45cb8fed84182e012b1401c6b701
|
|
4
|
+
data.tar.gz: 0c9137a70a659e69c3abbedbea4e530bc255f866c77dbdb1495f47dd0a1ffe98
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cbedbfc86537d8343f4e44d531a7183112dd010432994c30321285948cf2cbf79fd76ecceba8bc73ab2a0f007ad8690bea584f3d2a7681b905ec8f4fd4696051
|
|
7
|
+
data.tar.gz: a1d6c1f51b317c5e04ced37994de4024c35548e36b8a0c57a179c5984c2a0dafeb7f49d524d4abdfb0ebb644a84f5e2d5bc680bfc2d93e46e4ce2d69f33f3e63
|
|
@@ -23,7 +23,7 @@ module LogBench
|
|
|
23
23
|
|
|
24
24
|
def extract_from_json(data)
|
|
25
25
|
super
|
|
26
|
-
message = data["message"]
|
|
26
|
+
message = Parser.normalize_message(data["message"])
|
|
27
27
|
return unless call_line_message?(data)
|
|
28
28
|
|
|
29
29
|
self.content = message.strip
|
|
@@ -40,7 +40,7 @@ module LogBench
|
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
def call_line_message?(data)
|
|
43
|
-
message = data["message"]
|
|
43
|
+
message = Parser.normalize_message(data["message"])
|
|
44
44
|
message.include?("↳")
|
|
45
45
|
end
|
|
46
46
|
end
|
data/lib/log_bench/log/entry.rb
CHANGED
|
@@ -9,7 +9,7 @@ module LogBench
|
|
|
9
9
|
self.json_data = json_data
|
|
10
10
|
self.timestamp = parse_timestamp(json_data["timestamp"])
|
|
11
11
|
self.request_id = json_data["request_id"]
|
|
12
|
-
self.content = json_data["message"]
|
|
12
|
+
self.content = Parser.normalize_message(json_data["message"])
|
|
13
13
|
self.type = :other
|
|
14
14
|
end
|
|
15
15
|
|
data/lib/log_bench/log/parser.rb
CHANGED
|
@@ -83,28 +83,42 @@ module LogBench
|
|
|
83
83
|
data["method"] && data["path"] && data["status"]
|
|
84
84
|
end
|
|
85
85
|
|
|
86
|
+
def self.normalize_message(message)
|
|
87
|
+
case message
|
|
88
|
+
when String
|
|
89
|
+
message
|
|
90
|
+
when Array
|
|
91
|
+
message.join(" ")
|
|
92
|
+
when NilClass
|
|
93
|
+
""
|
|
94
|
+
else
|
|
95
|
+
message.to_s
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
86
99
|
def self.sql_message?(data)
|
|
87
|
-
message = data["message"]
|
|
100
|
+
message = normalize_message(data["message"])
|
|
88
101
|
%w[SELECT INSERT UPDATE DELETE TRANSACTION BEGIN COMMIT ROLLBACK SAVEPOINT].any? { |op| message.include?(op) }
|
|
89
102
|
end
|
|
90
103
|
|
|
91
104
|
def self.cache_message?(data)
|
|
92
|
-
message = data["message"]
|
|
105
|
+
message = normalize_message(data["message"])
|
|
93
106
|
message.include?("CACHE")
|
|
94
107
|
end
|
|
95
108
|
|
|
96
109
|
def self.call_stack_message?(data)
|
|
97
|
-
message = data["message"]
|
|
110
|
+
message = normalize_message(data["message"])
|
|
98
111
|
message.include?("↳")
|
|
99
112
|
end
|
|
100
113
|
|
|
101
114
|
def self.job_enqueue_message?(data)
|
|
102
|
-
message = data["message"]
|
|
115
|
+
message = normalize_message(data["message"])
|
|
103
116
|
message.match?(/Enqueued .+ \(Job ID: .+\)/)
|
|
104
117
|
end
|
|
105
118
|
|
|
106
119
|
def self.extract_job_id_from_enqueue(message)
|
|
107
|
-
|
|
120
|
+
normalized_message = normalize_message(message)
|
|
121
|
+
match = normalized_message.match(/Job ID: ([^\)]+)/)
|
|
108
122
|
match[1] if match
|
|
109
123
|
end
|
|
110
124
|
|
data/lib/log_bench/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: log_bench
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Benjamín Silva
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2025-11-
|
|
10
|
+
date: 2025-11-12 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: zeitwerk
|