fluent-plugin-amplitude 0.0.7 → 0.0.8
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 +7 -6
- data/spec/out_amplitude_spec.rb +6 -8
- 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: 87356ba6323e223e3ce8b3b34424a1f942d2ee58
|
4
|
+
data.tar.gz: 5f4552341e234469911d09c064d692d6851da300
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7afeee3c37fe492271e6db7d04caff6d59277c30f65fac72f24b2427b2085390578e59d80a15f0c0e15f1d5cf5f4f49194e6a43a99aaf4ac05d2198bb443d931
|
7
|
+
data.tar.gz: 056333c1581a72a259ff89e42c9bc9c3ec77d2e7e227bebef478eafd2a6ecc388d47b5d60beed25a876c97c3bd769d92d425f22c52b0a2cd6dba0f46a56b0fd2
|
@@ -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.8'
|
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'
|
@@ -54,9 +54,11 @@ module Fluent
|
|
54
54
|
next if @events_whitelist && !@events_whitelist.include?(tag)
|
55
55
|
next if @events_blacklist && @events_blacklist.include?(tag)
|
56
56
|
record = simple_symbolize_keys(record)
|
57
|
-
|
58
|
-
|
59
|
-
|
57
|
+
if verify_user_and_device(record)
|
58
|
+
records << AmplitudeAPI::Event.new(record)
|
59
|
+
else
|
60
|
+
log.info("Error: either user_id or device_id must be set for tag #{tag}")
|
61
|
+
end
|
60
62
|
end
|
61
63
|
|
62
64
|
send_to_amplitude(records) unless records.empty?
|
@@ -88,11 +90,10 @@ module Fluent
|
|
88
90
|
end
|
89
91
|
end
|
90
92
|
|
91
|
-
def
|
93
|
+
def verify_user_and_device(amplitude_hash)
|
92
94
|
user_id = amplitude_hash[:user_id]
|
93
95
|
device_id = amplitude_hash[:device_id]
|
94
|
-
return
|
95
|
-
raise AmplitudeError, 'Error: either user_id or device_id must be set'
|
96
|
+
return present?(user_id) || present?(device_id)
|
96
97
|
end
|
97
98
|
|
98
99
|
def extract_user_properties!(amplitude_hash, record)
|
data/spec/out_amplitude_spec.rb
CHANGED
@@ -137,10 +137,9 @@ describe Fluent::AmplitudeOutput do
|
|
137
137
|
'recruiter_id' => 710
|
138
138
|
}
|
139
139
|
end
|
140
|
-
it '
|
141
|
-
expect
|
142
|
-
|
143
|
-
)
|
140
|
+
it 'does not track the event' do
|
141
|
+
expect(AmplitudeAPI).to_not receive(:track)
|
142
|
+
amplitude.run
|
144
143
|
end
|
145
144
|
end
|
146
145
|
|
@@ -156,10 +155,9 @@ describe Fluent::AmplitudeOutput do
|
|
156
155
|
'recruiter_id' => 710
|
157
156
|
}
|
158
157
|
end
|
159
|
-
it '
|
160
|
-
expect
|
161
|
-
|
162
|
-
)
|
158
|
+
it 'does not track the event' do
|
159
|
+
expect(AmplitudeAPI).to_not receive(:track)
|
160
|
+
amplitude.run
|
163
161
|
end
|
164
162
|
end
|
165
163
|
|