fluent-plugin-postgresql-csvlog 0.7.0 → 0.7.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 38090772bf1e0302ecd53d759d8da4ffb2df0cdf0a6f001ec0e0d12390472276
4
- data.tar.gz: 22bc8479b81f0b0fd7615cfb6cc1b491b317fc74d612f21373243a516e671be4
3
+ metadata.gz: 170ed1e58c16edf81a5f9a66b5cffa3509aa44f379dc03ccedd21af4e3bcbf5c
4
+ data.tar.gz: dd94befd3b95e9662e4ec9cac0be250f96f77e26627cfb0bc33afbb2f5f83bc6
5
5
  SHA512:
6
- metadata.gz: c3ecfef7d3290ab00a71613c7914c0aae1d05501d37574614d9d6f4a2f5de9548474ecb7b6fdad4ef778c4ea48510a1e31a89294e317ecf7ab6004e094579cc9
7
- data.tar.gz: 2b91a1704d53f07ab5139bc2d623c0c17afde53b416ef5f018dd7e6d345ce8a8da1d0aa8964bcef638b8e6ab351b2d7c16b83be73cbdcfba560dda69962bdd17
6
+ metadata.gz: 044f542d93ee7d99831853ddaf5b7f5fbb97c795417e9543c82acec545dae33fc6fd6bd00404d972cd27a8a78753fe0221ab21cfba0e468e4cd2842c73389969
7
+ data.tar.gz: b2d19bd75520d8a4b258be78c2d89f9d0d0b335f805698a72699bd658b1df30a365a4b91124b25de52fd11139ddc7008ff6ff7d333422eebdc8089920bf24890
@@ -2,7 +2,7 @@ $:.push File.expand_path('lib', __dir__)
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'fluent-plugin-postgresql-csvlog'
5
- s.version = '0.7.0'
5
+ s.version = '0.7.2'
6
6
  s.authors = ['stanhu']
7
7
  s.email = ['stanhu@gmail.com']
8
8
  s.homepage = 'https://gitlab.com/gitlab-org/fluent-plugins/fluent-plugin-postgresql-csvlog'
@@ -25,6 +25,8 @@ module Fluent::Plugin
25
25
  host(client_addr) as client_addr,
26
26
  client_hostname,
27
27
  client_port,
28
+ wait_event_type,
29
+ wait_event,
28
30
  xact_start,
29
31
  extract(epoch from clock_timestamp() - xact_start) xact_age_s,
30
32
  query_start,
@@ -75,6 +77,8 @@ module Fluent::Plugin
75
77
  'client_addr' => row['client_addr'],
76
78
  'client_hostname' => row['client_hostname'],
77
79
  'client_port' => row['client_port'],
80
+ 'wait_event_type' => row['wait_event_type'],
81
+ 'wait_event' => row['wait_event'],
78
82
  'xact_start' => row['xact_start']&.iso8601(3),
79
83
  'xact_age_s' => row['xact_age_s'],
80
84
  'query_start' => row['query_start']&.iso8601(3),
@@ -7,7 +7,7 @@ module Fluent::Plugin
7
7
  # utility method, useful for extracting marginalia into fluentd records
8
8
  module MarginaliaExtractor
9
9
  MARGINALIA_PREPENDED_REGEXP = %r{^(?<comment>/\*.*\*/)(?<sql>.*)}m.freeze
10
- MARGINALIA_APPENDED_REGEXP = %r{(?<sql>.*)(?<comment>/\*.*\*/)$}m.freeze
10
+ MARGINALIA_APPENDED_REGEXP = %r{(?<sql>.*)(?<comment>/\*.*\*/)\s*;?\s*$}m.freeze
11
11
 
12
12
  # Injects marginalia into a fluentd record
13
13
  def parse_marginalia_into_record(record, key, strip_comment)
@@ -53,6 +53,8 @@ class PgStatActivityInputTest < Test::Unit::TestCase
53
53
  'client_addr' => '172.17.0.1',
54
54
  'client_hostname' => nil,
55
55
  'client_port' => 60182,
56
+ 'wait_event' => 'relation',
57
+ 'wait_event_type' => 'Lock',
56
58
  'xact_start' => Time.parse('2021-07-23 12:55:25 +0000'),
57
59
  'xact_age_s' => 0.001884,
58
60
  'query_start' => Time.parse('2021-07-23 12:55:25 +0000'),
