splitclient-rb 5.1.0.pre.rc1-java → 5.1.1-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/.gitignore +3 -0
- data/.rubocop.yml +9 -5
- data/CHANGES.txt +12 -1
- data/Detailed-README.md +1 -1
- data/NEWS +10 -2
- data/exe/splitio +6 -6
- data/lib/splitclient-rb/cache/repositories/events/memory_repository.rb +3 -4
- data/lib/splitclient-rb/cache/repositories/events/redis_repository.rb +1 -2
- data/lib/splitclient-rb/cache/repositories/events_repository.rb +6 -7
- data/lib/splitclient-rb/cache/repositories/impressions/memory_repository.rb +6 -7
- data/lib/splitclient-rb/cache/repositories/impressions/redis_repository.rb +9 -10
- data/lib/splitclient-rb/cache/repositories/impressions_repository.rb +3 -4
- data/lib/splitclient-rb/cache/repositories/metrics/memory_repository.rb +1 -3
- data/lib/splitclient-rb/cache/repositories/metrics/redis_repository.rb +1 -3
- data/lib/splitclient-rb/cache/repositories/metrics_repository.rb +3 -4
- data/lib/splitclient-rb/cache/repositories/repository.rb +2 -2
- data/lib/splitclient-rb/cache/repositories/segments_repository.rb +2 -4
- data/lib/splitclient-rb/cache/repositories/splits_repository.rb +12 -16
- data/lib/splitclient-rb/cache/routers/impression_router.rb +4 -5
- data/lib/splitclient-rb/cache/senders/events_sender.rb +6 -7
- data/lib/splitclient-rb/cache/senders/impressions_sender.rb +8 -9
- data/lib/splitclient-rb/cache/senders/metrics_sender.rb +6 -7
- data/lib/splitclient-rb/cache/stores/sdk_blocker.rb +3 -4
- data/lib/splitclient-rb/cache/stores/segment_store.rb +11 -12
- data/lib/splitclient-rb/cache/stores/split_store.rb +12 -13
- data/lib/splitclient-rb/clients/localhost_split_client.rb +2 -2
- data/lib/splitclient-rb/clients/split_client.rb +20 -19
- data/lib/splitclient-rb/engine/api/client.rb +22 -22
- data/lib/splitclient-rb/engine/api/events.rb +6 -8
- data/lib/splitclient-rb/engine/api/impressions.rb +5 -6
- data/lib/splitclient-rb/engine/api/metrics.rb +8 -9
- data/lib/splitclient-rb/engine/api/segments.rb +2 -3
- data/lib/splitclient-rb/engine/api/splits.rb +2 -3
- data/lib/splitclient-rb/engine/metrics/metrics.rb +1 -4
- data/lib/splitclient-rb/engine/parser/split_adapter.rb +8 -10
- data/lib/splitclient-rb/managers/split_manager.rb +1 -2
- data/lib/splitclient-rb/split_config.rb +47 -38
- data/lib/splitclient-rb/split_factory.rb +13 -14
- data/lib/splitclient-rb/split_logger.rb +3 -8
- data/lib/splitclient-rb/version.rb +1 -1
- data/splitclient-rb.gemspec +1 -1
- metadata +8 -8
@@ -5,39 +5,39 @@ module SplitIoClient
|
|
5
5
|
class Client
|
6
6
|
RUBY_ENCODING = '1.9'.respond_to?(:force_encoding)
|
7
7
|
|
8
|
-
def get_api(url,
|
8
|
+
def get_api(url, api_key, params = {})
|
9
9
|
api_client.get(url, params) do |req|
|
10
|
-
req.headers = common_headers(api_key
|
10
|
+
req.headers = common_headers(api_key).merge('Accept-Encoding' => 'gzip')
|
11
11
|
|
12
|
-
req.options[:timeout] =
|
13
|
-
req.options[:open_timeout] =
|
12
|
+
req.options[:timeout] = SplitIoClient.configuration.read_timeout
|
13
|
+
req.options[:open_timeout] = SplitIoClient.configuration.connection_timeout
|
14
14
|
|
15
|
-
|
15
|
+
SplitIoClient.configuration.logger.debug("GET #{url} proxy: #{api_client.proxy}") if SplitIoClient.configuration.debug_enabled
|
16
16
|
end
|
17
17
|
rescue StandardError => e
|
18
|
-
|
18
|
+
SplitIoClient.configuration.logger.warn("#{e}\nURL:#{url}\nparams:#{params}")
|
19
19
|
raise 'Split SDK failed to connect to backend to retrieve information'
|
20
20
|
end
|
21
21
|
|
22
|
-
def post_api(url,
|
22
|
+
def post_api(url, api_key, data, headers = {}, params = {})
|
23
23
|
api_client.post(url) do |req|
|
24
|
-
req.headers = common_headers(api_key
|
24
|
+
req.headers = common_headers(api_key)
|
25
25
|
.merge('Content-Type' => 'application/json')
|
26
26
|
.merge(headers)
|
27
27
|
|
28
28
|
req.body = data.to_json
|
29
29
|
|
30
|
-
req.options[:timeout] =
|
31
|
-
req.options[:open_timeout] =
|
30
|
+
req.options[:timeout] = SplitIoClient.configuration.read_timeout
|
31
|
+
req.options[:open_timeout] = SplitIoClient.configuration.connection_timeout
|
32
32
|
|
33
|
-
if
|
34
|
-
|
35
|
-
elsif
|
36
|
-
|
33
|
+
if SplitIoClient.configuration.transport_debug_enabled
|
34
|
+
SplitIoClient.configuration.logger.debug("POST #{url} #{req.body}")
|
35
|
+
elsif SplitIoClient.configuration.debug_enabled
|
36
|
+
SplitIoClient.configuration.logger.debug("POST #{url}")
|
37
37
|
end
|
38
38
|
end
|
39
39
|
rescue StandardError => e
|
40
|
-
|
40
|
+
SplitIoClient.configuration.logger.warn("#{e}\nURL:#{url}\ndata:#{data}\nparams:#{params}")
|
41
41
|
|
42
42
|
false
|
43
43
|
end
|
@@ -51,18 +51,18 @@ module SplitIoClient
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
-
def common_headers(api_key
|
54
|
+
def common_headers(api_key)
|
55
55
|
{
|
56
56
|
'Authorization' => "Bearer #{api_key}",
|
57
|
-
'SplitSDKVersion' => "#{
|
58
|
-
'SplitSDKMachineName' =>
|
59
|
-
'SplitSDKMachineIP' =>
|
60
|
-
'Referer' => referer
|
57
|
+
'SplitSDKVersion' => "#{SplitIoClient.configuration.language}-#{SplitIoClient.configuration.version}",
|
58
|
+
'SplitSDKMachineName' => SplitIoClient.configuration.machine_name,
|
59
|
+
'SplitSDKMachineIP' => SplitIoClient.configuration.machine_ip,
|
60
|
+
'Referer' => referer
|
61
61
|
}
|
62
62
|
end
|
63
63
|
|
64
|
-
def referer
|
65
|
-
result = "#{
|
64
|
+
def referer
|
65
|
+
result = "#{SplitIoClient.configuration.language}-#{SplitIoClient.configuration.version}"
|
66
66
|
|
67
67
|
result = "#{result}::#{SplitIoClient::SplitConfig.machine_hostname}" unless SplitIoClient::SplitConfig.machine_hostname == 'localhost'
|
68
68
|
|
@@ -1,22 +1,20 @@
|
|
1
1
|
module SplitIoClient
|
2
2
|
module Api
|
3
3
|
class Events < Client
|
4
|
-
def initialize(api_key,
|
5
|
-
@config = config
|
4
|
+
def initialize(api_key, events)
|
6
5
|
@api_key = api_key
|
7
6
|
@events = events
|
8
7
|
end
|
9
8
|
|
10
9
|
def post
|
11
10
|
if @events.empty?
|
12
|
-
|
11
|
+
SplitIoClient.configuration.logger.debug('No events to report') if SplitIoClient.configuration.debug_enabled
|
13
12
|
return
|
14
13
|
end
|
15
14
|
|
16
|
-
@events.each_slice(
|
15
|
+
@events.each_slice(SplitIoClient.configuration.events_queue_size) do |event_slice|
|
17
16
|
result = post_api(
|
18
|
-
"#{
|
19
|
-
@config,
|
17
|
+
"#{SplitIoClient.configuration.events_uri}/events/bulk",
|
20
18
|
@api_key,
|
21
19
|
event_slice.map { |event| formatted_event(event[:e]) },
|
22
20
|
'SplitSDKMachineIP' => event_slice[0][:m][:i],
|
@@ -25,9 +23,9 @@ module SplitIoClient
|
|
25
23
|
)
|
26
24
|
|
27
25
|
if (200..299).include? result.status
|
28
|
-
|
26
|
+
SplitIoClient.configuration.logger.debug("Events reported: #{event_slice.size}") if SplitIoClient.configuration.debug_enabled
|
29
27
|
else
|
30
|
-
|
28
|
+
SplitIoClient.configuration.logger.error("Unexpected status code while posting events: #{result.status}")
|
31
29
|
end
|
32
30
|
end
|
33
31
|
end
|
@@ -1,25 +1,24 @@
|
|
1
1
|
module SplitIoClient
|
2
2
|
module Api
|
3
3
|
class Impressions < Client
|
4
|
-
def initialize(api_key,
|
5
|
-
@config = config
|
4
|
+
def initialize(api_key, impressions)
|
6
5
|
@api_key = api_key
|
7
6
|
@impressions = impressions
|
8
7
|
end
|
9
8
|
|
10
9
|
def post
|
11
10
|
if @impressions.empty?
|
12
|
-
|
11
|
+
SplitIoClient.configuration.logger.debug('No impressions to report') if SplitIoClient.configuration.debug_enabled
|
13
12
|
return
|
14
13
|
end
|
15
14
|
|
16
15
|
impressions_by_ip.each do |ip, impressions|
|
17
|
-
result = post_api("#{
|
16
|
+
result = post_api("#{SplitIoClient.configuration.events_uri}/testImpressions/bulk", @api_key, impressions, 'SplitSDKMachineIP' => ip)
|
18
17
|
|
19
18
|
if (200..299).include? result.status
|
20
|
-
|
19
|
+
SplitIoClient.configuration.logger.debug("Impressions reported: #{total_impressions(@impressions)}") if SplitIoClient.configuration.debug_enabled
|
21
20
|
else
|
22
|
-
|
21
|
+
SplitIoClient.configuration.logger.error("Unexpected status code while posting impressions: #{result.status}")
|
23
22
|
end
|
24
23
|
end
|
25
24
|
end
|
@@ -1,8 +1,7 @@
|
|
1
1
|
module SplitIoClient
|
2
2
|
module Api
|
3
3
|
class Metrics < Client
|
4
|
-
def initialize(api_key,
|
5
|
-
@config = config
|
4
|
+
def initialize(api_key, metrics_repository)
|
6
5
|
@api_key = api_key
|
7
6
|
@metrics_repository = metrics_repository
|
8
7
|
end
|
@@ -16,12 +15,12 @@ module SplitIoClient
|
|
16
15
|
|
17
16
|
def post_latencies
|
18
17
|
if @metrics_repository.latencies.empty?
|
19
|
-
|
18
|
+
SplitIoClient.configuration.logger.debug('No latencies to report.') if SplitIoClient.configuration.debug_enabled
|
20
19
|
else
|
21
20
|
@metrics_repository.latencies.each do |name, latencies|
|
22
21
|
metrics_time = { name: name, latencies: latencies }
|
23
22
|
|
24
|
-
result = post_api("#{
|
23
|
+
result = post_api("#{SplitIoClient.configuration.events_uri}/metrics/time", @api_key, metrics_time)
|
25
24
|
|
26
25
|
log_status(result, metrics_time.size)
|
27
26
|
end
|
@@ -32,12 +31,12 @@ module SplitIoClient
|
|
32
31
|
|
33
32
|
def post_counts
|
34
33
|
if @metrics_repository.counts.empty?
|
35
|
-
|
34
|
+
SplitIoClient.configuration.logger.debug('No counts to report.') if SplitIoClient.configuration.debug_enabled
|
36
35
|
else
|
37
36
|
@metrics_repository.counts.each do |name, count|
|
38
37
|
metrics_count = { name: name, delta: count }
|
39
38
|
|
40
|
-
result = post_api("#{
|
39
|
+
result = post_api("#{SplitIoClient.configuration.events_uri}/metrics/counter", @api_key, metrics_count)
|
41
40
|
|
42
41
|
log_status(result, metrics_count.size)
|
43
42
|
end
|
@@ -49,11 +48,11 @@ module SplitIoClient
|
|
49
48
|
|
50
49
|
def log_status(result, info_to_log)
|
51
50
|
if result == false
|
52
|
-
|
51
|
+
SplitIoClient.configuration.logger.error("Failed to make a http request")
|
53
52
|
elsif (200..299).include? result.status
|
54
|
-
|
53
|
+
SplitIoClient.configuration.logger.debug("Metric time reported: #{info_to_log}") if SplitIoClient.configuration.debug_enabled
|
55
54
|
else
|
56
|
-
|
55
|
+
SplitIoClient.configuration.logger.error("Unexpected status code while posting time metrics: #{result.status}")
|
57
56
|
end
|
58
57
|
end
|
59
58
|
end
|
@@ -6,8 +6,7 @@ module SplitIoClient
|
|
6
6
|
class Segments < Client
|
7
7
|
METRICS_PREFIX = 'segmentChangeFetcher'
|
8
8
|
|
9
|
-
def initialize(api_key,
|
10
|
-
@config = config
|
9
|
+
def initialize(api_key, metrics, segments_repository)
|
11
10
|
@metrics = metrics
|
12
11
|
@api_key = api_key
|
13
12
|
@segments_repository = segments_repository
|
@@ -39,7 +38,7 @@ module SplitIoClient
|
|
39
38
|
private
|
40
39
|
|
41
40
|
def fetch_segment_changes(name, since)
|
42
|
-
response = get_api("#{
|
41
|
+
response = get_api("#{SplitIoClient.configuration.base_uri}/segmentChanges/#{name}", @api_key, since: since)
|
43
42
|
|
44
43
|
if response.success?
|
45
44
|
segment = JSON.parse(response.body, symbolize_names: true)
|
@@ -6,16 +6,15 @@ module SplitIoClient
|
|
6
6
|
class Splits < Client
|
7
7
|
METRICS_PREFIX = 'splitChangeFetcher'
|
8
8
|
|
9
|
-
def initialize(api_key,
|
9
|
+
def initialize(api_key, metrics)
|
10
10
|
@api_key = api_key
|
11
|
-
@config = config
|
12
11
|
@metrics = metrics
|
13
12
|
end
|
14
13
|
|
15
14
|
def since(since)
|
16
15
|
start = Time.now
|
17
16
|
|
18
|
-
response = get_api("#{
|
17
|
+
response = get_api("#{SplitIoClient.configuration.base_uri}/splitChanges", @api_key, since: since)
|
19
18
|
|
20
19
|
if response.success?
|
21
20
|
result = splits_with_segment_names(response.body)
|
@@ -32,12 +32,9 @@ module SplitIoClient
|
|
32
32
|
# @return [int] queue size
|
33
33
|
attr_accessor :queue_size
|
34
34
|
|
35
|
-
def initialize(queue_size,
|
35
|
+
def initialize(queue_size, repository)
|
36
36
|
@queue_size = queue_size
|
37
37
|
@binary_search = SplitIoClient::BinarySearchLatencyTracker.new
|
38
|
-
|
39
|
-
@config = config
|
40
|
-
|
41
38
|
@repository = repository
|
42
39
|
end
|
43
40
|
|
@@ -17,7 +17,6 @@ module SplitIoClient
|
|
17
17
|
# Creates a new split api adapter instance that consumes split api endpoints
|
18
18
|
#
|
19
19
|
# @param api_key [String] the API key for your split account
|
20
|
-
# @param config [SplitConfig] SplitConfig instance
|
21
20
|
# @param splits_repository [SplitsRepository] SplitsRepository instance to store splits in
|
22
21
|
# @param segments_repository [SegmentsRepository] SegmentsRepository instance to store segments in
|
23
22
|
# @param impressions_repository [ImpressionsRepository] ImpressionsRepository instance to store impressions in
|
@@ -25,18 +24,17 @@ module SplitIoClient
|
|
25
24
|
# @param sdk_blocker [SDKBlocker] SDKBlocker instance which blocks splits_repository/segments_repository
|
26
25
|
#
|
27
26
|
# @return [SplitIoClient] split.io client instance
|
28
|
-
def initialize(api_key,
|
27
|
+
def initialize(api_key, splits_repository, segments_repository, impressions_repository, metrics_repository, events_repository, sdk_blocker)
|
29
28
|
@api_key = api_key
|
30
|
-
@config = config
|
31
29
|
@splits_repository = splits_repository
|
32
30
|
@segments_repository = segments_repository
|
33
31
|
@impressions_repository = impressions_repository
|
34
32
|
@metrics_repository = metrics_repository
|
35
33
|
@events_repository = events_repository
|
36
|
-
@metrics = Metrics.new(100, @
|
34
|
+
@metrics = Metrics.new(100, @metrics_repository)
|
37
35
|
@sdk_blocker = sdk_blocker
|
38
36
|
|
39
|
-
start_based_on_mode(
|
37
|
+
start_based_on_mode(SplitIoClient.configuration.mode)
|
40
38
|
end
|
41
39
|
|
42
40
|
def start_based_on_mode(mode)
|
@@ -62,27 +60,27 @@ module SplitIoClient
|
|
62
60
|
|
63
61
|
# Starts thread which loops constantly and stores splits in the splits_repository of choice
|
64
62
|
def split_store
|
65
|
-
SplitStore.new(@splits_repository, @
|
63
|
+
SplitStore.new(@splits_repository, @api_key, @metrics, @sdk_blocker).call
|
66
64
|
end
|
67
65
|
|
68
66
|
# Starts thread which loops constantly and stores segments in the segments_repository of choice
|
69
67
|
def segment_store
|
70
|
-
SegmentStore.new(@segments_repository, @
|
68
|
+
SegmentStore.new(@segments_repository, @api_key, @metrics, @sdk_blocker).call
|
71
69
|
end
|
72
70
|
|
73
71
|
# Starts thread which loops constantly and sends impressions to the Split API
|
74
72
|
def impressions_sender
|
75
|
-
ImpressionsSender.new(@impressions_repository, @
|
73
|
+
ImpressionsSender.new(@impressions_repository, @api_key).call
|
76
74
|
end
|
77
75
|
|
78
76
|
# Starts thread which loops constantly and sends metrics to the Split API
|
79
77
|
def metrics_sender
|
80
|
-
MetricsSender.new(@metrics_repository, @
|
78
|
+
MetricsSender.new(@metrics_repository, @api_key).call
|
81
79
|
end
|
82
80
|
|
83
81
|
# Starts thread which loops constantly and sends events to the Split API
|
84
82
|
def events_sender
|
85
|
-
EventsSender.new(@events_repository, @
|
83
|
+
EventsSender.new(@events_repository, @api_key).call
|
86
84
|
end
|
87
85
|
end
|
88
86
|
end
|
@@ -6,9 +6,8 @@ module SplitIoClient
|
|
6
6
|
# @param api_key [String] the API key for your split account
|
7
7
|
#
|
8
8
|
# @return [SplitIoManager] split.io client instance
|
9
|
-
def initialize(api_key,
|
9
|
+
def initialize(api_key, adapter = nil, splits_repository = nil)
|
10
10
|
@localhost_mode_features = []
|
11
|
-
@config = config
|
12
11
|
@splits_repository = splits_repository
|
13
12
|
@adapter = adapter
|
14
13
|
end
|
@@ -2,6 +2,15 @@ require 'logger'
|
|
2
2
|
require 'socket'
|
3
3
|
|
4
4
|
module SplitIoClient
|
5
|
+
|
6
|
+
class << self
|
7
|
+
attr_accessor :configuration
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.configure(opts={})
|
11
|
+
self.configuration ||= SplitConfig.new(opts)
|
12
|
+
end
|
13
|
+
|
5
14
|
#
|
6
15
|
# This class manages configuration options for the split client library.
|
7
16
|
# If not custom configuration is required the default configuration values will be used
|
@@ -32,7 +41,7 @@ module SplitIoClient
|
|
32
41
|
@redis_url = opts[:redis_url] || SplitConfig.default_redis_url
|
33
42
|
@redis_namespace = opts[:redis_namespace] ? "#{opts[:redis_namespace]}.#{SplitConfig.default_redis_namespace}" : SplitConfig.default_redis_namespace
|
34
43
|
@cache_adapter = SplitConfig.init_cache_adapter(
|
35
|
-
opts[:cache_adapter] || SplitConfig.default_cache_adapter, :map_adapter
|
44
|
+
opts[:cache_adapter] || SplitConfig.default_cache_adapter, :map_adapter
|
36
45
|
)
|
37
46
|
@connection_timeout = opts[:connection_timeout] || SplitConfig.default_connection_timeout
|
38
47
|
@read_timeout = opts[:read_timeout] || SplitConfig.default_read_timeout
|
@@ -43,7 +52,7 @@ module SplitIoClient
|
|
43
52
|
@impressions_refresh_rate = opts[:impressions_refresh_rate] || SplitConfig.default_impressions_refresh_rate
|
44
53
|
@impressions_queue_size = opts[:impressions_queue_size] || SplitConfig.default_impressions_queue_size
|
45
54
|
@impressions_adapter = SplitConfig.init_cache_adapter(
|
46
|
-
opts[:cache_adapter] || SplitConfig.default_cache_adapter, :queue_adapter, @
|
55
|
+
opts[:cache_adapter] || SplitConfig.default_cache_adapter, :queue_adapter, @impressions_queue_size
|
47
56
|
)
|
48
57
|
#Safeguard for users of older SDK versions.
|
49
58
|
@disable_impressions = @impressions_queue_size == -1
|
@@ -51,7 +60,7 @@ module SplitIoClient
|
|
51
60
|
@impressions_bulk_size = opts[:impressions_bulk_size] || @impressions_queue_size > 0 ? @impressions_queue_size : 0
|
52
61
|
|
53
62
|
@metrics_adapter = SplitConfig.init_cache_adapter(
|
54
|
-
opts[:cache_adapter] || SplitConfig.default_cache_adapter, :map_adapter
|
63
|
+
opts[:cache_adapter] || SplitConfig.default_cache_adapter, :map_adapter
|
55
64
|
)
|
56
65
|
|
57
66
|
@logger = opts[:logger] || SplitConfig.default_logger
|
@@ -74,9 +83,9 @@ module SplitIoClient
|
|
74
83
|
@events_push_rate = opts[:events_push_rate] || SplitConfig.default_events_push_rate
|
75
84
|
@events_queue_size = opts[:events_queue_size] || SplitConfig.default_events_queue_size
|
76
85
|
@events_adapter = SplitConfig.init_cache_adapter(
|
77
|
-
opts[:cache_adapter] || SplitConfig.default_cache_adapter, :queue_adapter, @
|
86
|
+
opts[:cache_adapter] || SplitConfig.default_cache_adapter, :queue_adapter, @events_queue_size
|
78
87
|
)
|
79
|
-
|
88
|
+
|
80
89
|
startup_log
|
81
90
|
end
|
82
91
|
|
@@ -84,110 +93,110 @@ module SplitIoClient
|
|
84
93
|
# The base URL for split API end points
|
85
94
|
#
|
86
95
|
# @return [String] The configured base URL for the split API end points
|
87
|
-
|
96
|
+
attr_accessor :base_uri
|
88
97
|
|
89
98
|
#
|
90
99
|
# The base URL for split events API end points
|
91
100
|
#
|
92
101
|
# @return [String] The configured URL for the events API end points
|
93
|
-
|
102
|
+
attr_accessor :events_uri
|
94
103
|
|
95
104
|
#
|
96
105
|
# The mode SDK will run
|
97
106
|
#
|
98
107
|
# @return [Symbol] One of the available SDK modes: standalone, consumer, producer
|
99
|
-
|
108
|
+
attr_accessor :mode
|
100
109
|
|
101
110
|
# The read timeout for network connections in seconds.
|
102
111
|
#
|
103
112
|
# @return [Int] The timeout in seconds.
|
104
|
-
|
113
|
+
attr_accessor :read_timeout
|
105
114
|
|
106
115
|
#
|
107
116
|
# The cache adapter to store splits/segments in
|
108
117
|
#
|
109
118
|
# @return [Object] Cache adapter instance
|
110
|
-
|
119
|
+
attr_accessor :cache_adapter
|
111
120
|
|
112
121
|
#
|
113
122
|
# The cache adapter to store impressions in
|
114
123
|
#
|
115
124
|
# @return [Object] Impressions adapter instance
|
116
|
-
|
125
|
+
attr_accessor :impressions_adapter
|
117
126
|
|
118
127
|
#
|
119
128
|
# The cache adapter to store metrics in
|
120
129
|
#
|
121
130
|
# @return [Symbol] Metrics adapter
|
122
|
-
|
131
|
+
attr_accessor :metrics_adapter
|
123
132
|
|
124
133
|
#
|
125
134
|
# The cache adapter to store events in
|
126
135
|
#
|
127
136
|
# @return [Object] Metrics adapter
|
128
|
-
|
137
|
+
attr_accessor :events_adapter
|
129
138
|
|
130
139
|
#
|
131
140
|
# The connection timeout for network connections in seconds.
|
132
141
|
#
|
133
142
|
# @return [Int] The connect timeout in seconds.
|
134
|
-
|
143
|
+
attr_accessor :connection_timeout
|
135
144
|
|
136
145
|
#
|
137
146
|
# The configured logger. The client library uses the log to
|
138
147
|
# print warning and error messages.
|
139
148
|
#
|
140
149
|
# @return [Logger] The configured logger
|
141
|
-
|
150
|
+
attr_accessor :logger
|
142
151
|
|
143
152
|
#
|
144
153
|
# The boolean that represents the state of the debug log level
|
145
154
|
#
|
146
155
|
# @return [Boolean] The value for the debug flag
|
147
|
-
|
156
|
+
attr_accessor :debug_enabled
|
148
157
|
|
149
158
|
#
|
150
159
|
# Enable to log the content retrieved from endpoints
|
151
160
|
#
|
152
161
|
# @return [Boolean] The value for the debug flag
|
153
|
-
|
162
|
+
attr_accessor :transport_debug_enabled
|
154
163
|
|
155
164
|
#
|
156
165
|
# Enable logging labels and sending potentially sensitive information
|
157
166
|
#
|
158
167
|
# @return [Boolean] The value for the labels enabled flag
|
159
|
-
|
168
|
+
attr_accessor :labels_enabled
|
160
169
|
|
161
170
|
#
|
162
171
|
# The number of seconds to wait for SDK readiness
|
163
172
|
# or false to disable waiting
|
164
173
|
# @return [Integer]/[FalseClass]
|
165
|
-
|
174
|
+
attr_accessor :block_until_ready
|
166
175
|
|
167
|
-
|
168
|
-
|
176
|
+
attr_accessor :machine_ip
|
177
|
+
attr_accessor :machine_name
|
169
178
|
|
170
|
-
|
171
|
-
|
179
|
+
attr_accessor :language
|
180
|
+
attr_accessor :version
|
172
181
|
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
182
|
+
attr_accessor :features_refresh_rate
|
183
|
+
attr_accessor :segments_refresh_rate
|
184
|
+
attr_accessor :metrics_refresh_rate
|
185
|
+
attr_accessor :impressions_refresh_rate
|
177
186
|
|
178
|
-
|
179
|
-
|
187
|
+
attr_accessor :impression_listener
|
188
|
+
attr_accessor :impression_listener_refresh_rate
|
180
189
|
|
181
190
|
#
|
182
191
|
# How big the impressions queue is before dropping impressions. -1 to disable it.
|
183
192
|
#
|
184
193
|
# @return [Integer]
|
185
|
-
|
186
|
-
|
187
|
-
|
194
|
+
attr_accessor :impressions_queue_size
|
195
|
+
attr_accessor :impressions_bulk_size
|
196
|
+
attr_accessor :disable_impressions
|
188
197
|
|
189
|
-
|
190
|
-
|
198
|
+
attr_accessor :redis_url
|
199
|
+
attr_accessor :redis_namespace
|
191
200
|
|
192
201
|
attr_accessor :threads
|
193
202
|
|
@@ -195,13 +204,13 @@ module SplitIoClient
|
|
195
204
|
# The schedule time for events flush after the first one
|
196
205
|
#
|
197
206
|
# @return [Integer]
|
198
|
-
|
207
|
+
attr_accessor :events_push_rate
|
199
208
|
|
200
209
|
#
|
201
210
|
# The max size of the events queue
|
202
211
|
#
|
203
212
|
# @return [Integer]
|
204
|
-
|
213
|
+
attr_accessor :events_queue_size
|
205
214
|
|
206
215
|
#
|
207
216
|
# The default split client configuration
|
@@ -223,7 +232,7 @@ module SplitIoClient
|
|
223
232
|
'https://events.split.io/api/'
|
224
233
|
end
|
225
234
|
|
226
|
-
def self.init_cache_adapter(adapter, data_structure,
|
235
|
+
def self.init_cache_adapter(adapter, data_structure, queue_size = nil)
|
227
236
|
case adapter
|
228
237
|
when :memory
|
229
238
|
SplitIoClient::Cache::Adapters::MemoryAdapter.new(map_memory_adapter(data_structure, queue_size))
|
@@ -234,7 +243,7 @@ module SplitIoClient
|
|
234
243
|
fail StandardError, 'To use Redis as a cache adapter you must include it in your Gemfile'
|
235
244
|
end
|
236
245
|
|
237
|
-
SplitIoClient::Cache::Adapters::RedisAdapter.new(redis_url)
|
246
|
+
SplitIoClient::Cache::Adapters::RedisAdapter.new(@redis_url)
|
238
247
|
end
|
239
248
|
end
|
240
249
|
|