logstash-output-charrington 0.3.6 → 0.3.7

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: 67301110645343eb9a0187da8a7c914cdba6ebe03241cea40ec757cc0972d61d
4
- data.tar.gz: 753facf12027fd4a0c2d6a446835d060911aae52e74100b334ba6a277c37385c
3
+ metadata.gz: 18ae186abb98be6db8aca5f0713593a0597737f516608c97ea05fca4b58537a4
4
+ data.tar.gz: 9cecf3cf3ed56956fe8907032a6a2322a6c46495a8fe1fc074ac066d15b00d01
5
5
  SHA512:
6
- metadata.gz: '0178367f4b8c91dff6da258005228ea8d473c7c6e550bcb03b6dd4e36a03f123a8ae83e96a7f91e8099c619f0fd7b3916388ba24741336881d2b3ff0c0c98733'
7
- data.tar.gz: 16467a4fa971bc585e24cab322555239ba687daf77ece2839ad2e5d35ecf9af19463726261c7e4d31752a5771aee5881870fac3d61dbe887c8b0c6457caf6d95
6
+ metadata.gz: f661d570cf5b4d04c170253354387da2b157f132a8b8dba60a5be5b5bdb7b087f959eb0234ce28c4dae91b984ea53e0ccbeafcbd5eb97a6dbf9d40474f236acf
7
+ data.tar.gz: fac3bc74393a48e88df615afe5c3451fb0d2d073c5a400ceae06ce3ca441da202324f8f964b24f6b665a627464cbece2da0b9d95badcbb78e74498384120f826
@@ -71,10 +71,10 @@ module Charrington
71
71
  sql = "SELECT * FROM #{schema}#{table_name} LIMIT 1;"
72
72
  stmt, rs = executeQuery(prep_sql(sql))
73
73
  meta_data = rs.getMetaData()
74
- stmt.close unless stmt.nil?
75
74
  column_count = meta_data.getColumnCount()
76
75
  (1..column_count).map {|i| meta_data.getColumnName(i) }
77
76
  ensure
77
+ self.logger.info "Within ensure block of current_table_columns in alter_redshift_table.rb and value of stmt.nil?: #{stmt.nil?}"
78
78
  stmt.close unless stmt.nil?
79
79
  end
80
80
 
@@ -97,6 +97,7 @@ module Charrington
97
97
  puts "Alter Redshift Unknown exception: #{e.message}, with SQL: #{sql}"
98
98
  self.logger.info "Alter Redshift Unknown exception: #{e.message}"
99
99
  ensure
100
+ self.logger.info "Within ensure block of execute in alter_redshift_table.rb and value of stmt.nil?: #{stmt.nil?}"
100
101
  stmt.close unless stmt.nil?
101
102
  end
102
103
 
@@ -24,6 +24,7 @@ module Charrington
24
24
 
25
25
  def call
26
26
  set_column_types
27
+ self.logger.info "Finished running set_column_types and now have column_types for create table of: #{column_types}"
27
28
  create_table
28
29
  true
29
30
  rescue => e
@@ -75,12 +76,15 @@ module Charrington
75
76
  end
76
77
 
77
78
  def execute(sql)
79
+ self.logger.info "Running sql of: #{sql}"
80
+
78
81
  statement = connection.prepareStatement( sql.gsub(/\s+/, " ").strip )
79
82
  statement.execute()
80
83
  rescue Java::JavaSql::SQLException => e
81
84
  puts "Redshift SQLException: #{e.message}"
82
85
  self.logger.info "Redshift SQLException: #{e.message}, with SQL: #{sql}"
83
86
  ensure
87
+ self.logger.info "Within ensure block of create_redshift_table.rb and value of statement.nil?: #{statement.nil?}"
84
88
  statement.close unless statement.nil?
85
89
  end
86
90
  end
@@ -39,17 +39,22 @@ module Charrington
39
39
  end
40
40
 
41
41
  def call
42
+ self.logger.info "Attempting insert into table name: #{table_name}"
42
43
  insert_stmt = insert_statement
44
+ self.logger.info "Insert statement passed into prepareStatement is: #{insert_stmt}"
43
45
 
44
46
  stmt = connection.prepareStatement(insert_stmt)
45
47
  stmt = add_statement_event_params(stmt)
48
+ self.logger.info "Insert statement to be run is: #{insert_stmt}"
46
49
  stmt.execute
47
50
  should_retry
48
51
  rescue Java::JavaSql::SQLException => e
49
52
  case e.getSQLState()
50
53
  when "42P01"
54
+ self.logger.info "Received Java::JavaSql::SQLException with error sql state of 42P01, moving to create table"
51
55
  should_retry = create_table
52
56
  when "42703"
57
+ self.logger.info "Received Java::JavaSql::SQLException with error sql state of 42703, moving to alter table"
53
58
  should_retry = alter_table
54
59
  else
55
60
  raise InsertFailed, "Charrington: Rescue from SQLException #{e.message}"
@@ -6,6 +6,7 @@ module Charrington
6
6
  # It handles retries where applicable.
7
7
 
8
8
  include Service
9
+ include LogStash::Util::Loggable
9
10
  attr_reader :event, :connection, :opts, :max_retries, :schema, :retry_max_interval, :driver
10
11
  attr_accessor :retry_interval, :should_retry
11
12
 
@@ -32,10 +33,13 @@ module Charrington
32
33
  while should_retry do
33
34
  transformed = case driver
34
35
  when "redshift"
36
+ self.logger.info "Found driver for redshift with event of: #{event}"
35
37
  Charrington::TransformRedshift.call(event)
36
38
  else
39
+ self.logger.info "Found driver for postgres with event of: #{event}"
37
40
  Charrington::TransformPostgres.call(event)
38
41
  end
42
+ self.logger.info "Transformed event into: #{transformed}"
39
43
  should_retry = Charrington::Insert.call(connection, transformed, opts)
40
44
  break if !should_retry
41
45
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-output-charrington'
3
- s.version = '0.3.6'
3
+ s.version = '0.3.7'
4
4
 
5
5
  s.licenses = ['Apache-2.0']
6
6
  s.homepage = 'https://gitlab.podium.com/engineering/analytics/logstash-output-charrington'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-charrington
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - dconger
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2019-07-27 00:00:00.000000000 Z
13
+ date: 2019-07-29 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  requirement: !ruby/object:Gem::Requirement