pgdexter 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +2 -2
- data/lib/dexter/json_log_parser.rb +23 -0
- data/lib/dexter/processor.rb +2 -0
- data/lib/dexter/version.rb +1 -1
- data/lib/dexter.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 109808872c6a579e6ce82956d5b2b1da8c66af7c85fae3d5984367e374484eb2
|
4
|
+
data.tar.gz: 6fe0f25f316afd84c287ba2fefe5076846c8a572bf2cbee406843abf632ddb2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2e5b5d80869c5c90b234af5edbb6d0c0e6118a3dc7191c2d7169209c7ae1505329fb18ea5e3803b045a527dd20b2909a9b2067732dfa030bbce0a931fc88954
|
7
|
+
data.tar.gz: 03d139a0f6ac0e967ad4f98685a6d8e513eab0b2022c7a0f7c6d27eca0da9b6441c30480a19acacf5c5f5f0ec762a7243331c3ee752b071015800a98043cad3b
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
The automatic indexer for Postgres
|
4
4
|
|
5
|
-
[Read about how it works](https://ankane.org/introducing-dexter)
|
5
|
+
[Read about how it works](https://ankane.org/introducing-dexter) or [watch the talk](https://www.youtube.com/watch?v=Mni_1yTaNbE)
|
6
6
|
|
7
7
|
[![Build Status](https://github.com/ankane/dexter/workflows/build/badge.svg?branch=master)](https://github.com/ankane/dexter/actions)
|
8
8
|
|
@@ -212,7 +212,7 @@ And run it with:
|
|
212
212
|
docker run -ti ankane/dexter <connection-options>
|
213
213
|
```
|
214
214
|
|
215
|
-
|
215
|
+
For databases on the host machine, use `host.docker.internal` as the hostname (on Linux, this requires Docker 20.04 and `--add-host=host.docker.internal:host-gateway`).
|
216
216
|
|
217
217
|
### Homebrew
|
218
218
|
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require "json"
|
2
|
+
|
3
|
+
module Dexter
|
4
|
+
class JsonLogParser < LogParser
|
5
|
+
FIRST_LINE_REGEX = /\A.+/
|
6
|
+
|
7
|
+
def perform
|
8
|
+
@logfile.each_line do |line|
|
9
|
+
row = JSON.parse(line.chomp)
|
10
|
+
if (m = REGEX.match(row["message"]))
|
11
|
+
# replace first line with match
|
12
|
+
# needed for multiline queries
|
13
|
+
active_line = row["message"].sub(FIRST_LINE_REGEX, m[3])
|
14
|
+
|
15
|
+
add_parameters(active_line, row["detail"]) if row["detail"]
|
16
|
+
process_entry(active_line, m[1].to_f)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
rescue JSON::ParserError => e
|
20
|
+
raise Dexter::Abort, "ERROR: #{e.message}"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/dexter/processor.rb
CHANGED
@@ -13,6 +13,8 @@ module Dexter
|
|
13
13
|
PgStatActivityParser.new(@indexer, @collector)
|
14
14
|
elsif options[:input_format] == "csv"
|
15
15
|
CsvLogParser.new(logfile, @collector)
|
16
|
+
elsif options[:input_format] == "json"
|
17
|
+
JsonLogParser.new(logfile, @collector)
|
16
18
|
elsif options[:input_format] == "sql"
|
17
19
|
SqlLogParser.new(logfile, @collector)
|
18
20
|
else
|
data/lib/dexter/version.rb
CHANGED
data/lib/dexter.rb
CHANGED
@@ -16,6 +16,7 @@ require "dexter/collector"
|
|
16
16
|
require "dexter/indexer"
|
17
17
|
require "dexter/log_parser"
|
18
18
|
require "dexter/csv_log_parser"
|
19
|
+
require "dexter/json_log_parser"
|
19
20
|
require "dexter/pg_stat_activity_parser"
|
20
21
|
require "dexter/sql_log_parser"
|
21
22
|
require "dexter/processor"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pgdexter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: slop
|
@@ -68,6 +68,7 @@ files:
|
|
68
68
|
- lib/dexter/collector.rb
|
69
69
|
- lib/dexter/csv_log_parser.rb
|
70
70
|
- lib/dexter/indexer.rb
|
71
|
+
- lib/dexter/json_log_parser.rb
|
71
72
|
- lib/dexter/log_parser.rb
|
72
73
|
- lib/dexter/logging.rb
|
73
74
|
- lib/dexter/pg_stat_activity_parser.rb
|