splitclient-rb 7.3.5.pre.rc4 → 8.0.0.pre.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +8 -10
- data/.rubocop.yml +19 -15
- data/README.md +1 -1
- data/Rakefile +1 -8
- data/lib/splitclient-rb/cache/fetchers/segment_fetcher.rb +6 -6
- data/lib/splitclient-rb/cache/fetchers/split_fetcher.rb +2 -2
- data/lib/splitclient-rb/cache/repositories/events/memory_repository.rb +2 -2
- data/lib/splitclient-rb/cache/repositories/events_repository.rb +2 -2
- data/lib/splitclient-rb/cache/repositories/segments_repository.rb +2 -2
- data/lib/splitclient-rb/cache/routers/impression_router.rb +4 -4
- data/lib/splitclient-rb/cache/senders/impressions_adapter/memory_sender.rb +6 -6
- data/lib/splitclient-rb/cache/senders/impressions_adapter/redis_sender.rb +2 -4
- data/lib/splitclient-rb/cache/senders/impressions_count_sender.rb +3 -3
- data/lib/splitclient-rb/cache/senders/impressions_sender.rb +2 -2
- data/lib/splitclient-rb/cache/stores/localhost_split_store.rb +2 -2
- data/lib/splitclient-rb/clients/split_client.rb +4 -4
- data/lib/splitclient-rb/engine/api/client.rb +0 -23
- data/lib/splitclient-rb/engine/api/telemetry_api.rb +2 -2
- data/lib/splitclient-rb/engine/auth_api_client.rb +2 -2
- data/lib/splitclient-rb/engine/common/impressions_manager.rb +2 -2
- data/lib/splitclient-rb/engine/matchers/contains_all_matcher.rb +0 -4
- data/lib/splitclient-rb/engine/matchers/contains_any_matcher.rb +0 -4
- data/lib/splitclient-rb/engine/matchers/equal_to_set_matcher.rb +0 -4
- data/lib/splitclient-rb/engine/matchers/part_of_set_matcher.rb +0 -4
- data/lib/splitclient-rb/engine/push_manager.rb +14 -11
- data/lib/splitclient-rb/engine/synchronizer.rb +4 -4
- data/lib/splitclient-rb/split_config.rb +6 -4
- data/lib/splitclient-rb/sse/notification_manager_keeper.rb +3 -2
- data/lib/splitclient-rb/telemetry/memory/memory_evaluation_consumer.rb +1 -1
- data/lib/splitclient-rb/telemetry/memory/memory_evaluation_producer.rb +5 -5
- data/lib/splitclient-rb/telemetry/memory/memory_init_consumer.rb +1 -1
- data/lib/splitclient-rb/telemetry/memory/memory_init_producer.rb +5 -5
- data/lib/splitclient-rb/telemetry/memory/memory_runtime_consumer.rb +1 -1
- data/lib/splitclient-rb/telemetry/memory/memory_runtime_producer.rb +20 -20
- data/lib/splitclient-rb/telemetry/memory/memory_synchronizer.rb +5 -5
- data/lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb +1 -1
- data/lib/splitclient-rb/telemetry/redis/redis_init_producer.rb +7 -7
- data/lib/splitclient-rb/telemetry/redis/redis_synchronizer.rb +3 -3
- data/lib/splitclient-rb/telemetry/sync_task.rb +11 -11
- data/lib/splitclient-rb/version.rb +1 -1
- data/lib/splitclient-rb.rb +0 -1
- data/splitclient-rb.gemspec +6 -7
- metadata +25 -27
- data/Appraisals +0 -10
- data/lib/splitclient-rb/engine/api/faraday_adapter/patched_net_http_persistent.rb +0 -46
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 333fcb2b05ec1dcb1c7e3a2a56bdc7da02892c38918e75857764c99b77bed49b
|
4
|
+
data.tar.gz: 9ab57fecdfcba16ce0cb22cdc68d051dbb512e3f23ff2eb530e2f856bf8e8c36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ec3a948c7ac452f27313c1f9dfb8a7f34e7464c9689cf319de7379346163815a937185672c42f6849a1304886a83733082a5692b647501908d434b395d55b4a
|
7
|
+
data.tar.gz: bf6a9e34ff5356e32f66c03fd2949caa751dd05a2a50731a120f9cdb0d5438905b3ee5df0aa95a45d2dc75f22b6dbcb98179ee14e2619d37fc5eaf3115a78e9d
|
data/.github/workflows/ci.yml
CHANGED
@@ -1,10 +1,4 @@
|
|
1
|
-
on:
|
2
|
-
push:
|
3
|
-
branches:
|
4
|
-
- master
|
5
|
-
pull_request:
|
6
|
-
branches:
|
7
|
-
- master
|
1
|
+
on: [push, pull_request]
|
8
2
|
|
9
3
|
jobs:
|
10
4
|
test:
|
@@ -14,16 +8,20 @@ jobs:
|
|
14
8
|
image: redis
|
15
9
|
ports:
|
16
10
|
- 6379:6379
|
11
|
+
strategy:
|
12
|
+
matrix:
|
13
|
+
ruby: [ '2.5.0', '3.1.1' ]
|
14
|
+
|
17
15
|
steps:
|
18
16
|
- name: Checkout code
|
19
17
|
uses: actions/checkout@v2
|
20
18
|
with:
|
21
19
|
fetch-depth: 0
|
22
20
|
|
23
|
-
- name: Set up Ruby
|
24
|
-
uses: ruby/setup-ruby@
|
21
|
+
- name: Set up Ruby ${{ matrix.ruby }}
|
22
|
+
uses: ruby/setup-ruby@v1
|
25
23
|
with:
|
26
|
-
ruby-version:
|
24
|
+
ruby-version: ${{ matrix.ruby }}
|
27
25
|
|
28
26
|
- name: Install dependencies
|
29
27
|
run: bundle install
|
data/.rubocop.yml
CHANGED
@@ -27,20 +27,6 @@ Metrics/ParameterLists:
|
|
27
27
|
|
28
28
|
Metrics/LineLength:
|
29
29
|
Max: 135
|
30
|
-
Exclude:
|
31
|
-
- spec/sse/**/*
|
32
|
-
- spec/integrations/**/*
|
33
|
-
- spec/engine/sync_manager_spec.rb
|
34
|
-
- spec/engine/auth_api_client_spec.rb
|
35
|
-
- spec/telemetry/synchronizer_spec.rb
|
36
|
-
- spec/splitclient/split_config_spec.rb
|
37
|
-
- spec/engine/push_manager_spec.rb
|
38
|
-
- spec/cache/senders/impressions_sender_adapter_spec.rb
|
39
|
-
|
40
|
-
Style/BracesAroundHashParameters:
|
41
|
-
Exclude:
|
42
|
-
- spec/integrations/push_client_spec.rb
|
43
|
-
- spec/engine/synchronizer_spec.rb
|
44
30
|
|
45
31
|
Metrics/BlockLength:
|
46
32
|
Exclude:
|
@@ -51,8 +37,24 @@ Naming/FileName:
|
|
51
37
|
Exclude:
|
52
38
|
- splitclient-rb.gemspec
|
53
39
|
|
40
|
+
Style/OptionalBooleanParameter:
|
41
|
+
Exclude:
|
42
|
+
- lib/splitclient-rb/engine/matchers/between_matcher.rb
|
43
|
+
- lib/splitclient-rb/engine/matchers/combining_matcher.rb
|
44
|
+
- lib/splitclient-rb/engine/matchers/equal_to_matcher.rb
|
45
|
+
- lib/splitclient-rb/engine/matchers/less_than_or_equal_to_matcher.rb
|
46
|
+
- lib/splitclient-rb/engine/matchers/greater_than_or_equal_to_matcher.rb
|
47
|
+
|
48
|
+
Style/HashTransformKeys:
|
49
|
+
Exclude:
|
50
|
+
- lib/splitclient-rb/engine/matchers/combining_matcher.rb
|
51
|
+
|
52
|
+
Style/RedundantReturn:
|
53
|
+
Exclude:
|
54
|
+
- lib/splitclient-rb/engine/common/impressions_manager.rb
|
55
|
+
|
54
56
|
AllCops:
|
55
|
-
TargetRubyVersion: 2.
|
57
|
+
TargetRubyVersion: 2.5
|
56
58
|
Exclude:
|
57
59
|
- gemfiles/* # excluded as appraisal generates them with errors
|
58
60
|
- lib/*
|
@@ -70,3 +72,5 @@ AllCops:
|
|
70
72
|
- lib/splitclient-rb/engine/synchronizer.rb
|
71
73
|
- tmp/**/*
|
72
74
|
- lib/splitclient-rb/sse/event_source/client.rb
|
75
|
+
- spec/**/*
|
76
|
+
- .simplecov
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@ This SDK is designed to work with Split, the platform for controlled rollouts, w
|
|
7
7
|
[![Twitter Follow](https://img.shields.io/twitter/follow/splitsoftware.svg?style=social&label=Follow&maxAge=1529000)](https://twitter.com/intent/follow?screen_name=splitsoftware)
|
8
8
|
|
9
9
|
## Compatibility
|
10
|
-
The Ruby SDK support Ruby version 2.
|
10
|
+
The Ruby SDK support Ruby version 2.5.0 or later and JRuby or 9.1.17 o later.
|
11
11
|
|
12
12
|
Also the Ruby SDK has been tested as a standalone app as well as using the following web servers:
|
13
13
|
- Puma
|
data/Rakefile
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
require 'bundler/gem_tasks'
|
4
4
|
require 'rspec/core/rake_task'
|
5
5
|
require 'rubocop/rake_task'
|
6
|
-
require 'appraisal'
|
7
6
|
|
8
7
|
Dir['tasks/**/*.rake'].each { |rake| load rake }
|
9
8
|
|
@@ -26,10 +25,4 @@ else
|
|
26
25
|
end
|
27
26
|
end
|
28
27
|
|
29
|
-
|
30
|
-
task :default do
|
31
|
-
sh 'appraisal install && rake appraisal && rake rubocop'
|
32
|
-
end
|
33
|
-
else
|
34
|
-
task default: %i[spec rubocop]
|
35
|
-
end
|
28
|
+
task default: %i[spec rubocop]
|
@@ -30,16 +30,16 @@ module SplitIoClient
|
|
30
30
|
fetch_segment(name, fetch_options) if change_number == -1
|
31
31
|
end
|
32
32
|
end
|
33
|
-
rescue StandardError =>
|
34
|
-
@config.log_found_exception(__method__.to_s,
|
33
|
+
rescue StandardError => e
|
34
|
+
@config.log_found_exception(__method__.to_s, e)
|
35
35
|
end
|
36
36
|
|
37
37
|
def fetch_segment(name, fetch_options = { cache_control_headers: false, till: nil })
|
38
38
|
@semaphore.synchronize do
|
39
39
|
segments_api.fetch_segments_by_names([name], fetch_options)
|
40
40
|
end
|
41
|
-
rescue StandardError =>
|
42
|
-
@config.log_found_exception(__method__.to_s,
|
41
|
+
rescue StandardError => e
|
42
|
+
@config.log_found_exception(__method__.to_s, e)
|
43
43
|
end
|
44
44
|
|
45
45
|
def fetch_segments
|
@@ -48,8 +48,8 @@ module SplitIoClient
|
|
48
48
|
|
49
49
|
true
|
50
50
|
end
|
51
|
-
rescue StandardError =>
|
52
|
-
@config.log_found_exception(__method__.to_s,
|
51
|
+
rescue StandardError => e
|
52
|
+
@config.log_found_exception(__method__.to_s, e)
|
53
53
|
false
|
54
54
|
end
|
55
55
|
|
@@ -36,8 +36,8 @@ module SplitIoClient
|
|
36
36
|
|
37
37
|
{ segment_names: data[:segment_names], success: true }
|
38
38
|
end
|
39
|
-
rescue StandardError =>
|
40
|
-
@config.log_found_exception(__method__.to_s,
|
39
|
+
rescue StandardError => e
|
40
|
+
@config.log_found_exception(__method__.to_s, e)
|
41
41
|
{ segment_names: [], success: false }
|
42
42
|
end
|
43
43
|
|
@@ -19,8 +19,8 @@ module SplitIoClient
|
|
19
19
|
post_events if @size >= EVENTS_MAX_SIZE_BYTES || @adapter.length == @config.events_queue_size
|
20
20
|
|
21
21
|
@telemetry_runtime_producer.record_events_stats(Telemetry::Domain::Constants::EVENTS_QUEUED, 1)
|
22
|
-
rescue StandardError =>
|
23
|
-
@config.log_found_exception(__method__.to_s,
|
22
|
+
rescue StandardError => e
|
23
|
+
@config.log_found_exception(__method__.to_s, e)
|
24
24
|
@telemetry_runtime_producer.record_events_stats(Telemetry::Domain::Constants::EVENTS_DROPPED, 1)
|
25
25
|
end
|
26
26
|
|
@@ -21,8 +21,8 @@ module SplitIoClient
|
|
21
21
|
|
22
22
|
def post_events
|
23
23
|
events_api.post(self.clear)
|
24
|
-
rescue StandardError =>
|
25
|
-
@config.log_found_exception(__method__.to_s,
|
24
|
+
rescue StandardError => e
|
25
|
+
@config.log_found_exception(__method__.to_s, e)
|
26
26
|
end
|
27
27
|
|
28
28
|
protected
|
@@ -41,8 +41,8 @@ module SplitIoClient
|
|
41
41
|
attributes: impression[:attributes]
|
42
42
|
}
|
43
43
|
@queue.push(imp) if @listener
|
44
|
-
rescue StandardError =>
|
45
|
-
@config.log_found_exception(__method__.to_s,
|
44
|
+
rescue StandardError => e
|
45
|
+
@config.log_found_exception(__method__.to_s, e)
|
46
46
|
end
|
47
47
|
|
48
48
|
def router_thread
|
@@ -50,8 +50,8 @@ module SplitIoClient
|
|
50
50
|
loop do
|
51
51
|
begin
|
52
52
|
@listener.log(@queue.pop)
|
53
|
-
rescue StandardError =>
|
54
|
-
@config.log_found_exception(__method__.to_s,
|
53
|
+
rescue StandardError => e
|
54
|
+
@config.log_found_exception(__method__.to_s, e)
|
55
55
|
end
|
56
56
|
end
|
57
57
|
end
|
@@ -31,17 +31,17 @@ module SplitIoClient
|
|
31
31
|
def uniques_formatter(uniques)
|
32
32
|
return if uniques.nil? || uniques.empty?
|
33
33
|
|
34
|
-
to_return = {
|
34
|
+
to_return = { keys: [] }
|
35
35
|
uniques.each do |key, value|
|
36
|
-
to_return[:
|
36
|
+
to_return[:keys] << {
|
37
37
|
f: key,
|
38
38
|
ks: value.to_a
|
39
39
|
}
|
40
40
|
end
|
41
41
|
|
42
42
|
to_return
|
43
|
-
rescue StandardError =>
|
44
|
-
@config.log_found_exception(__method__.to_s,
|
43
|
+
rescue StandardError => e
|
44
|
+
@config.log_found_exception(__method__.to_s, e)
|
45
45
|
nil
|
46
46
|
end
|
47
47
|
|
@@ -61,8 +61,8 @@ module SplitIoClient
|
|
61
61
|
end
|
62
62
|
|
63
63
|
formated_counts
|
64
|
-
rescue StandardError =>
|
65
|
-
@config.log_found_exception(__method__.to_s,
|
64
|
+
rescue StandardError => e
|
65
|
+
@config.log_found_exception(__method__.to_s, e)
|
66
66
|
nil
|
67
67
|
end
|
68
68
|
end
|
@@ -29,8 +29,6 @@ module SplitIoClient
|
|
29
29
|
impressions_count.each do |key, value|
|
30
30
|
pipeline.hincrby(impressions_count_key, key, value)
|
31
31
|
end
|
32
|
-
|
33
|
-
@future = pipeline.hlen(impressions_count_key)
|
34
32
|
end
|
35
33
|
|
36
34
|
expire_impressions_count_key(impressions_count, result)
|
@@ -67,8 +65,8 @@ module SplitIoClient
|
|
67
65
|
end
|
68
66
|
|
69
67
|
to_return
|
70
|
-
rescue StandardError =>
|
71
|
-
@config.log_found_exception(__method__.to_s,
|
68
|
+
rescue StandardError => e
|
69
|
+
@config.log_found_exception(__method__.to_s, e)
|
72
70
|
nil
|
73
71
|
end
|
74
72
|
end
|
@@ -24,7 +24,7 @@ module SplitIoClient
|
|
24
24
|
sleep(@config.counter_refresh_rate)
|
25
25
|
post_impressions_count
|
26
26
|
end
|
27
|
-
rescue SplitIoClient::SDKShutdownException
|
27
|
+
rescue SplitIoClient::SDKShutdownException
|
28
28
|
post_impressions_count
|
29
29
|
|
30
30
|
@config.logger.info('Posting impressions count due to shutdown')
|
@@ -34,8 +34,8 @@ module SplitIoClient
|
|
34
34
|
|
35
35
|
def post_impressions_count
|
36
36
|
@impressions_sender_adapter.record_impressions_count(@impression_counter.pop_all)
|
37
|
-
rescue StandardError =>
|
38
|
-
@config.log_found_exception(__method__.to_s,
|
37
|
+
rescue StandardError => e
|
38
|
+
@config.log_found_exception(__method__.to_s, e)
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
@@ -39,8 +39,8 @@ module SplitIoClient
|
|
39
39
|
.call(fetch_all_impressions)
|
40
40
|
|
41
41
|
impressions_api.post(formatted_impressions)
|
42
|
-
rescue StandardError =>
|
43
|
-
@config.log_found_exception(__method__.to_s,
|
42
|
+
rescue StandardError => e
|
43
|
+
@config.log_found_exception(__method__.to_s, e)
|
44
44
|
end
|
45
45
|
|
46
46
|
def impressions_api
|
@@ -46,10 +46,10 @@ module SplitIoClient
|
|
46
46
|
end
|
47
47
|
|
48
48
|
@status_manager.ready! if @status_manager
|
49
|
-
rescue StandardError =>
|
49
|
+
rescue StandardError => e
|
50
50
|
@config.logger.error('Error while parsing the split file. ' \
|
51
51
|
'Check that the input file matches the expected format')
|
52
|
-
@config.log_found_exception(__method__.to_s,
|
52
|
+
@config.log_found_exception(__method__.to_s, e)
|
53
53
|
end
|
54
54
|
|
55
55
|
def store_split(split)
|
@@ -110,8 +110,8 @@ module SplitIoClient
|
|
110
110
|
@events_repository.add(key.to_s, traffic_type_name.downcase, event_type.to_s, (Time.now.to_f * 1000).to_i, value, properties, properties_size)
|
111
111
|
record_latency(TRACK, start)
|
112
112
|
true
|
113
|
-
rescue StandardError =>
|
114
|
-
@config.log_found_exception(__method__.to_s,
|
113
|
+
rescue StandardError => e
|
114
|
+
@config.log_found_exception(__method__.to_s, e)
|
115
115
|
record_exception(TRACK)
|
116
116
|
|
117
117
|
false
|
@@ -291,8 +291,8 @@ module SplitIoClient
|
|
291
291
|
|
292
292
|
impression = @impressions_manager.build_impression(matching_key, bucketing_key, split_name, treatment_data, { attributes: attributes, time: nil })
|
293
293
|
impressions << impression unless impression.nil?
|
294
|
-
rescue StandardError =>
|
295
|
-
@config.log_found_exception(__method__.to_s,
|
294
|
+
rescue StandardError => e
|
295
|
+
@config.log_found_exception(__method__.to_s, e)
|
296
296
|
|
297
297
|
record_exception(calling_method)
|
298
298
|
|
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'net/http/persistent'
|
4
|
-
|
5
3
|
module SplitIoClient
|
6
4
|
module Api
|
7
5
|
class Client
|
@@ -54,33 +52,12 @@ module SplitIoClient
|
|
54
52
|
private
|
55
53
|
|
56
54
|
def api_client
|
57
|
-
if needs_patched_net_http_persistent_adapter?
|
58
|
-
require 'splitclient-rb/engine/api/faraday_adapter/patched_net_http_persistent'
|
59
|
-
|
60
|
-
Faraday::Adapter.register_middleware(
|
61
|
-
net_http_persistent: SplitIoClient::FaradayAdapter::PatchedNetHttpPersistent
|
62
|
-
)
|
63
|
-
end
|
64
|
-
|
65
55
|
@api_client ||= Faraday.new do |builder|
|
66
56
|
builder.use SplitIoClient::FaradayMiddleware::Gzip
|
67
57
|
builder.adapter :net_http_persistent
|
68
58
|
end
|
69
59
|
end
|
70
60
|
|
71
|
-
def needs_patched_net_http_persistent_adapter?
|
72
|
-
new_net_http_persistent? && incompatible_faraday_version?
|
73
|
-
end
|
74
|
-
|
75
|
-
def incompatible_faraday_version?
|
76
|
-
version = Faraday::VERSION.split('.')[0..1]
|
77
|
-
version[0].to_i == 0 && version[1].to_i < 13
|
78
|
-
end
|
79
|
-
|
80
|
-
def new_net_http_persistent?
|
81
|
-
Net::HTTP::Persistent::VERSION.split('.').first.to_i >= 3
|
82
|
-
end
|
83
|
-
|
84
61
|
def common_headers(api_key)
|
85
62
|
{
|
86
63
|
'Authorization' => "Bearer #{api_key}",
|
@@ -18,9 +18,9 @@ module SplitIoClient
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def record_unique_keys(uniques)
|
21
|
-
return if uniques[:
|
21
|
+
return if uniques[:keys].empty?
|
22
22
|
|
23
|
-
post_telemetry("#{@config.telemetry_service_url}/
|
23
|
+
post_telemetry("#{@config.telemetry_service_url}/keys/ss", uniques, 'unique_keys')
|
24
24
|
rescue StandardError => e
|
25
25
|
@config.log_found_exception(__method__.to_s, e)
|
26
26
|
end
|
@@ -85,8 +85,8 @@ module SplitIoClient
|
|
85
85
|
control_pri = SplitIoClient::Constants::CONTROL_PRI
|
86
86
|
control_sec = SplitIoClient::Constants::CONTROL_SEC
|
87
87
|
channels_string = channels_string.gsub(control_pri, "#{prefix}#{control_pri}")
|
88
|
-
|
89
|
-
channels_string
|
88
|
+
|
89
|
+
channels_string.gsub(control_sec, "#{prefix}#{control_sec}")
|
90
90
|
end
|
91
91
|
end
|
92
92
|
end
|
@@ -64,8 +64,8 @@ module SplitIoClient
|
|
64
64
|
|
65
65
|
def impression_router
|
66
66
|
@impression_router ||= SplitIoClient::ImpressionRouter.new(@config)
|
67
|
-
rescue StandardError =>
|
68
|
-
@config.log_found_exception(__method__.to_s,
|
67
|
+
rescue StandardError => e
|
68
|
+
@config.log_found_exception(__method__.to_s, e)
|
69
69
|
end
|
70
70
|
|
71
71
|
def record_stats(stats)
|
@@ -6,10 +6,6 @@ module SplitIoClient
|
|
6
6
|
|
7
7
|
attr_reader :attribute
|
8
8
|
|
9
|
-
def initialize(attribute, remote_array, logger)
|
10
|
-
super(attribute, remote_array, logger)
|
11
|
-
end
|
12
|
-
|
13
9
|
def match?(args)
|
14
10
|
if @remote_set.empty?
|
15
11
|
@logger.log_if_debug('[ContainsAllMatcher] Remote Set Empty')
|
@@ -6,10 +6,6 @@ module SplitIoClient
|
|
6
6
|
|
7
7
|
attr_reader :attribute
|
8
8
|
|
9
|
-
def initialize(attribute, remote_array, logger)
|
10
|
-
super(attribute, remote_array, logger)
|
11
|
-
end
|
12
|
-
|
13
9
|
def match?(args)
|
14
10
|
matches = local_set(args[:attributes], @attribute).intersect? @remote_set
|
15
11
|
@logger.log_if_debug("[ContainsAnyMatcher] Remote Set #{@remote_set} contains any \
|
@@ -41,17 +41,20 @@ module SplitIoClient
|
|
41
41
|
private
|
42
42
|
|
43
43
|
def schedule_next_token_refresh(time)
|
44
|
-
@config.threads[:schedule_next_token_refresh] = Thread.new
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
44
|
+
@config.threads[:schedule_next_token_refresh] = Thread.new { refresh_token_task(time) }
|
45
|
+
end
|
46
|
+
|
47
|
+
def refresh_token_task(time)
|
48
|
+
@config.logger.debug("schedule_next_token_refresh refresh in #{time} seconds.") if @config.debug_enabled
|
49
|
+
|
50
|
+
sleep(time)
|
51
|
+
|
52
|
+
@config.logger.debug('schedule_next_token_refresh starting ...') if @config.debug_enabled
|
53
|
+
@sse_handler.stop
|
54
|
+
|
55
|
+
start_sse
|
56
|
+
rescue StandardError => e
|
57
|
+
@config.logger.debug("schedule_next_token_refresh error: #{e.inspect}") if @config.debug_enabled
|
55
58
|
end
|
56
59
|
|
57
60
|
def record_telemetry(time)
|
@@ -96,8 +96,8 @@ module SplitIoClient
|
|
96
96
|
else
|
97
97
|
@config.logger.debug("No changes fetched after #{attempts} attempts with CDN bypassed.") if @config.debug_enabled
|
98
98
|
end
|
99
|
-
rescue StandardError =>
|
100
|
-
@config.log_found_exception(__method__.to_s,
|
99
|
+
rescue StandardError => e
|
100
|
+
@config.log_found_exception(__method__.to_s, e)
|
101
101
|
end
|
102
102
|
|
103
103
|
def fetch_segment(name, target_change_number)
|
@@ -132,8 +132,8 @@ module SplitIoClient
|
|
132
132
|
else
|
133
133
|
@config.logger.debug("No changes fetched for segment #{name} after #{attempts} attempts with CDN bypassed.") if @config.debug_enabled
|
134
134
|
end
|
135
|
-
rescue StandardError =>
|
136
|
-
@config.log_found_exception(__method__.to_s,
|
135
|
+
rescue StandardError => e
|
136
|
+
@config.log_found_exception(__method__.to_s, e)
|
137
137
|
end
|
138
138
|
|
139
139
|
private
|
@@ -51,7 +51,7 @@ module SplitIoClient
|
|
51
51
|
|
52
52
|
@segments_refresh_rate = opts[:segments_refresh_rate] || SplitConfig.default_segments_refresh_rate
|
53
53
|
|
54
|
-
@impressions_mode = init_impressions_mode(opts[:impressions_mode])
|
54
|
+
@impressions_mode = init_impressions_mode(opts[:impressions_mode], opts[:cache_adapter])
|
55
55
|
|
56
56
|
@impressions_refresh_rate = SplitConfig.init_impressions_refresh_rate(@impressions_mode, opts[:impressions_refresh_rate], SplitConfig.default_impressions_refresh_rate)
|
57
57
|
@impressions_queue_size = opts[:impressions_queue_size] || SplitConfig.default_impressions_queue_size
|
@@ -314,14 +314,16 @@ module SplitIoClient
|
|
314
314
|
:optimized
|
315
315
|
end
|
316
316
|
|
317
|
-
def init_impressions_mode(impressions_mode)
|
317
|
+
def init_impressions_mode(impressions_mode, adapter)
|
318
318
|
impressions_mode ||= SplitConfig.default_impressions_mode
|
319
319
|
|
320
|
+
return :debug if adapter == :redis
|
321
|
+
|
320
322
|
case impressions_mode
|
321
323
|
when :debug
|
322
324
|
return :debug
|
323
|
-
when :none
|
324
|
-
|
325
|
+
# when :none // we not support :none impression mode yet. Defaulting to :optimized mode
|
326
|
+
# return :none
|
325
327
|
else
|
326
328
|
@logger.error('You passed an invalid impressions_mode, impressions_mode should be one of the following values: :debug or :optimized. Defaulting to :optimized mode') unless impressions_mode == :optimized
|
327
329
|
return :optimized
|
@@ -61,10 +61,11 @@ module SplitIoClient
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def update_publishers(channel, publishers)
|
64
|
-
|
64
|
+
case channel
|
65
|
+
when Constants::CONTROL_PRI
|
65
66
|
@telemetry_runtime_producer.record_streaming_event(Telemetry::Domain::Constants::OCCUPANCY_PRI, publishers)
|
66
67
|
@publishers_pri.value = publishers
|
67
|
-
|
68
|
+
when Constants::CONTROL_SEC
|
68
69
|
@telemetry_runtime_producer.record_streaming_event(Telemetry::Domain::Constants::OCCUPANCY_SEC, publishers)
|
69
70
|
@publishers_sec.value = publishers
|
70
71
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module SplitIoClient
|
4
4
|
module Telemetry
|
5
|
-
class MemoryEvaluationProducer
|
5
|
+
class MemoryEvaluationProducer
|
6
6
|
def initialize(config)
|
7
7
|
@config = config
|
8
8
|
@adapter = config.telemetry_adapter
|
@@ -10,14 +10,14 @@ module SplitIoClient
|
|
10
10
|
|
11
11
|
def record_latency(method, bucket)
|
12
12
|
@adapter.latencies.find { |l| l[:method] == method }[:latencies][bucket] += 1
|
13
|
-
rescue StandardError =>
|
14
|
-
@config.log_found_exception(__method__.to_s,
|
13
|
+
rescue StandardError => e
|
14
|
+
@config.log_found_exception(__method__.to_s, e)
|
15
15
|
end
|
16
16
|
|
17
17
|
def record_exception(method)
|
18
18
|
@adapter.exceptions.find { |l| l[:method] == method }[:exceptions].increment
|
19
|
-
rescue StandardError =>
|
20
|
-
@config.log_found_exception(__method__.to_s,
|
19
|
+
rescue StandardError => e
|
20
|
+
@config.log_found_exception(__method__.to_s, e)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module SplitIoClient
|
4
4
|
module Telemetry
|
5
|
-
class MemoryInitProducer
|
5
|
+
class MemoryInitProducer
|
6
6
|
def initialize(config)
|
7
7
|
@config = config
|
8
8
|
@adapter = config.telemetry_adapter
|
@@ -14,14 +14,14 @@ module SplitIoClient
|
|
14
14
|
|
15
15
|
def record_bur_timeout
|
16
16
|
find_factory_counters(Domain::Constants::BUR_TIMEOUT)[:counts].increment
|
17
|
-
rescue StandardError =>
|
18
|
-
@config.log_found_exception(__method__.to_s,
|
17
|
+
rescue StandardError => e
|
18
|
+
@config.log_found_exception(__method__.to_s, e)
|
19
19
|
end
|
20
20
|
|
21
21
|
def record_non_ready_usages
|
22
22
|
find_factory_counters(Domain::Constants::NON_READY_USAGES)[:counts].increment
|
23
|
-
rescue StandardError =>
|
24
|
-
@config.log_found_exception(__method__.to_s,
|
23
|
+
rescue StandardError => e
|
24
|
+
@config.log_found_exception(__method__.to_s, e)
|
25
25
|
end
|
26
26
|
|
27
27
|
private
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module SplitIoClient
|
4
4
|
module Telemetry
|
5
|
-
class MemoryRuntimeProducer
|
5
|
+
class MemoryRuntimeProducer
|
6
6
|
def initialize(config)
|
7
7
|
@config = config
|
8
8
|
@adapter = config.telemetry_adapter
|
@@ -16,22 +16,22 @@ module SplitIoClient
|
|
16
16
|
|
17
17
|
def record_impressions_stats(type, count)
|
18
18
|
@adapter.impressions_data_records.find { |l| l[:type] == type }[:value].value += count unless count.zero?
|
19
|
-
rescue StandardError =>
|
20
|
-
@config.log_found_exception(__method__.to_s,
|
19
|
+
rescue StandardError => e
|
20
|
+
@config.log_found_exception(__method__.to_s, e)
|
21
21
|
end
|
22
22
|
|
23
23
|
def record_events_stats(type, count)
|
24
24
|
@adapter.events_data_records.find { |l| l[:type] == type }[:value].value += count unless count.zero?
|
25
|
-
rescue StandardError =>
|
26
|
-
@config.log_found_exception(__method__.to_s,
|
25
|
+
rescue StandardError => e
|
26
|
+
@config.log_found_exception(__method__.to_s, e)
|
27
27
|
end
|
28
28
|
|
29
29
|
def record_successful_sync(type, value = nil)
|
30
30
|
value = (Time.now.to_f * 1000.0).to_i if value.nil?
|
31
31
|
|
32
32
|
@adapter.last_synchronization.find { |l| l[:type] == type }[:value] = Concurrent::AtomicFixnum.new(value)
|
33
|
-
rescue StandardError =>
|
34
|
-
@config.log_found_exception(__method__.to_s,
|
33
|
+
rescue StandardError => e
|
34
|
+
@config.log_found_exception(__method__.to_s, e)
|
35
35
|
end
|
36
36
|
|
37
37
|
def record_sync_error(type, status)
|
@@ -39,42 +39,42 @@ module SplitIoClient
|
|
39
39
|
|
40
40
|
begin
|
41
41
|
http_errors[status] += 1
|
42
|
-
rescue StandardError =>
|
42
|
+
rescue StandardError => _e
|
43
43
|
http_errors[status] = 1
|
44
44
|
end
|
45
|
-
rescue StandardError =>
|
46
|
-
@config.log_found_exception(__method__.to_s,
|
45
|
+
rescue StandardError => e
|
46
|
+
@config.log_found_exception(__method__.to_s, e)
|
47
47
|
end
|
48
48
|
|
49
49
|
def record_sync_latency(type, bucket)
|
50
50
|
@adapter.http_latencies.find { |l| l[:type] == type }[:value][bucket] += 1
|
51
|
-
rescue StandardError =>
|
52
|
-
@config.log_found_exception(__method__.to_s,
|
51
|
+
rescue StandardError => e
|
52
|
+
@config.log_found_exception(__method__.to_s, e)
|
53
53
|
end
|
54
54
|
|
55
55
|
def record_auth_rejections
|
56
56
|
@adapter.auth_rejections.increment
|
57
|
-
rescue StandardError =>
|
58
|
-
@config.log_found_exception(__method__.to_s,
|
57
|
+
rescue StandardError => e
|
58
|
+
@config.log_found_exception(__method__.to_s, e)
|
59
59
|
end
|
60
60
|
|
61
61
|
def record_token_refreshes
|
62
62
|
@adapter.token_refreshes.increment
|
63
|
-
rescue StandardError =>
|
64
|
-
@config.log_found_exception(__method__.to_s,
|
63
|
+
rescue StandardError => e
|
64
|
+
@config.log_found_exception(__method__.to_s, e)
|
65
65
|
end
|
66
66
|
|
67
67
|
def record_streaming_event(type, data = nil, timestamp = nil)
|
68
68
|
timestamp ||= (Time.now.to_f * 1000.0).to_i
|
69
69
|
@adapter.streaming_events << { e: type, d: data, t: timestamp } unless @adapter.streaming_events.length >= 19
|
70
|
-
rescue StandardError =>
|
71
|
-
@config.log_found_exception(__method__.to_s,
|
70
|
+
rescue StandardError => e
|
71
|
+
@config.log_found_exception(__method__.to_s, e)
|
72
72
|
end
|
73
73
|
|
74
74
|
def record_session_length(session)
|
75
75
|
@adapter.session_length.value = session
|
76
|
-
rescue StandardError =>
|
77
|
-
@config.log_found_exception(__method__.to_s,
|
76
|
+
rescue StandardError => e
|
77
|
+
@config.log_found_exception(__method__.to_s, e)
|
78
78
|
end
|
79
79
|
end
|
80
80
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module SplitIoClient
|
4
4
|
module Telemetry
|
5
|
-
class MemorySynchronizer
|
5
|
+
class MemorySynchronizer
|
6
6
|
def initialize(config,
|
7
7
|
telemtry_consumers,
|
8
8
|
repositories,
|
@@ -37,8 +37,8 @@ module SplitIoClient
|
|
37
37
|
@telemetry_runtime_consumer.pop_tags)
|
38
38
|
|
39
39
|
@telemetry_api.record_stats(format_stats(usage))
|
40
|
-
rescue StandardError =>
|
41
|
-
@config.log_found_exception(__method__.to_s,
|
40
|
+
rescue StandardError => e
|
41
|
+
@config.log_found_exception(__method__.to_s, e)
|
42
42
|
end
|
43
43
|
|
44
44
|
def synchronize_config(active_factories = nil, redundant_active_factories = nil, time_until_ready = nil)
|
@@ -75,8 +75,8 @@ module SplitIoClient
|
|
75
75
|
@telemetry_init_consumer.non_ready_usages)
|
76
76
|
|
77
77
|
@telemetry_api.record_init(fornat_init_config(init_config))
|
78
|
-
rescue StandardError =>
|
79
|
-
@config.log_found_exception(__method__.to_s,
|
78
|
+
rescue StandardError => e
|
79
|
+
@config.log_found_exception(__method__.to_s, e)
|
80
80
|
end
|
81
81
|
|
82
82
|
private
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module SplitIoClient
|
4
4
|
module Telemetry
|
5
|
-
class RedisInitProducer
|
5
|
+
class RedisInitProducer
|
6
6
|
def initialize(config)
|
7
7
|
@config = config
|
8
8
|
@adapter = config.telemetry_adapter
|
@@ -11,12 +11,12 @@ module SplitIoClient
|
|
11
11
|
def record_config(config_data)
|
12
12
|
return if config_data.nil?
|
13
13
|
|
14
|
-
data = {
|
15
|
-
|
14
|
+
data = { t: { oM: config_data.om, st: config_data.st, aF: config_data.af, rF: config_data.rf, t: config_data.t } }
|
15
|
+
field = "#{@config.language}-#{@config.version}/#{@config.machine_name}/#{@config.machine_ip}"
|
16
16
|
|
17
|
-
@adapter.
|
18
|
-
rescue StandardError =>
|
19
|
-
@config.log_found_exception(__method__.to_s,
|
17
|
+
@adapter.add_to_map(config_key, field, data.to_json)
|
18
|
+
rescue StandardError => e
|
19
|
+
@config.log_found_exception(__method__.to_s, e)
|
20
20
|
end
|
21
21
|
|
22
22
|
def record_bur_timeout
|
@@ -30,7 +30,7 @@ module SplitIoClient
|
|
30
30
|
private
|
31
31
|
|
32
32
|
def config_key
|
33
|
-
"#{@config.redis_namespace}.telemetry.
|
33
|
+
"#{@config.redis_namespace}.telemetry.init"
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module SplitIoClient
|
4
4
|
module Telemetry
|
5
|
-
class RedisSynchronizer
|
5
|
+
class RedisSynchronizer
|
6
6
|
def initialize(config,
|
7
7
|
telemetry_init_producer)
|
8
8
|
@config = config
|
@@ -20,8 +20,8 @@ module SplitIoClient
|
|
20
20
|
init_config = ConfigInit.new(@config.mode, 'redis', active_factories, redundant_active_factories, tags)
|
21
21
|
|
22
22
|
@telemetry_init_producer.record_config(init_config)
|
23
|
-
rescue StandardError =>
|
24
|
-
@config.log_found_exception(__method__.to_s,
|
23
|
+
rescue StandardError => e
|
24
|
+
@config.log_found_exception(__method__.to_s, e)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -15,21 +15,21 @@ module SplitIoClient
|
|
15
15
|
private
|
16
16
|
|
17
17
|
def stats_thread
|
18
|
-
@config.threads[:telemetry_stats_sender] = Thread.new
|
19
|
-
|
20
|
-
@config.logger.info('Starting Telemetry Sync Task')
|
18
|
+
@config.threads[:telemetry_stats_sender] = Thread.new { telemetry_sync_task }
|
19
|
+
end
|
21
20
|
|
22
|
-
|
23
|
-
|
21
|
+
def telemetry_sync_task
|
22
|
+
@config.logger.info('Starting Telemetry Sync Task')
|
24
23
|
|
25
|
-
|
26
|
-
|
27
|
-
rescue SplitIoClient::SDKShutdownException
|
28
|
-
@telemetry_synchronizer.synchronize_stats
|
24
|
+
loop do
|
25
|
+
sleep(@config.telemetry_refresh_rate)
|
29
26
|
|
30
|
-
|
31
|
-
end
|
27
|
+
@telemetry_synchronizer.synchronize_stats
|
32
28
|
end
|
29
|
+
rescue SplitIoClient::SDKShutdownException
|
30
|
+
@telemetry_synchronizer.synchronize_stats
|
31
|
+
|
32
|
+
@config.logger.info('Posting Telemetry due to shutdown')
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
data/lib/splitclient-rb.rb
CHANGED
@@ -49,7 +49,6 @@ require 'splitclient-rb/validators'
|
|
49
49
|
require 'splitclient-rb/split_factory_registry'
|
50
50
|
|
51
51
|
require 'splitclient-rb/engine/api/faraday_middleware/gzip'
|
52
|
-
require 'splitclient-rb/engine/api/faraday_adapter/patched_net_http_persistent'
|
53
52
|
require 'splitclient-rb/engine/api/client'
|
54
53
|
require 'splitclient-rb/engine/api/impressions'
|
55
54
|
require 'splitclient-rb/engine/api/segments'
|
data/splitclient-rb.gemspec
CHANGED
@@ -8,16 +8,15 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.name = 'splitclient-rb'
|
9
9
|
spec.version = SplitIoClient::VERSION
|
10
10
|
spec.authors = ['Split Software']
|
11
|
-
spec.email = ['
|
12
|
-
|
11
|
+
spec.email = ['mauro.sanz@split.io']
|
13
12
|
spec.summary = 'Ruby client for split SDK.'
|
14
13
|
spec.description = 'Ruby client for using split SDK.'
|
15
14
|
spec.homepage = 'https://github.com/splitio/ruby-client'
|
16
15
|
spec.license = 'Apache-2.0'
|
17
16
|
|
18
17
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec|features|ext)/}) }
|
19
|
-
|
20
18
|
spec.require_paths = ['lib']
|
19
|
+
spec.required_ruby_version = '>= 2.5.0'
|
21
20
|
|
22
21
|
if defined?(JRUBY_VERSION)
|
23
22
|
spec.platform = 'java'
|
@@ -37,22 +36,22 @@ Gem::Specification.new do |spec|
|
|
37
36
|
end
|
38
37
|
|
39
38
|
spec.add_development_dependency 'allocation_stats', '~> 0.1'
|
40
|
-
spec.add_development_dependency 'appraisal', '~> 2.4'
|
41
39
|
spec.add_development_dependency 'bundler', '~> 2.2'
|
42
40
|
spec.add_development_dependency 'pry', '~> 0.14'
|
43
41
|
spec.add_development_dependency 'pry-nav', '~> 1.0'
|
44
|
-
spec.add_development_dependency 'rake', '~>
|
42
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
45
43
|
spec.add_development_dependency 'rake-compiler', '~> 1.1'
|
46
44
|
spec.add_development_dependency 'rspec', '~> 3.10'
|
47
|
-
spec.add_development_dependency 'rubocop', '
|
45
|
+
spec.add_development_dependency 'rubocop', '1.28.2'
|
48
46
|
spec.add_development_dependency 'simplecov', '~> 0.20'
|
49
47
|
spec.add_development_dependency 'simplecov-json', '~> 0.2'
|
50
48
|
spec.add_development_dependency 'timecop', '~> 0.9'
|
51
49
|
spec.add_development_dependency 'webmock', '~> 3.14'
|
50
|
+
spec.add_development_dependency 'webrick', '~> 1.7'
|
52
51
|
|
53
52
|
spec.add_runtime_dependency 'bitarray', '~> 1.3'
|
54
53
|
spec.add_runtime_dependency 'concurrent-ruby', '~> 1.0'
|
55
|
-
spec.add_runtime_dependency 'faraday', '>=
|
54
|
+
spec.add_runtime_dependency 'faraday', '>= 1.1', '< 2.0'
|
56
55
|
spec.add_runtime_dependency 'json', '>= 1.8', '< 3.0'
|
57
56
|
spec.add_runtime_dependency 'jwt', '>= 1.0.0', '< 3.0'
|
58
57
|
spec.add_runtime_dependency 'lru_redux', '~> 1.1'
|
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:
|
4
|
+
version: 8.0.0.pre.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Split Software
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: allocation_stats
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0.1'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: appraisal
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '2.4'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '2.4'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: bundler
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +72,14 @@ dependencies:
|
|
86
72
|
requirements:
|
87
73
|
- - "~>"
|
88
74
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
75
|
+
version: '13.0'
|
90
76
|
type: :development
|
91
77
|
prerelease: false
|
92
78
|
version_requirements: !ruby/object:Gem::Requirement
|
93
79
|
requirements:
|
94
80
|
- - "~>"
|
95
81
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
82
|
+
version: '13.0'
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
84
|
name: rake-compiler
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,14 +114,14 @@ dependencies:
|
|
128
114
|
requirements:
|
129
115
|
- - '='
|
130
116
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
117
|
+
version: 1.28.2
|
132
118
|
type: :development
|
133
119
|
prerelease: false
|
134
120
|
version_requirements: !ruby/object:Gem::Requirement
|
135
121
|
requirements:
|
136
122
|
- - '='
|
137
123
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
124
|
+
version: 1.28.2
|
139
125
|
- !ruby/object:Gem::Dependency
|
140
126
|
name: simplecov
|
141
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -192,6 +178,20 @@ dependencies:
|
|
192
178
|
- - "~>"
|
193
179
|
- !ruby/object:Gem::Version
|
194
180
|
version: '3.14'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: webrick
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - "~>"
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '1.7'
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - "~>"
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '1.7'
|
195
195
|
- !ruby/object:Gem::Dependency
|
196
196
|
name: bitarray
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
@@ -226,7 +226,7 @@ dependencies:
|
|
226
226
|
requirements:
|
227
227
|
- - ">="
|
228
228
|
- !ruby/object:Gem::Version
|
229
|
-
version: '
|
229
|
+
version: '1.1'
|
230
230
|
- - "<"
|
231
231
|
- !ruby/object:Gem::Version
|
232
232
|
version: '2.0'
|
@@ -236,7 +236,7 @@ dependencies:
|
|
236
236
|
requirements:
|
237
237
|
- - ">="
|
238
238
|
- !ruby/object:Gem::Version
|
239
|
-
version: '
|
239
|
+
version: '1.1'
|
240
240
|
- - "<"
|
241
241
|
- !ruby/object:Gem::Version
|
242
242
|
version: '2.0'
|
@@ -370,7 +370,7 @@ dependencies:
|
|
370
370
|
version: '0.3'
|
371
371
|
description: Ruby client for using split SDK.
|
372
372
|
email:
|
373
|
-
-
|
373
|
+
- mauro.sanz@split.io
|
374
374
|
executables: []
|
375
375
|
extensions:
|
376
376
|
- ext/murmurhash/extconf.rb
|
@@ -382,7 +382,6 @@ files:
|
|
382
382
|
- ".gitignore"
|
383
383
|
- ".rubocop.yml"
|
384
384
|
- ".simplecov"
|
385
|
-
- Appraisals
|
386
385
|
- CHANGES.txt
|
387
386
|
- CONTRIBUTORS-GUIDE.md
|
388
387
|
- Gemfile
|
@@ -437,7 +436,6 @@ files:
|
|
437
436
|
- lib/splitclient-rb/constants.rb
|
438
437
|
- lib/splitclient-rb/engine/api/client.rb
|
439
438
|
- lib/splitclient-rb/engine/api/events.rb
|
440
|
-
- lib/splitclient-rb/engine/api/faraday_adapter/patched_net_http_persistent.rb
|
441
439
|
- lib/splitclient-rb/engine/api/faraday_middleware/gzip.rb
|
442
440
|
- lib/splitclient-rb/engine/api/impressions.rb
|
443
441
|
- lib/splitclient-rb/engine/api/segments.rb
|
@@ -540,14 +538,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
540
538
|
requirements:
|
541
539
|
- - ">="
|
542
540
|
- !ruby/object:Gem::Version
|
543
|
-
version:
|
541
|
+
version: 2.5.0
|
544
542
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
545
543
|
requirements:
|
546
544
|
- - ">"
|
547
545
|
- !ruby/object:Gem::Version
|
548
546
|
version: 1.3.1
|
549
547
|
requirements: []
|
550
|
-
rubygems_version: 3.
|
548
|
+
rubygems_version: 3.3.5
|
551
549
|
signing_key:
|
552
550
|
specification_version: 4
|
553
551
|
summary: Ruby client for split SDK.
|
data/Appraisals
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module SplitIoClient
|
4
|
-
module FaradayAdapter
|
5
|
-
class PatchedNetHttpPersistent < Faraday::Adapter::NetHttpPersistent
|
6
|
-
##
|
7
|
-
# Borrowed directly from the latest `NetHttpPersistent` adapter implementation.
|
8
|
-
#
|
9
|
-
# https://github.com/lostisland/faraday/blob/master/lib/faraday/adapter/net_http_persistent.rb
|
10
|
-
#
|
11
|
-
def net_http_connection(env)
|
12
|
-
@cached_connection ||=
|
13
|
-
if Net::HTTP::Persistent.instance_method(:initialize).parameters.first == [:key, :name]
|
14
|
-
Net::HTTP::Persistent.new(name: 'Faraday')
|
15
|
-
else
|
16
|
-
Net::HTTP::Persistent.new('Faraday')
|
17
|
-
end
|
18
|
-
|
19
|
-
proxy_uri = proxy_uri(env)
|
20
|
-
@cached_connection.proxy = proxy_uri if @cached_connection.proxy_uri != proxy_uri
|
21
|
-
@cached_connection
|
22
|
-
end
|
23
|
-
|
24
|
-
def proxy_uri(env)
|
25
|
-
proxy_uri = nil
|
26
|
-
if (proxy = env[:request][:proxy])
|
27
|
-
proxy_uri = ::URI::HTTP === proxy[:uri] ? proxy[:uri].dup : ::URI.parse(proxy[:uri].to_s)
|
28
|
-
proxy_uri.user = proxy_uri.password = nil
|
29
|
-
# awful patch for net-http-persistent 2.8 not unescaping user/password
|
30
|
-
(
|
31
|
-
class << proxy_uri;
|
32
|
-
self;
|
33
|
-
end).class_eval do
|
34
|
-
define_method(:user) { proxy[:user] }
|
35
|
-
define_method(:password) { proxy[:password] }
|
36
|
-
end if proxy[:user]
|
37
|
-
end
|
38
|
-
proxy_uri
|
39
|
-
end
|
40
|
-
|
41
|
-
def with_net_http_connection(env)
|
42
|
-
yield net_http_connection(env)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|