splitclient-rb 7.0.2.pre.rc2-java → 7.0.3-java
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/CHANGES.txt +6 -1
- data/lib/splitclient-rb/cache/repositories/events/memory_repository.rb +6 -0
- data/lib/splitclient-rb/cache/repositories/events/redis_repository.rb +4 -0
- data/lib/splitclient-rb/cache/repositories/events_repository.rb +1 -1
- data/lib/splitclient-rb/cache/repositories/metrics/memory_repository.rb +9 -7
- data/lib/splitclient-rb/cache/repositories/metrics/redis_repository.rb +3 -2
- data/lib/splitclient-rb/cache/routers/impression_router.rb +2 -1
- data/lib/splitclient-rb/cache/senders/events_sender.rb +6 -10
- data/lib/splitclient-rb/cache/senders/impressions_sender.rb +5 -9
- data/lib/splitclient-rb/cache/senders/metrics_sender.rb +0 -2
- data/lib/splitclient-rb/clients/split_client.rb +19 -9
- 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: 13e8f0d13a64dd00ff1a4ba2e831c0c68898d07a
|
4
|
+
data.tar.gz: 3a723eb9cfd9c5844bb7f543b02f79b7f0501bfb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 160d1a974ef68db74d53495bd9a8cbd5040761dbf3a9076467f232e27746a974e9d9d0cd1261d9eec268c7b1adc5e06c910697ab90d567fe531fa2f1e9a0235d
|
7
|
+
data.tar.gz: 892f1d01a48bd179b123c2fce338dcab9024f34581e61ffcdc65840b04ee2ed6c0b502321eb825efd20941e0aebfe2c54ee97a80471d948316626aa2fdbd8d3a
|
data/CHANGES.txt
CHANGED
@@ -1,4 +1,9 @@
|
|
1
|
+
7.0.3 (Jan 20, 2020)
|
2
|
+
- Added integration tests.
|
3
|
+
- Fixed impressions labels.
|
4
|
+
|
1
5
|
7.0.2 (Nov 11, 2019)
|
6
|
+
- Fixed an issue about empty logs.
|
2
7
|
- Fixed an issue about reducing scan commands in redis.
|
3
8
|
|
4
9
|
7.0.1 (Oct 31, 2019)
|
@@ -35,7 +40,7 @@
|
|
35
40
|
define configurations for your treatments and also whitelisted keys. Read more in our docs!
|
36
41
|
|
37
42
|
6.2.0 (Mar 7th, 2019)
|
38
|
-
- Reworked SplitClient#destroy to ensure events, impressions and metrics are sent to Split backend when called
|
43
|
+
- Reworked SplitClient#destroy to ensure events, impressions and metrics are sent to Split backend when called.
|
39
44
|
- Ensured destroy is called when keyboard interrupts are sent to the application
|
40
45
|
- Changed SDK blocker (and block_until_ready) to have no effect in consumer mode
|
41
46
|
- Added support for applications tied to Faraday < 0.13 and net-http-persistent 3 using a patched Faraday adapter
|
@@ -4,7 +4,7 @@ module SplitIoClient
|
|
4
4
|
# Repository which forwards events interface to the selected adapter
|
5
5
|
class EventsRepository < Repository
|
6
6
|
extend Forwardable
|
7
|
-
def_delegators :@repository, :add, :clear
|
7
|
+
def_delegators :@repository, :add, :clear, :batch
|
8
8
|
|
9
9
|
def initialize(config, api_key)
|
10
10
|
super(config)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'concurrent'
|
2
|
+
|
1
3
|
module SplitIoClient
|
2
4
|
module Cache
|
3
5
|
module Repositories
|
@@ -6,9 +8,9 @@ module SplitIoClient
|
|
6
8
|
OPERATIONS = %w(sdk.get_treatment sdk.get_treatments sdk.get_treatment_with_config sdk.get_treatments_with_config)
|
7
9
|
|
8
10
|
def initialize(_ = nil, config)
|
9
|
-
@counts =
|
10
|
-
@latencies =
|
11
|
-
@gauges =
|
11
|
+
@counts = Concurrent::Array.new
|
12
|
+
@latencies = Concurrent::Array.new
|
13
|
+
@gauges = Concurrent::Array.new
|
12
14
|
@config = config
|
13
15
|
end
|
14
16
|
|
@@ -64,15 +66,15 @@ module SplitIoClient
|
|
64
66
|
end
|
65
67
|
|
66
68
|
def clear_counts
|
67
|
-
@counts =
|
69
|
+
@counts = Concurrent::Array.new
|
68
70
|
end
|
69
71
|
|
70
72
|
def clear_latencies
|
71
|
-
@latencies =
|
73
|
+
@latencies = Concurrent::Array.new
|
72
74
|
end
|
73
75
|
|
74
76
|
def clear_gauges
|
75
|
-
@gauges =
|
77
|
+
@gauges = Concurrent::Array.new
|
76
78
|
end
|
77
79
|
|
78
80
|
def clear
|
@@ -152,7 +154,7 @@ module SplitIoClient
|
|
152
154
|
end
|
153
155
|
|
154
156
|
def find_operation_latencies(operation)
|
155
|
-
@latencies.find { |l| l[:operation] == operation
|
157
|
+
@latencies.find { |l| l[:operation] == operation }
|
156
158
|
end
|
157
159
|
end
|
158
160
|
end
|
@@ -67,7 +67,8 @@ module SplitIoClient
|
|
67
67
|
|
68
68
|
# introduced to fix incorrect latencies
|
69
69
|
def fix_latencies
|
70
|
-
|
70
|
+
latencies_cleaned_key = namespace_key('/latencies.cleaned')
|
71
|
+
return if @adapter.exists?(latencies_cleaned_key)
|
71
72
|
|
72
73
|
keys =[]
|
73
74
|
|
@@ -91,7 +92,7 @@ module SplitIoClient
|
|
91
92
|
end
|
92
93
|
end
|
93
94
|
|
94
|
-
@adapter.set_string(
|
95
|
+
@adapter.set_string(latencies_cleaned_key, '1')
|
95
96
|
end
|
96
97
|
|
97
98
|
def latencies_to_be_deleted_key_pattern_prefix(key)
|
@@ -28,13 +28,14 @@ module SplitIoClient
|
|
28
28
|
split_name: split_name.to_s,
|
29
29
|
matching_key: impressions[:matching_key],
|
30
30
|
bucketing_key: impressions[:bucketing_key],
|
31
|
+
time: impressions[:time],
|
31
32
|
treatment: {
|
32
33
|
label: impressions[:treatments_labels_change_numbers][split_name.to_sym][:label],
|
33
34
|
treatment: impressions[:treatments_labels_change_numbers][split_name.to_sym][:treatment],
|
34
35
|
change_number: impressions[:treatments_labels_change_numbers][split_name.to_sym][:change_number]
|
35
36
|
},
|
36
37
|
attributes: impressions[:attributes]
|
37
|
-
)
|
38
|
+
) unless impressions[:treatments_labels_change_numbers][split_name.to_sym].nil?
|
38
39
|
end
|
39
40
|
end
|
40
41
|
|
@@ -9,16 +9,12 @@ module SplitIoClient
|
|
9
9
|
@config = config
|
10
10
|
end
|
11
11
|
|
12
|
-
def call
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
if defined?(PhusionPassenger)
|
19
|
-
PhusionPassenger.on_event(:starting_worker_process) do |forked|
|
20
|
-
events_thread if forked
|
21
|
-
end
|
12
|
+
def call
|
13
|
+
events_thread
|
14
|
+
|
15
|
+
if defined?(PhusionPassenger)
|
16
|
+
PhusionPassenger.on_event(:starting_worker_process) do |forked|
|
17
|
+
events_thread if forked
|
22
18
|
end
|
23
19
|
end
|
24
20
|
end
|
@@ -11,15 +11,11 @@ module SplitIoClient
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def call
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
if defined?(PhusionPassenger)
|
20
|
-
PhusionPassenger.on_event(:starting_worker_process) do |forked|
|
21
|
-
impressions_thread if forked
|
22
|
-
end
|
14
|
+
impressions_thread
|
15
|
+
|
16
|
+
if defined?(PhusionPassenger)
|
17
|
+
PhusionPassenger.on_event(:starting_worker_process) do |forked|
|
18
|
+
impressions_thread if forked
|
23
19
|
end
|
24
20
|
end
|
25
21
|
end
|
@@ -97,7 +97,11 @@ module SplitIoClient
|
|
97
97
|
matching_key: matching_key,
|
98
98
|
bucketing_key: bucketing_key,
|
99
99
|
time: time,
|
100
|
-
treatment:
|
100
|
+
treatment: {
|
101
|
+
label: treatment[:label],
|
102
|
+
treatment: treatment[:treatment],
|
103
|
+
change_number: treatment[:change_number]
|
104
|
+
},
|
101
105
|
attributes: attributes
|
102
106
|
)
|
103
107
|
end
|
@@ -247,12 +251,14 @@ module SplitIoClient
|
|
247
251
|
# Measure
|
248
252
|
@adapter.metrics.time('sdk.' + calling_method, latency)
|
249
253
|
|
254
|
+
treatments_for_impressions = get_treatment_for_impressions(treatments_labels_change_numbers)
|
255
|
+
|
250
256
|
time = (Time.now.to_f * 1000.0).to_i
|
251
257
|
@impressions_repository.add_bulk(
|
252
|
-
matching_key, bucketing_key,
|
253
|
-
)
|
258
|
+
matching_key, bucketing_key, treatments_for_impressions, time
|
259
|
+
) unless treatments_for_impressions == {}
|
254
260
|
|
255
|
-
route_impressions(sanitized_split_names, matching_key, bucketing_key, time,
|
261
|
+
route_impressions(sanitized_split_names, matching_key, bucketing_key, time, treatments_for_impressions, attributes)
|
256
262
|
|
257
263
|
split_names_keys = treatments_labels_change_numbers.keys
|
258
264
|
treatments = treatments_labels_change_numbers.values.map do |v|
|
@@ -282,14 +288,11 @@ module SplitIoClient
|
|
282
288
|
)
|
283
289
|
control_treatment = { treatment: Engine::Models::Treatment::CONTROL }
|
284
290
|
|
285
|
-
parsed_control_exception = parsed_treatment(multiple,
|
286
|
-
control_treatment.merge({ label: Engine::Models::Label::EXCEPTION }))
|
287
|
-
|
288
291
|
bucketing_key, matching_key = keys_from_key(key)
|
289
292
|
|
290
293
|
attributes = parsed_attributes(attributes)
|
291
294
|
|
292
|
-
return
|
295
|
+
return parsed_treatment(multiple, control_treatment) unless valid_client && @config.split_validator.valid_get_treatment_parameters(calling_method, key, split_name, matching_key, bucketing_key, attributes)
|
293
296
|
|
294
297
|
bucketing_key = bucketing_key ? bucketing_key.to_s : nil
|
295
298
|
matching_key = matching_key.to_s
|
@@ -336,7 +339,7 @@ module SplitIoClient
|
|
336
339
|
|
337
340
|
store_impression(split_name, matching_key, bucketing_key, control_treatment, attributes) if store_impressions
|
338
341
|
|
339
|
-
return
|
342
|
+
return parsed_treatment(multiple, control_treatment.merge({ label: Engine::Models::Label::EXCEPTION }))
|
340
343
|
end
|
341
344
|
|
342
345
|
parsed_treatment(multiple, treatment_data)
|
@@ -354,5 +357,12 @@ module SplitIoClient
|
|
354
357
|
def parsed_attributes(attributes)
|
355
358
|
return attributes || attributes.to_h
|
356
359
|
end
|
360
|
+
|
361
|
+
def get_treatment_for_impressions(treatments_labels_change_numbers)
|
362
|
+
return treatments_labels_change_numbers.select{|imp|
|
363
|
+
treatments_labels_change_numbers[imp][:label] != Engine::Models::Label::NOT_FOUND &&
|
364
|
+
!treatments_labels_change_numbers[imp][:label].nil?
|
365
|
+
}
|
366
|
+
end
|
357
367
|
end
|
358
368
|
end
|
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: 7.0.
|
4
|
+
version: 7.0.3
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Split Software
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -402,9 +402,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
402
402
|
version: '0'
|
403
403
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
404
404
|
requirements:
|
405
|
-
- - "
|
405
|
+
- - ">="
|
406
406
|
- !ruby/object:Gem::Version
|
407
|
-
version:
|
407
|
+
version: '0'
|
408
408
|
requirements: []
|
409
409
|
rubyforge_project:
|
410
410
|
rubygems_version: 2.6.14
|