@@ -83,6 +85,8 @@ class PgStatActivityInputTest < Test::Unit::TestCase
83
85
  'state_change' => '2021-07-23T12:55:25.000+00:00',
84
86
  'usename' => 'testuser',
85
87
  'usesysid' => 10,
88
+ 'wait_event' => 'relation',
89
+ 'wait_event_type' => 'Lock',
86
90
  'xact_age_s' => 0.001884,
87
91
  'xact_start' => '2021-07-23T12:55:25.000+00:00'
88
92
  }
@@ -112,6 +116,8 @@ class PgStatActivityInputTest < Test::Unit::TestCase
112
116
  'state_change' => nil,
113
117
  'usename' => nil,
114
118
  'usesysid' => nil,
119
+ 'wait_event' => nil,
120
+ 'wait_event_type' => nil,
115
121
  'xact_age_s' => nil,
116
122
  'xact_start' => nil
117
123
  }
@@ -131,6 +137,8 @@ class PgStatActivityInputTest < Test::Unit::TestCase
131
137
  'client_addr' => '172.17.0.1',
132
138
  'client_hostname' => nil,
133
139
  'client_port' => 60182,
140
+ 'wait_event' => 'relation',
141
+ 'wait_event_type' => 'Lock',
134
142
  'xact_start' => Time.parse('2021-07-23 12:55:25 +0000'),
135
143
  'xact_age_s' => 0.001884,
136
144
  'query_start' => Time.parse('2021-07-23 12:55:25 +0000'),
@@ -161,6 +169,8 @@ class PgStatActivityInputTest < Test::Unit::TestCase
161
169
  'state_change' => '2021-07-23T12:55:25.000+00:00',
162
170
  'usename' => 'testuser',
163
171
  'usesysid' => 10,
172
+ 'wait_event' => 'relation',
173
+ 'wait_event_type' => 'Lock',
164
174
  'xact_age_s' => 0.001884,
165
175
  'xact_start' => '2021-07-23T12:55:25.000+00:00'
166
176
  }
@@ -180,6 +190,8 @@ class PgStatActivityInputTest < Test::Unit::TestCase
180
190
  'client_addr' => '172.17.0.1',
181
191
  'client_hostname' => nil,
182
192
  'client_port' => 60182,
193
+ 'wait_event' => 'relation',
194
+ 'wait_event_type' => 'Lock',
183
195
  'xact_start' => Time.parse('2021-07-23 12:55:25 +0000'),
184
196
  'xact_age_s' => 0.001884,
185
197
  'query_start' => Time.parse('2021-07-23 12:55:25 +0000'),
@@ -213,6 +225,8 @@ class PgStatActivityInputTest < Test::Unit::TestCase
213
225
  'state_change' => '2021-07-23T12:55:25.000+00:00',
214
226
  'usename' => 'testuser',
215
227
  'usesysid' => 10,
228
+ 'wait_event' => 'relation',
229
+ 'wait_event_type' => 'Lock',
216
230
  'xact_age_s' => 0.001884,
217
231
  'xact_start' => '2021-07-23T12:55:25.000+00:00'
218
232
  }
@@ -56,6 +56,14 @@ class Marginalia < Test::Unit::TestCase
56
56
  test_parse(sql, {}, 'sql', true, expected)
57
57
  end
58
58
 
59
+ test 'normal comment appended with trailing semicolon' do
60
+ sql = 'SELECT COUNT(*) FROM "projects" /* this is just a comment */ ; '
61
+ expected = {
62
+ "sql" => 'SELECT COUNT(*) FROM "projects"'
63
+ }
64
+ test_parse(sql, {}, 'sql', true, expected)
65
+ end
66
+
59
67
  test 'marginalia prepended for sidekiq' do
60
68
  sql = '/*application:sidekiq,correlation_id:d67cae54c169e0cab7d73389e2934f0e,jid:52a1c8a9e4c555ea573f20f0,job_class:Geo::MetricsUpdateWorker*/ SELECT COUNT(*) FROM "projects"'
61
69
  expected = {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-postgresql-csvlog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - stanhu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-10 00:00:00.000000000 Z
11
+ date: 2023-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -140,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
140
  - !ruby/object:Gem::Version
141
141
  version: '0'
142
142
  requirements: []
143
- rubygems_version: 3.2.28
143
+ rubygems_version: 3.4.8
144
144
  signing_key:
145
145
  specification_version: 4
146
146
  summary: fluentd plugins to work with PostgreSQL CSV logs