pgdexter 0.4.0 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +7 -5
- data/lib/dexter/indexer.rb +2 -1
- 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 +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e8097505929a24e8c038c7fe69ac667faaa05008a3aa94971501fc4b9f15157
|
4
|
+
data.tar.gz: a08bf061493ed984103ce768af1347d81250c51b4f068f69d3688a1e4fd25514
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c2d99ecbd5fd68e460f25982fe31d1149d9682a7065cfb674d24785f78138ab04d94bcdbf3b81f2d8065468f6531bbaea1e0593bd8fd7ab4dcdb2b061276c1e
|
7
|
+
data.tar.gz: 0e55cc589470760d317e3ba0e895d7ce5e24cd79517cf02c59aaba1caf36eb1f9785725eedc61e7402d480a61870828aaf2b33683f8ca58223f380d518c7df9c
|
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
|
|
@@ -190,11 +190,13 @@ dexter --log-sql --log-level debug2
|
|
190
190
|
|
191
191
|
## Hosted Postgres
|
192
192
|
|
193
|
-
|
193
|
+
The `hypopg` extension, which Dexter needs to run, is available on [these providers](https://github.com/ankane/dexter/issues/44).
|
194
|
+
|
195
|
+
For other providers, see [this guide](guides/Hosted-Postgres.md). To request a new extension:
|
194
196
|
|
195
197
|
- Amazon RDS - follow the instructions on [this page](https://aws.amazon.com/rds/postgresql/faqs/)
|
196
|
-
- Google Cloud SQL -
|
197
|
-
- DigitalOcean Managed Databases -
|
198
|
+
- Google Cloud SQL - vote or comment on [this page](https://issuetracker.google.com/issues/69250435)
|
199
|
+
- DigitalOcean Managed Databases - vote or comment on [this page](https://ideas.digitalocean.com/app-framework-services/p/support-hypopg-for-postgres)
|
198
200
|
|
199
201
|
## Additional Installation Methods
|
200
202
|
|
@@ -212,7 +214,7 @@ And run it with:
|
|
212
214
|
docker run -ti ankane/dexter <connection-options>
|
213
215
|
```
|
214
216
|
|
215
|
-
|
217
|
+
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
218
|
|
217
219
|
### Homebrew
|
218
220
|
|
data/lib/dexter/indexer.rb
CHANGED
@@ -620,6 +620,7 @@ module Dexter
|
|
620
620
|
end
|
621
621
|
|
622
622
|
def stat_statements
|
623
|
+
total_time = server_version_num >= 130000 ? "(total_plan_time + total_exec_time)" : "total_time"
|
623
624
|
result = execute <<-SQL
|
624
625
|
SELECT
|
625
626
|
DISTINCT query
|
@@ -629,7 +630,7 @@ module Dexter
|
|
629
630
|
pg_database ON pg_database.oid = pg_stat_statements.dbid
|
630
631
|
WHERE
|
631
632
|
datname = current_database()
|
632
|
-
AND total_time >= #{@min_time * 60000}
|
633
|
+
AND #{total_time} >= #{@min_time * 60000}
|
633
634
|
AND calls >= #{@min_calls}
|
634
635
|
ORDER BY
|
635
636
|
1
|
@@ -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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-30 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
|
@@ -94,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
95
|
- !ruby/object:Gem::Version
|
95
96
|
version: '0'
|
96
97
|
requirements: []
|
97
|
-
rubygems_version: 3.
|
98
|
+
rubygems_version: 3.4.1
|
98
99
|
signing_key:
|
99
100
|
specification_version: 4
|
100
101
|
summary: The automatic indexer for Postgres
|