fluent-plugin-postgresql-csvlog 0.8.0 → 0.8.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: 47a1cb4850459062da5931ab99d4180d53caed98985096be75a485a688e386c1
4
- data.tar.gz: 3d529ac068bed5cebed3e8ac49bcfb2f6f1e9d2d4ea9427582d1bdfc26ae22d3
3
+ metadata.gz: d9f81f14bc67d4554142164c18775964dacf12feaa57ddc5d6a64b67944a9357
4
+ data.tar.gz: deb17cb65f08f9d94fc53720d47cafe67022ae6999c6765023bf6d87e39d0463
5
5
  SHA512:
6
- metadata.gz: 927aba45b777040f1c5cb8b1e2044b0c2b8aca3b8590f1a7499285b835adfd15f276ef3ca3740193da61925beb22e0374314c87c482983007d2dd6cec5910ae0
7
- data.tar.gz: 6e75b2674e449122ad5c991a7a39429c0f0bfeff0de37d7b059673f964baccbf8ba2249680d529332b3a40f2e369627d1813de378f9774fc07370cd884748749
6
+ metadata.gz: 287762c56603630b1603ba523859e4114d3f25a2d9c39db6661201f0703f44eb4f361b78acb93b6897119c4e7e511725925f6567a3b938d9735d853a42467112
7
+ data.tar.gz: 8676d896c51ae02b943435b4fa0c607e340cc2572fae04f28d989aaa77eec5ec2558b2fc1f4f3bff6c0b97850c689f966a331a2ff5c459c2402a5b9b562b4bf1
data/.gitlab-ci.yml CHANGED
@@ -1,16 +1,32 @@
1
- image: "ruby:2.7"
1
+ image: "ruby:${RUBY_VERSION}"
2
+
3
+ variables:
4
+ RUBY_VERSION: "3.2"
5
+
6
+ stages:
7
+ - test
8
+ - deploy
9
+
10
+ include:
11
+ - component: gitlab.com/gitlab-org/components/gem-release/gem-release@~latest
12
+ inputs:
13
+ smoke_test_script: "ruby -r 'fluent/plugin/filter_postgresql_slowlog'"
14
+ file_pattern_to_trigger_release: "fluent-plugin-postgresql-csvlog.gemspec"
2
15
 
3
16
  test:
17
+ stage: test
4
18
  before_script:
5
19
  - bundle config set path vendor
6
20
  - bundle install --jobs $(nproc)
7
21
  script:
8
22
  - bundle exec rake test
9
23
  cache:
24
+ key: ruby-${RUBY_VERSION}
10
25
  paths:
11
26
  - vendor/ruby
12
27
 
13
28
  .iteration_test:
29
+ stage: test
14
30
  services:
15
31
  - name: postgres:$POSTGRES_SERVER_VERSION
16
32
  alias: postgres
@@ -27,25 +43,15 @@ test:
27
43
  paths:
28
44
  - vendor/ruby
29
45
 
30
- # integration tests for postgres 12
31
- itest_pg12:
32
- extends: .iteration_test
33
- variables:
34
- POSTGRES_SERVER_VERSION: 12
35
-
36
- # integration tests for postgres 13
37
- itest_pg13:
46
+ # integration tests for PostgreSQL
47
+ itest:
38
48
  extends: .iteration_test
39
- variables:
40
- POSTGRES_SERVER_VERSION: 13
41
-
42
- # integration tests for postgres 14
43
- itest_pg14:
44
- extends: .iteration_test
45
- variables:
46
- POSTGRES_SERVER_VERSION: 14
49
+ parallel:
50
+ matrix:
51
+ - POSTGRES_SERVER_VERSION: ["12", "13", "14", "15", "16"]
47
52
 
48
53
  end_to_end_verification_test:
54
+ stage: test
49
55
  image: docker:20.10.16
50
56
  services:
51
57
  - docker:20.10.16-dind
