fluent-plugin-amplitude 0.0.6 → 0.0.7
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 +4 -4
- data/fluent-plugin-amplitude.gemspec +1 -1
- data/lib/fluent/plugin/out_amplitude.rb +10 -10
- 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: 269720e5fb9a25129b61a720c5730c4fe0ebd6b1
|
4
|
+
data.tar.gz: 37b6a8bbba072c7ec877097cc2975ace8bfaf281
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98be3d4367705664da866e9c964a39bed8d1e19849839c10c006b6652987c4ec93a19212149bac2f6f6161d8a8766c5852cb9c3ff2110cd0bbcf1b843e42ff21
|
7
|
+
data.tar.gz: 89e3919f449e4256e99528b6b8a032ea0e0f252a4bffe91d05e67fe3e5df3afe22c85ec9e3a8cd42c19238022c8dae7f5ccc983a6fb3dd95656c6e3d54d02ae0
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'fluent-plugin-amplitude'
|
7
|
-
spec.version = '0.0.
|
7
|
+
spec.version = '0.0.7'
|
8
8
|
spec.authors = ['Vijay Ramesh']
|
9
9
|
spec.email = ['vijay@change.org']
|
10
10
|
spec.summary = 'Fluentd plugin to output event data to Amplitude'
|
@@ -38,13 +38,10 @@ module Fluent
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def format(tag, time, record)
|
41
|
-
return if @events_whitelist && !@events_whitelist.include?(tag)
|
42
|
-
return if @events_blacklist && @events_blacklist.include?(tag)
|
43
|
-
|
44
41
|
amplitude_hash = { event_type: tag }
|
45
42
|
|
46
43
|
filter_properties_blacklist!(record)
|
47
|
-
|
44
|
+
extract_user_and_device!(amplitude_hash, record)
|
48
45
|
extract_user_properties!(amplitude_hash, record)
|
49
46
|
extract_event_properties!(amplitude_hash, record)
|
50
47
|
|
@@ -53,11 +50,16 @@ module Fluent
|
|
53
50
|
|
54
51
|
def write(chunk)
|
55
52
|
records = []
|
56
|
-
chunk.msgpack_each do |
|
57
|
-
|
53
|
+
chunk.msgpack_each do |tag, _time, record|
|
54
|
+
next if @events_whitelist && !@events_whitelist.include?(tag)
|
55
|
+
next if @events_blacklist && @events_blacklist.include?(tag)
|
56
|
+
record = simple_symbolize_keys(record)
|
57
|
+
verify_user_and_device_or_fail(record)
|
58
|
+
|
59
|
+
records << AmplitudeAPI::Event.new(record)
|
58
60
|
end
|
59
61
|
|
60
|
-
send_to_amplitude(records)
|
62
|
+
send_to_amplitude(records) unless records.empty?
|
61
63
|
end
|
62
64
|
|
63
65
|
private
|
@@ -67,7 +69,7 @@ module Fluent
|
|
67
69
|
record.reject! { |k, _| @properties_blacklist.include?(k) }
|
68
70
|
end
|
69
71
|
|
70
|
-
def
|
72
|
+
def extract_user_and_device!(amplitude_hash, record)
|
71
73
|
if @user_id_key
|
72
74
|
@user_id_key.each do |user_id_key|
|
73
75
|
if record[user_id_key]
|
@@ -84,8 +86,6 @@ module Fluent
|
|
84
86
|
end
|
85
87
|
end
|
86
88
|
end
|
87
|
-
|
88
|
-
verify_user_and_device_or_fail(amplitude_hash)
|
89
89
|
end
|
90
90
|
|
91
91
|
def verify_user_and_device_or_fail(amplitude_hash)
|