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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 62ad383008579d8dbe952b3f96c827e01aa198c0eb74b3b884188472459b34b8
4
- data.tar.gz: b77596742f0e13bb058354edcd901d1e93ec94f61bf6a695957c51fe9c7e41dc
3
+ metadata.gz: 109808872c6a579e6ce82956d5b2b1da8c66af7c85fae3d5984367e374484eb2
4
+ data.tar.gz: 6fe0f25f316afd84c287ba2fefe5076846c8a572bf2cbee406843abf632ddb2d
5
5
  SHA512:
6
- metadata.gz: 1b5f18ce901729f9e22d4222b0ba7ee498be18edb7897221c28069f8beceb65058342c47e9211ce94814d04b380387b95506722b1568a1d44b4d3c8386beeb17
7
- data.tar.gz: fa51ae2cde49dfcf9fc181a30bda4941c2ea01f1186fdd6a8cd002059a71c4b3341686cd62f2d1366874c941b92db1a4f74a6abd272baa66063907602e1376c5
6
+ metadata.gz: c2e5b5d80869c5c90b234af5edbb6d0c0e6118a3dc7191c2d7169209c7ae1505329fb18ea5e3803b045a527dd20b2909a9b2067732dfa030bbce0a931fc88954
7
+ data.tar.gz: 03d139a0f6ac0e967ad4f98685a6d8e513eab0b2022c7a0f7c6d27eca0da9b6441c30480a19acacf5c5f5f0ec762a7243331c3ee752b071015800a98043cad3b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.4.1 (2022-10-15)
2
+
3
+ - Added support for `json` format
4
+
1
5
  ## 0.4.0 (2022-07-27)
2
6
 
3
7
  - Added support for pg_query 2
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
- On Mac and Windows, use `host.docker.internal` as the database hostname for databases on your local machine.
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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Dexter
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
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.0
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-07-28 00:00:00.000000000 Z
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