@@ -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.8.0'
5
+ s.version = '0.8.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'
@@ -6,8 +6,8 @@ module Fluent::Plugin
6
6
  # MarginaliaExtractor provides the parse_marginalia_into_record
7
7
  # utility method, useful for extracting marginalia into fluentd records
8
8
  module MarginaliaExtractor
9
- MARGINALIA_PREPENDED_REGEXP = %r{^(?<comment>/\*.*\*/)(?<sql>.*)}m.freeze
10
- MARGINALIA_APPENDED_REGEXP = %r{(?<sql>.*)(?<comment>/\*.*\*/)\s*;?\s*$}m.freeze
9
+ MARGINALIA_PREPENDED_REGEXP = %r{^(?<comment>/\*.*?\*/)\s*(?<sql>.*)}m
10
+ MARGINALIA_APPENDED_REGEXP = %r{(?<sql>.*)(?<comment>/\*.*\*/)\s*;?\s*$}m
11
11
 
12
12
  # Injects marginalia into a fluentd record
13
13
  def parse_marginalia_into_record(record, key, strip_comment)
@@ -48,6 +48,19 @@ class Marginalia < Test::Unit::TestCase
48
48
  test_parse(sql, {}, 'sql', true, expected)
49
49
  end
50
50
 
51
+ test 'marginalia appended with other comments in SQL' do
52
+ sql = %(INSERT INTO "p_ci_builds_metadata" ("project_id", "config_options", "config_variables", "has_exposed_artifacts", "build_id", "partition_id") VALUES (40163635, '{"image":{"name":"$AWS_AMAZONLINUX_IMAGE"},"artifacts":{"paths":["${ASSET_NAME}/out"]},"before_script":["yum install -y python3 python3-pip zip findutils","cd ${ASSET_NAME}"],"script":["mkdir -p venv","cd venv","python3 -m venv pyspark_venvsource","source pyspark_venvsource/bin/activate","pip3 install -r ../scripts/requirements.txt","pip3 install venv-pack","venv-pack -f -o pyspark_venv.tar.gz","cd ..; mkdir -p out/lib","cd src/step/; cp -r --parents ./*/*main*.py ../../out"],"retry":{"max":2}}', '[{"key":"ASSET_NAME","value":"data-pipeline"}]', FALSE, 6269937106, 101) RETURNING "id" /*application:sidekiq,correlation_id:01HQNQAHYZF4Q294P59R7RP71H,jid:047ecd6920dc27ccd49b0aef,endpoint_id:PostReceive,db_config_name:ci*/)
53
+ expected = {
54
+ 'application' => 'sidekiq',
55
+ 'correlation_id' => '01HQNQAHYZF4Q294P59R7RP71H',
56
+ 'jid' => '047ecd6920dc27ccd49b0aef',
57
+ 'db_config_name' => 'ci',
58
+ 'endpoint_id' => 'PostReceive',
59
+ 'sql' => %(INSERT INTO "p_ci_builds_metadata" ("project_id", "config_options", "config_variables", "has_exposed_artifacts", "build_id", "partition_id") VALUES (40163635, '{"image":{"name":"$AWS_AMAZONLINUX_IMAGE"},"artifacts":{"paths":["${ASSET_NAME}/out"]},"before_script":["yum install -y python3 python3-pip zip findutils","cd ${ASSET_NAME}"],"script":["mkdir -p venv","cd venv","python3 -m venv pyspark_venvsource","source pyspark_venvsource/bin/activate","pip3 install -r ../scripts/requirements.txt","pip3 install venv-pack","venv-pack -f -o pyspark_venv.tar.gz","cd ..; mkdir -p out/lib","cd src/step/; cp -r --parents ./*/*main*.py ../../out"],"retry":{"max":2}}', '[{"key":"ASSET_NAME","value":"data-pipeline"}]', FALSE, 6269937106, 101) RETURNING "id")
60
+ }
61
+ test_parse(sql, {}, 'sql', true, expected)
62
+ end
63
+
51
64
  test 'normal comment prepended' do
