logstash-output-charrington 0.3.19 → 0.3.20
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ae644e2b642cfbf37d315289ff166d7b03e19865dd50320126e71f50954965c
|
4
|
+
data.tar.gz: 5af164f7c8a73ed16001ef89922095bb0d37699fbc7c144c06eff4ab23e0481a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f6583538a0632625e50bb48e6b48864455c2edb0987d434bda4f31edd0479b4805e72974feb0213496f6db77bb6e133661e09d448ac4423cd69bce5ddf07c9e
|
7
|
+
data.tar.gz: 7f3cf086ba6be74f724beed922eaf3fc8d8dc8dcabf24a599cce0ac5acbc1cc8ae927d0d10f0da8e287c00145cdbaa770141d7608e79966dcfb521bdde91c76e
|
@@ -176,11 +176,15 @@ module Charrington
|
|
176
176
|
values << value
|
177
177
|
|
178
178
|
if @@timestamp_columns.include?(key)
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
179
|
+
begin
|
180
|
+
time = parse_date(value)
|
181
|
+
stmt.setTimestamp(pos, time)
|
182
|
+
next
|
183
|
+
rescue java.text.ParseException => e
|
184
|
+
time = parse_date(value, "yyyy-MM-dd'T'HH:mm:ss'Z'")
|
185
|
+
stmt.setTimestamp(pos, time)
|
186
|
+
next
|
187
|
+
end
|
184
188
|
end
|
185
189
|
|
186
190
|
case value
|
@@ -212,6 +216,11 @@ module Charrington
|
|
212
216
|
end
|
213
217
|
|
214
218
|
### Helpers
|
219
|
+
def parse_date(date, fmt = "yyyy-MM-dd'T'HH:mm:ss.S'Z'")
|
220
|
+
format = java.text.SimpleDateFormat.new(fmt)
|
221
|
+
parsed = format.parse(date)
|
222
|
+
java.sql.Timestamp.new(parsed.getTime)
|
223
|
+
end
|
215
224
|
|
216
225
|
def arr_to_csv(arr)
|
217
226
|
'(' + arr.join(', ') + ')'
|
@@ -19,10 +19,14 @@ RSpec.shared_context 'pipeline' do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
RSpec.shared_context 'postgres' do
|
22
|
-
def start_database(host='localhost', port=57354, database='winston', user='testuser', password='password')
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
def start_database(embedded = true, host='localhost', port=57354, database='winston', user='testuser', password='password')
|
23
|
+
if embedded
|
24
|
+
config = Java::RuYandexQatoolsEmbedPostgresql::EmbeddedPostgres::cachedRuntimeConfig(Paths::get('/tmp/charrington-test-db-cache')) # avoid archive extraction every time
|
25
|
+
db = Java::RuYandexQatoolsEmbedPostgresql::EmbeddedPostgres.new
|
26
|
+
@url = db.start(config, host, port, database, user, password, ArrayList.new(["-E", "SQL_ASCII", "--locale=C", "--lc-collate=C", "--lc-ctype=C"]))
|
27
|
+
else
|
28
|
+
@url = "jdbc:postgresql://#{host}/#{database}?user=#{user}&password=#{password}";
|
29
|
+
end
|
26
30
|
|
27
31
|
# setup connection manager
|
28
32
|
@connection_manager = Java::ComZaxxerHikari::HikariDataSource.new
|
@@ -33,7 +37,11 @@ RSpec.shared_context 'postgres' do
|
|
33
37
|
end
|
34
38
|
|
35
39
|
before(:all) do
|
36
|
-
|
40
|
+
if ENV.fetch("TEST_ENV", "").to_s.casecmp?("ci")
|
41
|
+
start_database(false, 'postgres', 5432, 'postgres', 'postgres', '')
|
42
|
+
else
|
43
|
+
start_database
|
44
|
+
end
|
37
45
|
end
|
38
46
|
|
39
47
|
let(:driver_path) {
|
@@ -248,7 +248,7 @@ describe LogStash::Outputs::Charrington do
|
|
248
248
|
])
|
249
249
|
expect(query('SELECT COUNT(1) FROM schemaless').first[:count]).to eq("1")
|
250
250
|
expect(query("SELECT * FROM tracks")).to match_array([
|
251
|
-
{:id=>a_kind_of(String), :anonymous_id=>"", :app_name=>"Web App", :context_campaign_content=>nil, :context_campaign_medium=>nil, :context_campaign_name=>nil, :context_campaign_source=>nil, :context_ip=>nil, :context_library_name=>nil, :context_library_version=>nil, :context_page_path=>nil, :context_page_referrer=>nil, :context_page_search=>nil, :context_page_title=>nil, :context_page_url=>nil, :context_user_agent=>nil, :event=>"schemaless", :event_text=>"schemaless", :original_timestamp=>
|
251
|
+
{:id=>a_kind_of(String), :anonymous_id=>"", :app_name=>"Web App", :context_campaign_content=>nil, :context_campaign_medium=>nil, :context_campaign_name=>nil, :context_campaign_source=>nil, :context_ip=>nil, :context_library_name=>nil, :context_library_version=>nil, :context_page_path=>nil, :context_page_referrer=>nil, :context_page_search=>nil, :context_page_title=>nil, :context_page_url=>nil, :context_user_agent=>nil, :event=>"schemaless", :event_text=>"schemaless", :original_timestamp=>"2019-07-29 20:09:18", :received_at=>"2019-07-29 20:09:18", :segment_dedupe_id=>nil, :sent_at=>"2019-07-29 20:09:18", :timestamp=>"2019-07-29 20:09:18", :user_id=>"123", :user_uid=>"456", :uuid=>nil, :uuid_ts=>a_kind_of(String)}
|
252
252
|
])
|
253
253
|
end
|
254
254
|
end
|
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.
|
4
|
+
version: 0.3.20
|
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-08-
|
13
|
+
date: 2019-08-29 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|