fluent-plugin-snowplow 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fluent/plugin/snowplow/version.rb +1 -1
- data/lib/fluent/plugin/snowplow.rb +1 -56
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff0db0fa4ef9c6a8421448aca46c32963cff1d26
|
4
|
+
data.tar.gz: 06c318670a4c1773e7a19929924b34d6ec6e830e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f91a7d2ad2c4d8908307bddb4ee1d0b74da11946df9134f5e66ec5b2ad1175427768b02a1cae8d4be900d4a0edf68ed25ee425453749286025101987a7da692
|
7
|
+
data.tar.gz: b8c9fb3529778b3d5560a2f0bcbb86e6a9e104a2745296e29498fe532c9f56601e3d6df51ae8704e9f59b0e028a2430201d7ed25123984a801c1e3d3f6b08852
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'fluent/plugin/snowplow/version'
|
2
|
-
require '
|
2
|
+
require 'fluent/plugin/out_snowplow'
|
3
3
|
|
4
4
|
module Fluent
|
5
5
|
module Plugin
|
@@ -7,58 +7,3 @@ module Fluent
|
|
7
7
|
end
|
8
8
|
end
|
9
9
|
end
|
10
|
-
|
11
|
-
class Fluent::SomeOutput < Fluent::TimeSlicedOutput
|
12
|
-
Fluent::Plugin.register_output('snowplow', self)
|
13
|
-
|
14
|
-
config_param :host, :string
|
15
|
-
config_param :buffer_size, :integer
|
16
|
-
config_param :protocol, :string
|
17
|
-
config_param :method, :string
|
18
|
-
|
19
|
-
def configure(conf)
|
20
|
-
super
|
21
|
-
end
|
22
|
-
|
23
|
-
def start
|
24
|
-
super
|
25
|
-
|
26
|
-
@emitter = SnowplowTracker::Emitter.new(@host, {
|
27
|
-
buffer_size: @buffer_size,
|
28
|
-
protocol: @protocol,
|
29
|
-
method: @method
|
30
|
-
})
|
31
|
-
|
32
|
-
@trackers = {}
|
33
|
-
end
|
34
|
-
|
35
|
-
def stop
|
36
|
-
@tracker.flush
|
37
|
-
end
|
38
|
-
|
39
|
-
def format(tag, time, record)
|
40
|
-
[tag, time, record].to_msgpack
|
41
|
-
end
|
42
|
-
|
43
|
-
def tracker_for(application)
|
44
|
-
@trackers[application] ||= SnowplowTracker::Tracker.new(@emitter, nil, nil, application)
|
45
|
-
@trackers[application]
|
46
|
-
end
|
47
|
-
|
48
|
-
def write(chunk)
|
49
|
-
application, tracker = nil, nil
|
50
|
-
|
51
|
-
chunk.msgpack_each do |_, _, record|
|
52
|
-
schema = record['schema']
|
53
|
-
message = JSON.parse record['message']
|
54
|
-
true_timestamp = record['true_timestamp']
|
55
|
-
application = record['application']
|
56
|
-
tracker = tracker_for(application)
|
57
|
-
|
58
|
-
self_describing_json = SnowplowTracker::SelfDescribingJson.new(schema, message)
|
59
|
-
tracker.track_self_describing_event(self_describing_json, nil, SnowplowTracker::TrueTimestamp.new(true_timestamp.to_i))
|
60
|
-
end
|
61
|
-
|
62
|
-
tracker.flush
|
63
|
-
end
|
64
|
-
end
|