52
65
  sql = '/* this is just a comment */ SELECT COUNT(*) FROM "projects"'
53
66
  expected = {
@@ -87,6 +100,19 @@ class Marginalia < Test::Unit::TestCase
87
100
  test_parse(sql, {}, 'sql', true, expected)
88
101
  end
89
102
 
103
+ test 'marginalia prepended with other comments in SQL' do
104
+ sql = %(/*application:sidekiq,correlation_id:01HQNQAHYZF4Q294P59R7RP71H,jid:047ecd6920dc27ccd49b0aef,endpoint_id:PostReceive,db_config_name:ci*/ INSERT INTO "p_ci_builds_metadata" ("project_id", "config_options", "config_variables", "has_exposed_artifacts", "build_id", "partition_id") VALUES (40163635, '{"image":{"name":"$AWS_AMAZONLINUX_IMAGE"},"artifacts":{"paths":["${ASSET_NAME}/out"]},"before_script":["yum install -y python3 python3-pip zip findutils","cd ${ASSET_NAME}"],"script":["mkdir -p venv","cd venv","python3 -m venv pyspark_venvsource","source pyspark_venvsource/bin/activate","pip3 install -r ../scripts/requirements.txt","pip3 install venv-pack","venv-pack -f -o pyspark_venv.tar.gz","cd ..; mkdir -p out/lib","cd src/step/; cp -r --parents ./*/*main*.py ../../out"],"retry":{"max":2}}', '[{"key":"ASSET_NAME","value":"data-pipeline"}]', FALSE, 6269937106, 101) RETURNING "id")
105
+ expected = {
106
+ 'application' => 'sidekiq',
107
+ 'correlation_id' => '01HQNQAHYZF4Q294P59R7RP71H',
108
+ 'jid' => '047ecd6920dc27ccd49b0aef',
109
+ 'db_config_name' => 'ci',
110
+ 'endpoint_id' => 'PostReceive',
111
+ 'sql' => %(INSERT INTO "p_ci_builds_metadata" ("project_id", "config_options", "config_variables", "has_exposed_artifacts", "build_id", "partition_id") VALUES (40163635, '{"image":{"name":"$AWS_AMAZONLINUX_IMAGE"},"artifacts":{"paths":["${ASSET_NAME}/out"]},"before_script":["yum install -y python3 python3-pip zip findutils","cd ${ASSET_NAME}"],"script":["mkdir -p venv","cd venv","python3 -m venv pyspark_venvsource","source pyspark_venvsource/bin/activate","pip3 install -r ../scripts/requirements.txt","pip3 install venv-pack","venv-pack -f -o pyspark_venv.tar.gz","cd ..; mkdir -p out/lib","cd src/step/; cp -r --parents ./*/*main*.py ../../out"],"retry":{"max":2}}', '[{"key":"ASSET_NAME","value":"data-pipeline"}]', FALSE, 6269937106, 101) RETURNING "id")
112
+ }
113
+ test_parse(sql, {}, 'sql', true, expected)
114
+ end
115
+
90
116
  test 'marginalia prepended for web, comment_strip disabled' do
91
117
  sql = 'SELECT COUNT(*) FROM "projects" /*application:sidekiq,correlation_id:d67cae54c169e0cab7d73389e2934f0e,jid:52a1c8a9e4c555ea573f20f0,job_class:Geo::MetricsUpdateWorker*/'
92
118
  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.8.0
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - stanhu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-27 00:00:00.000000000 Z
11
+ date: 2024-02-27 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.4.19
143
+ rubygems_version: 3.5.6
144
144
  signing_key:
145
145
  specification_version: 4
146
146
  summary: fluentd plugins to work with PostgreSQL CSV logs