splitclient-rb 5.0.1.pre.rc1-java → 5.0.2-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.txt +3 -0
- data/Detailed-README.md +4 -2
- data/NEWS +5 -0
- data/lib/splitclient-rb/cache/routers/impression_router.rb +9 -2
- data/lib/splitclient-rb/clients/split_client.rb +4 -2
- data/lib/splitclient-rb/split_config.rb +1 -0
- data/lib/splitclient-rb/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5c04717975f8f3719dab2e4b66e237a3f8f680a
|
4
|
+
data.tar.gz: a8b0d913af4125b8f2bfef40bd92fa45d1e26739
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a9ec6fb65440f0ec31df24f3e137bbe907b76a56310f0e768b49203adf1c019e25d5949ea935b66f430ec8f412575a005d74f602b776a3a5b4c8a25d5fc0b72
|
7
|
+
data.tar.gz: c1a72c76c15d66bd08ca076407069577b4051b39bdd1466921e5a5e209481d0bfa40ab1620b5bd5ce241a931c4af92b7cdbd7fee6ae0ae9388eedb5f2934ac04
|
data/CHANGES.txt
CHANGED
data/Detailed-README.md
CHANGED
@@ -366,7 +366,9 @@ transport_debug_enabled: true # used for log transport data (mostly http request
|
|
366
366
|
|
367
367
|
### Impression Listener
|
368
368
|
|
369
|
-
|
369
|
+
The SDK provides an optional featured called Impression Listener, that captures every single impression in your app.
|
370
|
+
|
371
|
+
To set up an Impression Listener, define a class that implements a `log` instance method, which must receive the `impression` argument. As an example you could define your listener as follows:
|
370
372
|
|
371
373
|
```ruby
|
372
374
|
class MyImpressionListener
|
@@ -376,7 +378,7 @@ class MyImpressionListener
|
|
376
378
|
end
|
377
379
|
```
|
378
380
|
|
379
|
-
Nothing fancy here,
|
381
|
+
Nothing fancy here, the listener just takes an impression and logs it to the stdout. Now, to actually use this class you'll need to specify it as an option in your config (i.e. initializer) like this:
|
380
382
|
|
381
383
|
```ruby
|
382
384
|
{
|
data/NEWS
CHANGED
@@ -5,6 +5,9 @@ module SplitIoClient
|
|
5
5
|
def initialize(config)
|
6
6
|
@config = config
|
7
7
|
@listener = config.impression_listener
|
8
|
+
|
9
|
+
return unless @listener
|
10
|
+
|
8
11
|
@queue = Queue.new
|
9
12
|
router_thread
|
10
13
|
|
@@ -16,12 +19,12 @@ module SplitIoClient
|
|
16
19
|
end
|
17
20
|
|
18
21
|
def add(impression)
|
19
|
-
|
22
|
+
enqueue(impression)
|
20
23
|
end
|
21
24
|
|
22
25
|
def add_bulk(impressions)
|
23
26
|
impressions[:split_names].each do |split_name|
|
24
|
-
|
27
|
+
enqueue(
|
25
28
|
split_name: split_name.to_s,
|
26
29
|
matching_key: impressions[:matching_key],
|
27
30
|
bucketing_key: impressions[:bucketing_key],
|
@@ -37,6 +40,10 @@ module SplitIoClient
|
|
37
40
|
|
38
41
|
private
|
39
42
|
|
43
|
+
def enqueue(impression)
|
44
|
+
@queue.push(impression) if @listener
|
45
|
+
end
|
46
|
+
|
40
47
|
def router_thread
|
41
48
|
@config.threads[:impression_router] = Thread.new do
|
42
49
|
loop do
|
@@ -144,9 +144,8 @@ module SplitIoClient
|
|
144
144
|
|
145
145
|
def store_impression(split_name, matching_key, bucketing_key, treatment, store_impressions, attributes)
|
146
146
|
time = (Time.now.to_f * 1000.0).to_i
|
147
|
-
route_impression(split_name, matching_key, bucketing_key, time, treatment, attributes) if @config.impression_listener && store_impressions
|
148
147
|
|
149
|
-
return
|
148
|
+
return unless @config.impressions_queue_size > 0 && store_impressions
|
150
149
|
|
151
150
|
@impressions_repository.add(split_name,
|
152
151
|
'keyName' => matching_key,
|
@@ -156,6 +155,9 @@ module SplitIoClient
|
|
156
155
|
'time' => time,
|
157
156
|
'changeNumber' => treatment[:change_number]
|
158
157
|
)
|
158
|
+
|
159
|
+
route_impression(split_name, matching_key, bucketing_key, time, treatment, attributes)
|
160
|
+
|
159
161
|
rescue StandardError => error
|
160
162
|
@config.log_found_exception(__method__.to_s, error)
|
161
163
|
end
|
@@ -22,6 +22,7 @@ module SplitIoClient
|
|
22
22
|
# @option opts [Object] :logger a logger to user for messages from the client. Defaults to stdout
|
23
23
|
# @option opts [Boolean] :debug_enabled (false) The value for the debug flag
|
24
24
|
# @option opts [Int] :impressions_queue_size how big the impressions queue is before dropping impressions. -1 to disable it.
|
25
|
+
# @option opts [#log] :impression_listener this object will capture all impressions and process them through `#log`
|
25
26
|
#
|
26
27
|
# @return [type] SplitConfig with configuration options
|
27
28
|
def initialize(opts = {})
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: splitclient-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.
|
4
|
+
version: 5.0.2
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Split Software
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -309,9 +309,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
309
309
|
version: '0'
|
310
310
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
311
311
|
requirements:
|
312
|
-
- - "
|
312
|
+
- - ">="
|
313
313
|
- !ruby/object:Gem::Version
|
314
|
-
version:
|
314
|
+
version: '0'
|
315
315
|
requirements: []
|
316
316
|
rubyforge_project:
|
317
317
|
rubygems_version: 2.6.14
|