splitclient-rb 8.0.0.pre.rc1 → 8.0.1.pre.rc1
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 +6 -2
- data/.rubocop.yml +18 -14
- data/CHANGES.txt +7 -0
- data/README.md +2 -2
- 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 +4 -4
- data/lib/splitclient-rb/cache/senders/impressions_adapter/redis_sender.rb +2 -2
- data/lib/splitclient-rb/cache/senders/impressions_count_sender.rb +2 -2
- 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 +11 -3
- 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/synchronizer.rb +4 -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 +1 -1
- data/lib/splitclient-rb/telemetry/redis/redis_synchronizer.rb +3 -3
- data/lib/splitclient-rb/version.rb +1 -1
- data/splitclient-rb.gemspec +3 -2
- metadata +27 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2469dedb4a796b39fc9695a40437a7e98a6f232496e9a39b804d8778652e8b31
|
4
|
+
data.tar.gz: 29e87d0fc1160a6ada97a6bb8152e6cc748049a20c99a4311f7f2a7db6aba9ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44862f64bdec2cdd7f9d100b2046066949c890810514711ded074752b23b0bb9bd988e1aed3205c86c4f02371afe2bfe73f6de9b0073c0d33ffbc63f1841d10b
|
7
|
+
data.tar.gz: 99416fa4f265da3c683041d951ac188170124675bccda3253af560954b8c159ec7ed362ec6b945619be24db150619c11d14c488dd55d4924a695d8ca50da5a05
|
data/.github/workflows/ci.yml
CHANGED
@@ -8,16 +8,20 @@ jobs:
|
|
8
8
|
image: redis
|
9
9
|
ports:
|
10
10
|
- 6379:6379
|
11
|
+
strategy:
|
12
|
+
matrix:
|
13
|
+
ruby: [ '2.5.0', '3.1.1' ]
|
14
|
+
|
11
15
|
steps:
|
12
16
|
- name: Checkout code
|
13
17
|
uses: actions/checkout@v2
|
14
18
|
with:
|
15
19
|
fetch-depth: 0
|
16
20
|
|
17
|
-
- name: Set up Ruby
|
21
|
+
- name: Set up Ruby ${{ matrix.ruby }}
|
18
22
|
uses: ruby/setup-ruby@v1
|
19
23
|
with:
|
20
|
-
ruby-version:
|
24
|
+
ruby-version: ${{ matrix.ruby }}
|
21
25
|
|
22
26
|
- name: Install dependencies
|
23
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,6 +37,22 @@ 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
57
|
TargetRubyVersion: 2.5
|
56
58
|
Exclude:
|
@@ -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/CHANGES.txt
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
CHANGES
|
2
2
|
|
3
|
+
8.0.0 (May 10, 2022)
|
4
|
+
- BREAKING CHANGE: Deprecated support for ruby 2.3 and 2.4 versions. The minimum ruby version required is 2.5 now.
|
5
|
+
- Updated redis command for config telemetry, using hset instead of rpush now.
|
6
|
+
- Updated dependencies:
|
7
|
+
- rake to ~> 13.0
|
8
|
+
- faraday to >= 1.1, < 2.0
|
9
|
+
|
3
10
|
7.3.4 (Feb 21, 2022)
|
4
11
|
- Updated streaming events architecture with a new queue logic.
|
5
12
|
- Fixed redis integration Pipelining command deprecation warning.
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Split SDK for Ruby
|
2
|
-
|
2
|
+
![Build Status](https://github.com/splitio/ruby-client/actions/workflows/ci.yml/badge.svg?branch=master)
|
3
3
|
|
4
4
|
## Overview
|
5
5
|
This SDK is designed to work with Split, the platform for controlled rollouts, which serves features to your users via a Split feature flag to manage your complete customer experience.
|
@@ -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
|
@@ -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
|
@@ -40,8 +40,8 @@ module SplitIoClient
|
|
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
|
@@ -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
|
|
@@ -3,10 +3,10 @@
|
|
3
3
|
module SplitIoClient
|
4
4
|
module Api
|
5
5
|
class Client
|
6
|
-
RUBY_ENCODING = '1.9'.respond_to?(:force_encoding)
|
7
|
-
|
8
6
|
def initialize(config)
|
9
|
-
@config = config
|
7
|
+
@config = config
|
8
|
+
|
9
|
+
check_faraday_compatibility
|
10
10
|
end
|
11
11
|
|
12
12
|
def get_api(url, api_key, params = {}, cache_control_headers = false)
|
@@ -64,6 +64,14 @@ module SplitIoClient
|
|
64
64
|
'SplitSDKVersion' => "#{@config.language}-#{@config.version}",
|
65
65
|
}
|
66
66
|
end
|
67
|
+
|
68
|
+
def check_faraday_compatibility
|
69
|
+
version = Faraday::VERSION.split('.')[0]
|
70
|
+
|
71
|
+
require 'faraday/net_http_persistent' if version.to_i >= 2
|
72
|
+
rescue StandardError => e
|
73
|
+
@config.logger.warn(e)
|
74
|
+
end
|
67
75
|
end
|
68
76
|
end
|
69
77
|
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 \
|
@@ -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
|
@@ -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 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
|
data/splitclient-rb.gemspec
CHANGED
@@ -42,7 +42,7 @@ Gem::Specification.new do |spec|
|
|
42
42
|
spec.add_development_dependency 'rake', '~> 13.0'
|
43
43
|
spec.add_development_dependency 'rake-compiler', '~> 1.1'
|
44
44
|
spec.add_development_dependency 'rspec', '~> 3.10'
|
45
|
-
spec.add_development_dependency 'rubocop', '
|
45
|
+
spec.add_development_dependency 'rubocop', '1.28.2'
|
46
46
|
spec.add_development_dependency 'simplecov', '~> 0.20'
|
47
47
|
spec.add_development_dependency 'simplecov-json', '~> 0.2'
|
48
48
|
spec.add_development_dependency 'timecop', '~> 0.9'
|
@@ -51,7 +51,8 @@ Gem::Specification.new do |spec|
|
|
51
51
|
|
52
52
|
spec.add_runtime_dependency 'bitarray', '~> 1.3'
|
53
53
|
spec.add_runtime_dependency 'concurrent-ruby', '~> 1.0'
|
54
|
-
spec.add_runtime_dependency 'faraday', '>= 1.1', '<
|
54
|
+
spec.add_runtime_dependency 'faraday', '>= 1.1', '< 3.0'
|
55
|
+
spec.add_runtime_dependency 'faraday-net_http_persistent', '>= 1.0', '< 3.0'
|
55
56
|
spec.add_runtime_dependency 'json', '>= 1.8', '< 3.0'
|
56
57
|
spec.add_runtime_dependency 'jwt', '>= 1.0.0', '< 3.0'
|
57
58
|
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: 8.0.
|
4
|
+
version: 8.0.1.pre.rc1
|
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-05
|
11
|
+
date: 2022-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: allocation_stats
|
@@ -114,14 +114,14 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - '='
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
117
|
+
version: 1.28.2
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - '='
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
124
|
+
version: 1.28.2
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: simplecov
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -229,7 +229,7 @@ dependencies:
|
|
229
229
|
version: '1.1'
|
230
230
|
- - "<"
|
231
231
|
- !ruby/object:Gem::Version
|
232
|
-
version: '
|
232
|
+
version: '3.0'
|
233
233
|
type: :runtime
|
234
234
|
prerelease: false
|
235
235
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -239,7 +239,27 @@ dependencies:
|
|
239
239
|
version: '1.1'
|
240
240
|
- - "<"
|
241
241
|
- !ruby/object:Gem::Version
|
242
|
-
version: '
|
242
|
+
version: '3.0'
|
243
|
+
- !ruby/object:Gem::Dependency
|
244
|
+
name: faraday-net_http_persistent
|
245
|
+
requirement: !ruby/object:Gem::Requirement
|
246
|
+
requirements:
|
247
|
+
- - ">="
|
248
|
+
- !ruby/object:Gem::Version
|
249
|
+
version: '1.0'
|
250
|
+
- - "<"
|
251
|
+
- !ruby/object:Gem::Version
|
252
|
+
version: '3.0'
|
253
|
+
type: :runtime
|
254
|
+
prerelease: false
|
255
|
+
version_requirements: !ruby/object:Gem::Requirement
|
256
|
+
requirements:
|
257
|
+
- - ">="
|
258
|
+
- !ruby/object:Gem::Version
|
259
|
+
version: '1.0'
|
260
|
+
- - "<"
|
261
|
+
- !ruby/object:Gem::Version
|
262
|
+
version: '3.0'
|
243
263
|
- !ruby/object:Gem::Dependency
|
244
264
|
name: json
|
245
265
|
requirement: !ruby/object:Gem::Requirement
|
@@ -545,7 +565,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
545
565
|
- !ruby/object:Gem::Version
|
546
566
|
version: 1.3.1
|
547
567
|
requirements: []
|
548
|
-
rubygems_version: 3.3
|
568
|
+
rubygems_version: 3.2.3
|
549
569
|
signing_key:
|
550
570
|
specification_version: 4
|
551
571
|
summary: Ruby client for split SDK.
|