fluent-plugin-pg-query 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: bee0442f8ed755f505f6db5abc873eaf657e6e3da4131be73e96c6daa2460d35
4
+ data.tar.gz: 79d690906c0eb7dbc7cbb4488081bfff1db238f7699b4675aaa0d3c56dfb8a90
5
+ SHA512:
6
+ metadata.gz: 2bce8ffb5edd36c86598ec8ab2859dd2e103de1d44b1422f7ba8033884722dcded4add65d4c2c71e87a2deb0c97dffa819c302d85ea1f315146ef684489cf1ad
7
+ data.tar.gz: b5d7afcf981fbee0e9f5ca89132968feae499fab503baf2ceacef2159123795c41e8d115981d1746b5c2038070fe3143041152924c28c5c8e9538c47a392d3b8
data/.rubocop.yml ADDED
@@ -0,0 +1,38 @@
1
+ ---
2
+
3
+ plugins:
4
+ - rubocop-rake
5
+
6
+ AllCops:
7
+ TargetRubyVersion: 2.7
8
+ NewCops: enable
9
+
10
+ Gemspec/DevelopmentDependencies:
11
+ # Enabled: false
12
+ EnforcedStyle: gemspec
13
+
14
+ Metrics/AbcSize:
15
+ Max: 20
16
+
17
+ Metrics/BlockLength:
18
+ Exclude:
19
+ - fluent-plugin-pg-query.gemspec
20
+ - test/**/*.rb
21
+
22
+ Metrics/ClassLength:
23
+ Exclude:
24
+ - test/**/*.rb
25
+
26
+ Metrics/MethodLength:
27
+ Max: 20
28
+
29
+ Metrics/ParameterLists:
30
+ Exclude:
31
+ - test/helper.rb
32
+
33
+ Naming/MethodParameterName:
34
+ Exclude:
35
+ - lib/fluent/plugin/n_pg_query.rb
36
+
37
+ Style/Documentation:
38
+ Enabled: false
data/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,153 @@
1
+ # fluent-plugin-pg-query
2
+
3
+ [Fluentd](https://fluentd.org/) plugins to communicate with postgresql.
4
+
5
+
6
+ ## Installation
7
+
8
+ ### RubyGems
9
+
10
+ ```
11
+ $ gem install fluent-plugin-pg-query
12
+ ```
13
+
14
+ ### Bundler
15
+
16
+ Add following line to your Gemfile:
17
+
18
+ ```ruby
19
+ gem "fluent-plugin-pg-query"
20
+ ```
21
+
22
+ And then execute:
23
+
24
+ ```
25
+ $ bundle
26
+ ```
27
+
28
+
29
+ ## plugin : pg_query
30
+
31
+ ### Behavior
32
+
33
+ ### Parameters
34
+
35
+ #### tag
36
+
37
+ *tag* to emit event on.
38
+
39
+ Default is *pg_query*.
40
+
41
+ #### interval
42
+
43
+ *interval* between execution of the queries.
44
+
45
+ Default is *300*.
46
+
47
+ #### host
48
+
49
+ pg *host* to connect to.
50
+
51
+ Default is *localhost*.
52
+
53
+ #### port
54
+
55
+ pg *port* to connect to.
56
+
57
+ Default is *5432*.
58
+
59
+ #### database
60
+
61
+ *database* is equivalent to pg *dbname*.
62
+
63
+ No default, is mandatory.
64
+
65
+ #### user
66
+
67
+ *user* is equivalent to pg *user*.
68
+
69
+ Default to nil / empty.
70
+
71
+ #### password
72
+
73
+ *password* is equivalent to pg *password*.
74
+
75
+ Default to nil / empty.
76
+
77
+ #### sslmode
78
+
79
+ *sslmode* is equivalent to pg sslmode.
80
+
81
+ Values are :
82
+ - disable (default): No SSL.
83
+ - allow: Tries SSL, falls back to non-SSL.
84
+ - prefer: Tries non-SSL first, then SSL.
85
+ - require: SSL required (does not verify certificate).
86
+ - verify-ca: Requires SSL and verifies the certificate authority.
87
+ - verify-full: Requires SSL and verifies both the CA and the server hostname.
88
+
89
+ #### connect_timeout
90
+
91
+ *connect_timeout" is equivalent to pg *connect_timeout*.
92
+
93
+ Default to 10.
94
+
95
+ #### try_count
96
+
97
+ *try_count* is attempt count to run each SQL query.
98
+
99
+ Default to 3.
100
+
101
+ #### try_delay
102
+
103
+ *try_delay* is the delay between each attempt for a given SQL query.
104
+
105
+ Default to 5.
106
+
107
+ #### ca_cert
108
+
109
+ *ca_cert* is equivalent to pg *sslrootcert*.
110
+
111
+ Default is nil.
112
+
113
+ #### query
114
+
115
+ Each query is structured with :
116
+ - sql
117
+ - tag
118
+
119
+ *sql* is for the query string to execute.
120
+
121
+ *tag* is a specific subtag that will be concatenated to common tag, to
122
+ generate the tag, that will used to emit records returned by the query.
123
+
124
+ ### Example
125
+
126
+ Configuration example:
127
+
128
+ ```
129
+ <source>
130
+ @type pg_query
131
+
132
+ database test
133
+ user test
134
+ password test
135
+
136
+ interval 5
137
+
138
+ <query>
139
+ sql select name, age from test
140
+ tag query1
141
+ </query>
142
+ </source>
143
+ ```
144
+
145
+ So records returned by the sql query `select name, age from test`,
146
+ will be emitted on tag `test.query1`.
147
+
148
+
149
+ ## Copyright
150
+
151
+ * Copyright(c) 2025- Thomas Tych
152
+ * License
153
+ * Apache License, Version 2.0
data/Rakefile ADDED
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler'
4
+ Bundler::GemHelper.install_tasks
5
+
6
+ require 'rake/testtask'
7
+
8
+ Rake::TestTask.new(:test) do |t|
9
+ t.libs.push('lib', 'test')
10
+ t.test_files = FileList['test/**/test_*.rb', 'test/**/*_test.rb',]
11
+ t.verbose = true
12
+ t.warning = true
13
+ end
14
+
15
+ require 'rubocop/rake_task'
16
+ RuboCop::RakeTask.new
17
+
18
+ require 'bump/tasks'
19
+
20
+ task default: %i[test rubocop]
@@ -0,0 +1,146 @@
1
+ # frozen_string_literal: true
2
+
3
+ #
4
+ # Copyright 2025- Thomas Tych
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+
18
+ require 'fluent/plugin/input'
19
+
20
+ require_relative 'pg_query/pg_client'
21
+
22
+ module Fluent
23
+ module Plugin
24
+ class PgQueryInput < Fluent::Plugin::Input
25
+ NAME = 'pg_query'
26
+
27
+ Fluent::Plugin.register_input(NAME, self)
28
+
29
+ helpers :event_emitter, :timer
30
+
31
+ DEFAULT_TAG = NAME
32
+
33
+ DEFAULT_INTERVAL = 300
34
+
35
+ DEFAULT_PG_HOST = 'localhost'
36
+ DEFAULT_PG_PORT = 5432
37
+ DEFAULT_PG_USER = nil
38
+ DEFAULT_PG_PASSWORD = nil
39
+ DEFAULT_PG_SSLMODE = :allow
40
+ DEFAULT_PG_CONNECT_TIMEOUT = 10
41
+ DEFAULT_PG_TRY_COUNT = 3
42
+ DEFAULT_PG_TRY_DELAY = 5
43
+
44
+ DEFAULT_CA_CERT = nil
45
+
46
+ DEFAULT_QUERY_TAG = nil
47
+
48
+ desc 'tag to emit events on'
49
+ config_param :tag, :string, default: DEFAULT_TAG
50
+
51
+ desc 'interval for probe execution'
52
+ config_param :interval, :time, default: DEFAULT_INTERVAL
53
+
54
+ desc 'postgresql host'
55
+ config_param :host, :string, default: DEFAULT_PG_HOST
56
+ desc 'postgresql port'
57
+ config_param :port, :integer, default: DEFAULT_PG_PORT
58
+ desc 'postgresql database'
59
+ config_param :database, :string
60
+ desc 'postgresql user'
61
+ config_param :user, :string, default: DEFAULT_PG_USER
62
+ desc 'postgresql password'
63
+ config_param :password, :string, default: DEFAULT_PG_PASSWORD
64
+ desc 'postgresql ssl mode'
65
+ config_param :sslmode, :enum, list: %i[disable allow prefer require verify-ca verify-full],
66
+ default: DEFAULT_PG_SSLMODE
67
+ desc 'postgresql connection timeout (in seconds)'
68
+ config_param :connect_timeout, :integer, default: DEFAULT_PG_CONNECT_TIMEOUT
69
+ desc 'postgresql try count, on error'
70
+ config_param :try_count, :integer, default: DEFAULT_PG_TRY_COUNT
71
+ desc 'postgresql try delay, between 2 tries, on error'
72
+ config_param :try_delay, :integer, default: DEFAULT_PG_TRY_DELAY
73
+
74
+ desc 'ca_cert'
75
+ config_param :ca_cert, :string, default: DEFAULT_CA_CERT
76
+
77
+ config_section :query, param_name: :queries, multi: true do
78
+ config_param :sql, :string
79
+ config_param :tag, :string, default: DEFAULT_QUERY_TAG
80
+ end
81
+
82
+ def configure(conf)
83
+ super
84
+
85
+ raise Fluent::ConfigError, 'tag should not be empty' if tag.empty?
86
+
87
+ configure_pg_connection
88
+ configure_pg_queries
89
+ end
90
+
91
+ def configure_pg_connection
92
+ raise Fluent::ConfigError, 'port should be >= 0 and <= 65535' if port.negative? || port > 65_535
93
+ raise Fluent::ConfigError, 'database should not empty' if database.empty?
94
+ raise Fluent::ConfigError, 'connect_timeout should be >= 0' if connect_timeout.negative?
95
+ raise Fluent::ConfigError, 'try_count should be >= 0' if try_count.negative?
96
+ raise Fluent::ConfigError, 'try_delay should be >= 0' if try_delay.negative?
97
+ end
98
+
99
+ def configure_pg_queries
100
+ raise Fluent::ConfigError, 'queries should not be empty' if queries.empty?
101
+ end
102
+
103
+ def start
104
+ super
105
+
106
+ timer_execute(:run_queries_first, 1, repeat: false, &method(:run_queries)) if interval > 60
107
+
108
+ timer_execute(:run_queries, interval, repeat: true, &method(:run_queries))
109
+ end
110
+
111
+ def shutdown
112
+ pg_client.close
113
+
114
+ super
115
+ end
116
+
117
+ def run_queries
118
+ queries.each do |query|
119
+ run_query(query)
120
+ rescue StandardError => e
121
+ log.error "while runnig query: #{query.sql}: #{e}"
122
+ end
123
+ pg_client.standby
124
+ end
125
+
126
+ def run_query(query)
127
+ query_time = Fluent::Engine.now
128
+ records = pg_client.query(query.sql)
129
+ emit_query_records(query_time: query_time, query_tag: query.tag, query_records: records)
130
+ end
131
+
132
+ def emit_query_records(query_records:, query_time: Fluent::Engine.now, query_tag: nil)
133
+ current_tag = [tag, query_tag].compact.join('.')
134
+ query_events = MultiEventStream.new
135
+ query_records.each do |record|
136
+ query_events.add(query_time, record)
137
+ end
138
+ router.emit_stream(current_tag, query_events)
139
+ end
140
+
141
+ def pg_client
142
+ @pg_client ||= Fluent::Plugin::PgQuery::PgClient.from_conf(self)
143
+ end
144
+ end
145
+ end
146
+ end
@@ -0,0 +1,89 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'pg'
4
+
5
+ module Fluent
6
+ module Plugin
7
+ module PgQuery
8
+ class PgClient
9
+ DEFAULT_TRY_COUNT = 3
10
+ DEFAULT_TRY_DELAY = 5
11
+
12
+ DEFAULT_HOST = 'localhost'
13
+ DEFAULT_PORT = 5432
14
+ DEFAULT_TIMEOUT = 10
15
+ DEFAULT_SSLMODE = :allow
16
+
17
+ attr_reader :try_count, :try_delay, :params, :logger
18
+
19
+ def initialize(try_count: DEFAULT_TRY_COUNT, try_delay: DEFAULT_TRY_DELAY, logger: nil, **params)
20
+ @try_count = try_count
21
+ @try_delay = try_delay
22
+ @logger = logger
23
+ @params = params
24
+ end
25
+
26
+ def query(query_str)
27
+ try_attempt ||= 0
28
+ result = pg.exec(query_str)
29
+ result.to_a
30
+ rescue PG::Error => e
31
+ try_attempt += 1
32
+ if try_count && try_attempt < try_count
33
+ logger&.warn("PG error on attempt #{try_attempt}/#{try_count}: #{e}")
34
+ close
35
+ sleep try_delay
36
+ retry
37
+ end
38
+ logger&.error("PG error after #{try_count} attempts: #{e}")
39
+ []
40
+ end
41
+
42
+ def standby
43
+ close
44
+ end
45
+
46
+ def pg
47
+ @pg ||= PG.connect(**pg_params)
48
+ end
49
+
50
+ def pg_params
51
+ default_pg_params.merge(params.compact)
52
+ end
53
+
54
+ def default_pg_params
55
+ {
56
+ host: DEFAULT_HOST,
57
+ port: DEFAULT_PORT,
58
+ connect_timeout: DEFAULT_TIMEOUT,
59
+ sslmode: DEFAULT_SSLMODE
60
+ }
61
+ end
62
+
63
+ def close
64
+ @pg&.close
65
+ ensure
66
+ @pg = nil
67
+ end
68
+
69
+ class << self
70
+ def from_conf(conf)
71
+ new(
72
+ host: conf.host,
73
+ port: conf.port,
74
+ dbname: conf.database,
75
+ connect_timeout: conf.connect_timeout,
76
+ user: conf.user,
77
+ password: conf.password,
78
+ sslmode: conf.sslmode,
79
+ sslrootcert: conf.ca_cert,
80
+ try_count: conf.try_count,
81
+ try_delay: conf.try_delay,
82
+ logger: conf.log
83
+ )
84
+ end
85
+ end
86
+ end
87
+ end
88
+ end
89
+ end
metadata ADDED
@@ -0,0 +1,264 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fluent-plugin-pg-query
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Thomas Tych
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 2025-03-09 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: bump
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: 0.10.0
19
+ type: :development
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: 0.10.0
26
+ - !ruby/object:Gem::Dependency
27
+ name: bundler
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '2.6'
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: 2.6.5
36
+ type: :development
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '2.6'
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 2.6.5
46
+ - !ruby/object:Gem::Dependency
47
+ name: byebug
48
+ requirement: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: '11.1'
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 11.1.3
56
+ type: :development
57
+ prerelease: false
58
+ version_requirements: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '11.1'
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: 11.1.3
66
+ - !ruby/object:Gem::Dependency
67
+ name: mocha
68
+ requirement: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - "~>"
71
+ - !ruby/object:Gem::Version
72
+ version: '2.7'
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 2.7.1
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '2.7'
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: 2.7.1
86
+ - !ruby/object:Gem::Dependency
87
+ name: rake
88
+ requirement: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - "~>"
91
+ - !ruby/object:Gem::Version
92
+ version: 13.2.1
93
+ type: :development
94
+ prerelease: false
95
+ version_requirements: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - "~>"
98
+ - !ruby/object:Gem::Version
99
+ version: 13.2.1
100
+ - !ruby/object:Gem::Dependency
101
+ name: reek
102
+ requirement: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - "~>"
105
+ - !ruby/object:Gem::Version
106
+ version: '6.4'
107
+ type: :development
108
+ prerelease: false
109
+ version_requirements: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - "~>"
112
+ - !ruby/object:Gem::Version
113
+ version: '6.4'
114
+ - !ruby/object:Gem::Dependency
115
+ name: rubocop
116
+ requirement: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - "~>"
119
+ - !ruby/object:Gem::Version
120
+ version: '1.73'
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: 1.73.1
124
+ type: :development
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - "~>"
129
+ - !ruby/object:Gem::Version
130
+ version: '1.73'
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: 1.73.1
134
+ - !ruby/object:Gem::Dependency
135
+ name: rubocop-rake
136
+ requirement: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - "~>"
139
+ - !ruby/object:Gem::Version
140
+ version: 0.7.1
141
+ type: :development
142
+ prerelease: false
143
+ version_requirements: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - "~>"
146
+ - !ruby/object:Gem::Version
147
+ version: 0.7.1
148
+ - !ruby/object:Gem::Dependency
149
+ name: simplecov
150
+ requirement: !ruby/object:Gem::Requirement
151
+ requirements:
152
+ - - "~>"
153
+ - !ruby/object:Gem::Version
154
+ version: 0.22.0
155
+ type: :development
156
+ prerelease: false
157
+ version_requirements: !ruby/object:Gem::Requirement
158
+ requirements:
159
+ - - "~>"
160
+ - !ruby/object:Gem::Version
161
+ version: 0.22.0
162
+ - !ruby/object:Gem::Dependency
163
+ name: test-unit
164
+ requirement: !ruby/object:Gem::Requirement
165
+ requirements:
166
+ - - "~>"
167
+ - !ruby/object:Gem::Version
168
+ version: '3.6'
169
+ - - ">="
170
+ - !ruby/object:Gem::Version
171
+ version: 3.6.7
172
+ type: :development
173
+ prerelease: false
174
+ version_requirements: !ruby/object:Gem::Requirement
175
+ requirements:
176
+ - - "~>"
177
+ - !ruby/object:Gem::Version
178
+ version: '3.6'
179
+ - - ">="
180
+ - !ruby/object:Gem::Version
181
+ version: 3.6.7
182
+ - !ruby/object:Gem::Dependency
183
+ name: timecop
184
+ requirement: !ruby/object:Gem::Requirement
185
+ requirements:
186
+ - - "~>"
187
+ - !ruby/object:Gem::Version
188
+ version: 0.9.10
189
+ type: :development
190
+ prerelease: false
191
+ version_requirements: !ruby/object:Gem::Requirement
192
+ requirements:
193
+ - - "~>"
194
+ - !ruby/object:Gem::Version
195
+ version: 0.9.10
196
+ - !ruby/object:Gem::Dependency
197
+ name: fluentd
198
+ requirement: !ruby/object:Gem::Requirement
199
+ requirements:
200
+ - - ">="
201
+ - !ruby/object:Gem::Version
202
+ version: 0.14.10
203
+ - - "<"
204
+ - !ruby/object:Gem::Version
205
+ version: '2'
206
+ type: :runtime
207
+ prerelease: false
208
+ version_requirements: !ruby/object:Gem::Requirement
209
+ requirements:
210
+ - - ">="
211
+ - !ruby/object:Gem::Version
212
+ version: 0.14.10
213
+ - - "<"
214
+ - !ruby/object:Gem::Version
215
+ version: '2'
216
+ - !ruby/object:Gem::Dependency
217
+ name: pg
218
+ requirement: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - ">="
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
223
+ type: :runtime
224
+ prerelease: false
225
+ version_requirements: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - ">="
228
+ - !ruby/object:Gem::Version
229
+ version: '0'
230
+ email:
231
+ - thomas.tych@gmail.com
232
+ executables: []
233
+ extensions: []
234
+ extra_rdoc_files: []
235
+ files:
236
+ - ".rubocop.yml"
237
+ - LICENSE
238
+ - README.md
239
+ - Rakefile
240
+ - lib/fluent/plugin/in_pg_query.rb
241
+ - lib/fluent/plugin/pg_query/pg_client.rb
242
+ homepage: https://gitlab.com/ttych/fluent-plugin-pg-query
243
+ licenses:
244
+ - Apache-2.0
245
+ metadata:
246
+ rubygems_mfa_required: 'true'
247
+ rdoc_options: []
248
+ require_paths:
249
+ - lib
250
+ required_ruby_version: !ruby/object:Gem::Requirement
251
+ requirements:
252
+ - - ">="
253
+ - !ruby/object:Gem::Version
254
+ version: 2.7.0
255
+ required_rubygems_version: !ruby/object:Gem::Requirement
256
+ requirements:
257
+ - - ">="
258
+ - !ruby/object:Gem::Version
259
+ version: '0'
260
+ requirements: []
261
+ rubygems_version: 3.6.5
262
+ specification_version: 4
263
+ summary: fluentd plugin to query postgresql
264
+ test_files: []