splitclient-rb 7.2.3-java → 7.3.0.pre.rc3-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +12 -0
- data/lib/splitclient-rb.rb +24 -9
- data/lib/splitclient-rb/cache/adapters/redis_adapter.rb +4 -0
- data/lib/splitclient-rb/cache/fetchers/segment_fetcher.rb +13 -9
- data/lib/splitclient-rb/cache/fetchers/split_fetcher.rb +8 -7
- data/lib/splitclient-rb/cache/repositories/events/memory_repository.rb +6 -3
- data/lib/splitclient-rb/cache/repositories/events_repository.rb +4 -3
- data/lib/splitclient-rb/cache/repositories/impressions/memory_repository.rb +8 -0
- data/lib/splitclient-rb/cache/repositories/impressions/redis_repository.rb +2 -0
- data/lib/splitclient-rb/cache/repositories/repository.rb +0 -4
- data/lib/splitclient-rb/cache/repositories/segments_repository.rb +20 -0
- data/lib/splitclient-rb/cache/repositories/splits_repository.rb +4 -0
- data/lib/splitclient-rb/cache/senders/localhost_repo_cleaner.rb +1 -3
- data/lib/splitclient-rb/cache/stores/sdk_blocker.rb +9 -0
- data/lib/splitclient-rb/clients/split_client.rb +59 -25
- data/lib/splitclient-rb/engine/api/client.rb +3 -2
- data/lib/splitclient-rb/engine/api/events.rb +10 -1
- data/lib/splitclient-rb/engine/api/impressions.rb +19 -2
- data/lib/splitclient-rb/engine/api/segments.rb +20 -18
- data/lib/splitclient-rb/engine/api/splits.rb +10 -10
- data/lib/splitclient-rb/engine/api/telemetry_api.rb +39 -0
- data/lib/splitclient-rb/engine/auth_api_client.rb +21 -8
- data/lib/splitclient-rb/engine/common/impressions_manager.rb +27 -3
- data/lib/splitclient-rb/engine/metrics/binary_search_latency_tracker.rb +3 -65
- data/lib/splitclient-rb/engine/push_manager.rb +10 -2
- data/lib/splitclient-rb/engine/sync_manager.rb +42 -20
- data/lib/splitclient-rb/engine/synchronizer.rb +13 -12
- data/lib/splitclient-rb/split_config.rb +46 -21
- data/lib/splitclient-rb/split_factory.rb +31 -13
- data/lib/splitclient-rb/split_factory_registry.rb +12 -0
- data/lib/splitclient-rb/sse/event_source/client.rb +10 -1
- data/lib/splitclient-rb/sse/notification_manager_keeper.rb +17 -3
- data/lib/splitclient-rb/sse/sse_handler.rb +10 -6
- data/lib/splitclient-rb/telemetry/domain/constants.rb +42 -0
- data/lib/splitclient-rb/telemetry/domain/structs.rb +31 -0
- data/lib/splitclient-rb/telemetry/evaluation_consumer.rb +14 -0
- data/lib/splitclient-rb/telemetry/evaluation_producer.rb +21 -0
- data/lib/splitclient-rb/telemetry/init_consumer.rb +14 -0
- data/lib/splitclient-rb/telemetry/init_producer.rb +19 -0
- data/lib/splitclient-rb/telemetry/memory/memory_evaluation_consumer.rb +32 -0
- data/lib/splitclient-rb/telemetry/memory/memory_evaluation_producer.rb +24 -0
- data/lib/splitclient-rb/telemetry/memory/memory_init_consumer.rb +28 -0
- data/lib/splitclient-rb/telemetry/memory/memory_init_producer.rb +34 -0
- data/lib/splitclient-rb/telemetry/memory/memory_runtime_consumer.rb +112 -0
- data/lib/splitclient-rb/telemetry/memory/memory_runtime_producer.rb +81 -0
- data/lib/splitclient-rb/telemetry/memory/memory_synchronizer.rb +192 -0
- data/lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb +38 -0
- data/lib/splitclient-rb/telemetry/redis/redis_init_producer.rb +37 -0
- data/lib/splitclient-rb/telemetry/redis/redis_synchronizer.rb +28 -0
- data/lib/splitclient-rb/telemetry/runtime_consumer.rb +24 -0
- data/lib/splitclient-rb/telemetry/runtime_producer.rb +24 -0
- data/lib/splitclient-rb/telemetry/storages/memory.rb +139 -0
- data/lib/splitclient-rb/telemetry/sync_task.rb +38 -0
- data/lib/splitclient-rb/telemetry/synchronizer.rb +29 -0
- data/lib/splitclient-rb/version.rb +1 -1
- metadata +26 -11
- data/lib/splitclient-rb/cache/repositories/metrics/memory_repository.rb +0 -163
- data/lib/splitclient-rb/cache/repositories/metrics/redis_repository.rb +0 -131
- data/lib/splitclient-rb/cache/repositories/metrics_repository.rb +0 -23
- data/lib/splitclient-rb/cache/senders/metrics_sender.rb +0 -55
- data/lib/splitclient-rb/engine/api/metrics.rb +0 -61
- data/lib/splitclient-rb/engine/metrics/metrics.rb +0 -80
- data/lib/splitclient-rb/redis_metrics_fixer.rb +0 -36
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SplitIoClient
|
4
|
+
module Telemetry
|
5
|
+
class RedisInitProducer < InitProducer
|
6
|
+
def initialize(config)
|
7
|
+
@config = config
|
8
|
+
@adapter = config.telemetry_adapter
|
9
|
+
end
|
10
|
+
|
11
|
+
def record_config(config_data)
|
12
|
+
return if config_data.nil?
|
13
|
+
|
14
|
+
data = { m: { i: @config.machine_ip, n: @config.machine_name, s: "#{@config.language}-#{@config.version}" },
|
15
|
+
t: { oM: config_data.om, st: config_data.st, aF: config_data.af, rF: config_data.rf, t: config_data.t } }
|
16
|
+
|
17
|
+
@adapter.add_to_queue(config_key, data.to_json)
|
18
|
+
rescue StandardError => error
|
19
|
+
@config.log_found_exception(__method__.to_s, error)
|
20
|
+
end
|
21
|
+
|
22
|
+
def record_bur_timeout
|
23
|
+
# no-op
|
24
|
+
end
|
25
|
+
|
26
|
+
def record_non_ready_usages
|
27
|
+
# no-op
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def config_key
|
33
|
+
"#{@config.redis_namespace}.telemetry.config"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SplitIoClient
|
4
|
+
module Telemetry
|
5
|
+
class RedisSynchronizer < Synchronizer
|
6
|
+
def initialize(config,
|
7
|
+
telemetry_init_producer)
|
8
|
+
@config = config
|
9
|
+
@telemetry_init_producer = telemetry_init_producer
|
10
|
+
end
|
11
|
+
|
12
|
+
def synchronize_stats
|
13
|
+
# No-op
|
14
|
+
end
|
15
|
+
|
16
|
+
def synchronize_config(active_factories = nil, redundant_active_factories = nil, tags = nil)
|
17
|
+
active_factories ||= SplitIoClient.split_factory_registry.active_factories
|
18
|
+
redundant_active_factories ||= SplitIoClient.split_factory_registry.redundant_active_factories
|
19
|
+
|
20
|
+
init_config = ConfigInit.new(@config.mode, 'redis', active_factories, redundant_active_factories, tags)
|
21
|
+
|
22
|
+
@telemetry_init_producer.record_config(init_config)
|
23
|
+
rescue StandardError => error
|
24
|
+
@config.log_found_exception(__method__.to_s, error)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SplitIoClient
|
4
|
+
module Telemetry
|
5
|
+
class RuntimeConsumer
|
6
|
+
extend Forwardable
|
7
|
+
def_delegators :@runtime,
|
8
|
+
:pop_tags,
|
9
|
+
:impressions_stats,
|
10
|
+
:events_stats,
|
11
|
+
:last_synchronizations,
|
12
|
+
:pop_http_errors,
|
13
|
+
:pop_http_latencies,
|
14
|
+
:pop_auth_rejections,
|
15
|
+
:pop_token_refreshes,
|
16
|
+
:pop_streaming_events,
|
17
|
+
:session_length
|
18
|
+
|
19
|
+
def initialize(config)
|
20
|
+
@runtime = SplitIoClient::Telemetry::MemoryRuntimeConsumer.new(config)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SplitIoClient
|
4
|
+
module Telemetry
|
5
|
+
class RuntimeProducer
|
6
|
+
extend Forwardable
|
7
|
+
def_delegators :@runtime,
|
8
|
+
:add_tag,
|
9
|
+
:record_impressions_stats,
|
10
|
+
:record_events_stats,
|
11
|
+
:record_successful_sync,
|
12
|
+
:record_sync_error,
|
13
|
+
:record_sync_latency,
|
14
|
+
:record_auth_rejections,
|
15
|
+
:record_token_refreshes,
|
16
|
+
:record_streaming_event,
|
17
|
+
:record_session_length
|
18
|
+
|
19
|
+
def initialize(config)
|
20
|
+
@runtime = SplitIoClient::Telemetry::MemoryRuntimeProducer.new(config)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,139 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SplitIoClient
|
4
|
+
module Telemetry
|
5
|
+
module Storages
|
6
|
+
class Memory
|
7
|
+
attr_reader :latencies,
|
8
|
+
:exceptions,
|
9
|
+
:factory_counters,
|
10
|
+
:tags,
|
11
|
+
:impressions_data_records,
|
12
|
+
:events_data_records,
|
13
|
+
:last_synchronization,
|
14
|
+
:http_errors,
|
15
|
+
:http_latencies,
|
16
|
+
:auth_rejections,
|
17
|
+
:token_refreshes,
|
18
|
+
:streaming_events,
|
19
|
+
:session_length
|
20
|
+
|
21
|
+
def initialize
|
22
|
+
init_latencies
|
23
|
+
init_exceptions
|
24
|
+
init_factory_counters
|
25
|
+
init_impressions_data_records
|
26
|
+
init_events_data_records
|
27
|
+
init_last_synchronization
|
28
|
+
init_http_errors
|
29
|
+
init_http_latencies
|
30
|
+
init_auth_rejections
|
31
|
+
init_token_refreshes
|
32
|
+
init_streaming_events
|
33
|
+
init_session_length
|
34
|
+
init_tags
|
35
|
+
end
|
36
|
+
|
37
|
+
def init_latencies
|
38
|
+
@latencies = Concurrent::Array.new
|
39
|
+
|
40
|
+
array_size = BinarySearchLatencyTracker::BUCKETS.length
|
41
|
+
@latencies << { method: Domain::Constants::TREATMENT, latencies: Concurrent::Array.new(array_size, 0) }
|
42
|
+
@latencies << { method: Domain::Constants::TREATMENTS, latencies: Concurrent::Array.new(array_size, 0) }
|
43
|
+
@latencies << { method: Domain::Constants::TREATMENT_WITH_CONFIG, latencies: Concurrent::Array.new(array_size, 0) }
|
44
|
+
@latencies << { method: Domain::Constants::TREATMENTS_WITH_CONFIG, latencies: Concurrent::Array.new(array_size, 0) }
|
45
|
+
@latencies << { method: Domain::Constants::TRACK, latencies: Concurrent::Array.new(array_size, 0) }
|
46
|
+
end
|
47
|
+
|
48
|
+
def init_exceptions
|
49
|
+
@exceptions = Concurrent::Array.new
|
50
|
+
|
51
|
+
@exceptions << { method: Domain::Constants::TREATMENT, exceptions: Concurrent::AtomicFixnum.new(0) }
|
52
|
+
@exceptions << { method: Domain::Constants::TREATMENTS, exceptions: Concurrent::AtomicFixnum.new(0) }
|
53
|
+
@exceptions << { method: Domain::Constants::TREATMENT_WITH_CONFIG, exceptions: Concurrent::AtomicFixnum.new(0) }
|
54
|
+
@exceptions << { method: Domain::Constants::TREATMENTS_WITH_CONFIG, exceptions: Concurrent::AtomicFixnum.new(0) }
|
55
|
+
@exceptions << { method: Domain::Constants::TRACK, exceptions: Concurrent::AtomicFixnum.new(0) }
|
56
|
+
end
|
57
|
+
|
58
|
+
def init_factory_counters
|
59
|
+
@factory_counters = Concurrent::Array.new
|
60
|
+
|
61
|
+
@factory_counters << { action: Domain::Constants::BUR_TIMEOUT, counts: Concurrent::AtomicFixnum.new(0) }
|
62
|
+
@factory_counters << { action: Domain::Constants::NON_READY_USAGES, counts: Concurrent::AtomicFixnum.new(0) }
|
63
|
+
end
|
64
|
+
|
65
|
+
def init_impressions_data_records
|
66
|
+
@impressions_data_records = Concurrent::Array.new
|
67
|
+
|
68
|
+
@impressions_data_records << { type: Domain::Constants::IMPRESSIONS_DEDUPE, value: Concurrent::AtomicFixnum.new(0) }
|
69
|
+
@impressions_data_records << { type: Domain::Constants::IMPRESSIONS_DROPPED, value: Concurrent::AtomicFixnum.new(0) }
|
70
|
+
@impressions_data_records << { type: Domain::Constants::IMPRESSIONS_QUEUED, value: Concurrent::AtomicFixnum.new(0) }
|
71
|
+
end
|
72
|
+
|
73
|
+
def init_events_data_records
|
74
|
+
@events_data_records = Concurrent::Array.new
|
75
|
+
|
76
|
+
@events_data_records << { type: Domain::Constants::EVENTS_DROPPED, value: Concurrent::AtomicFixnum.new(0) }
|
77
|
+
@events_data_records << { type: Domain::Constants::EVENTS_QUEUED, value: Concurrent::AtomicFixnum.new(0) }
|
78
|
+
end
|
79
|
+
|
80
|
+
def init_last_synchronization
|
81
|
+
@last_synchronization = Concurrent::Array.new
|
82
|
+
|
83
|
+
@last_synchronization << { type: Domain::Constants::SPLIT_SYNC, value: Concurrent::AtomicFixnum.new(0) }
|
84
|
+
@last_synchronization << { type: Domain::Constants::SEGMENT_SYNC, value: Concurrent::AtomicFixnum.new(0) }
|
85
|
+
@last_synchronization << { type: Domain::Constants::EVENT_SYNC, value: Concurrent::AtomicFixnum.new(0) }
|
86
|
+
@last_synchronization << { type: Domain::Constants::IMPRESSION_COUNT_SYNC, value: Concurrent::AtomicFixnum.new(0) }
|
87
|
+
@last_synchronization << { type: Domain::Constants::IMPRESSIONS_SYNC, value: Concurrent::AtomicFixnum.new(0) }
|
88
|
+
@last_synchronization << { type: Domain::Constants::TELEMETRY_SYNC, value: Concurrent::AtomicFixnum.new(0) }
|
89
|
+
@last_synchronization << { type: Domain::Constants::TOKEN_SYNC, value: Concurrent::AtomicFixnum.new(0) }
|
90
|
+
end
|
91
|
+
|
92
|
+
def init_tags
|
93
|
+
@tags = Concurrent::Array.new
|
94
|
+
end
|
95
|
+
|
96
|
+
def init_http_errors
|
97
|
+
@http_errors = Concurrent::Array.new
|
98
|
+
|
99
|
+
@http_errors << { type: Domain::Constants::SPLIT_SYNC, value: Concurrent::Hash.new }
|
100
|
+
@http_errors << { type: Domain::Constants::SEGMENT_SYNC, value: Concurrent::Hash.new }
|
101
|
+
@http_errors << { type: Domain::Constants::EVENT_SYNC, value: Concurrent::Hash.new }
|
102
|
+
@http_errors << { type: Domain::Constants::IMPRESSION_COUNT_SYNC, value: Concurrent::Hash.new }
|
103
|
+
@http_errors << { type: Domain::Constants::IMPRESSIONS_SYNC, value: Concurrent::Hash.new }
|
104
|
+
@http_errors << { type: Domain::Constants::TELEMETRY_SYNC, value: Concurrent::Hash.new }
|
105
|
+
@http_errors << { type: Domain::Constants::TOKEN_SYNC, value: Concurrent::Hash.new }
|
106
|
+
end
|
107
|
+
|
108
|
+
def init_http_latencies
|
109
|
+
@http_latencies = Concurrent::Array.new
|
110
|
+
|
111
|
+
array_size = BinarySearchLatencyTracker::BUCKETS.length
|
112
|
+
@http_latencies << { type: Domain::Constants::SPLIT_SYNC, value: Concurrent::Array.new(array_size, 0) }
|
113
|
+
@http_latencies << { type: Domain::Constants::SEGMENT_SYNC, value: Concurrent::Array.new(array_size, 0) }
|
114
|
+
@http_latencies << { type: Domain::Constants::EVENT_SYNC, value: Concurrent::Array.new(array_size, 0) }
|
115
|
+
@http_latencies << { type: Domain::Constants::IMPRESSION_COUNT_SYNC, value: Concurrent::Array.new(array_size, 0) }
|
116
|
+
@http_latencies << { type: Domain::Constants::IMPRESSIONS_SYNC, value: Concurrent::Array.new(array_size, 0) }
|
117
|
+
@http_latencies << { type: Domain::Constants::TELEMETRY_SYNC, value: Concurrent::Array.new(array_size, 0) }
|
118
|
+
@http_latencies << { type: Domain::Constants::TOKEN_SYNC, value: Concurrent::Array.new(array_size, 0) }
|
119
|
+
end
|
120
|
+
|
121
|
+
def init_auth_rejections
|
122
|
+
@auth_rejections = Concurrent::AtomicFixnum.new(0)
|
123
|
+
end
|
124
|
+
|
125
|
+
def init_token_refreshes
|
126
|
+
@token_refreshes = Concurrent::AtomicFixnum.new(0)
|
127
|
+
end
|
128
|
+
|
129
|
+
def init_streaming_events
|
130
|
+
@streaming_events = Concurrent::Array.new
|
131
|
+
end
|
132
|
+
|
133
|
+
def init_session_length
|
134
|
+
@session_length = Concurrent::AtomicFixnum.new(0)
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SplitIoClient
|
4
|
+
module Telemetry
|
5
|
+
class SyncTask
|
6
|
+
def initialize(config, telemetry_synchronizer)
|
7
|
+
@config = config
|
8
|
+
@telemetry_synchronizer = telemetry_synchronizer
|
9
|
+
end
|
10
|
+
|
11
|
+
def call
|
12
|
+
stats_thread
|
13
|
+
|
14
|
+
PhusionPassenger.on_event(:starting_worker_process) { |forked| stats_thread if forked } if defined?(PhusionPassenger)
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def stats_thread
|
20
|
+
@config.threads[:telemetry_stats_sender] = Thread.new do
|
21
|
+
begin
|
22
|
+
@config.logger.info('Starting Telemetry Sync Task')
|
23
|
+
|
24
|
+
loop do
|
25
|
+
sleep(@config.telemetry_refresh_rate)
|
26
|
+
|
27
|
+
@telemetry_synchronizer.synchronize_stats
|
28
|
+
end
|
29
|
+
rescue SplitIoClient::SDKShutdownException
|
30
|
+
@telemetry_synchronizer.synchronize_stats
|
31
|
+
|
32
|
+
@config.logger.info('Posting Telemetry due to shutdown')
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SplitIoClient
|
4
|
+
module Telemetry
|
5
|
+
class Synchronizer
|
6
|
+
extend Forwardable
|
7
|
+
def_delegators :@synchronizer,
|
8
|
+
:synchronize_config,
|
9
|
+
:synchronize_stats
|
10
|
+
|
11
|
+
def initialize(config,
|
12
|
+
telemtry_consumers,
|
13
|
+
telemetry_init_producer,
|
14
|
+
repositories,
|
15
|
+
telemetry_api)
|
16
|
+
@synchronizer = case config.telemetry_adapter.class.to_s
|
17
|
+
when 'SplitIoClient::Cache::Adapters::RedisAdapter'
|
18
|
+
SplitIoClient::Telemetry::RedisSynchronizer.new(config,
|
19
|
+
telemetry_init_producer)
|
20
|
+
else
|
21
|
+
SplitIoClient::Telemetry::MemorySynchronizer.new(config,
|
22
|
+
telemtry_consumers,
|
23
|
+
repositories,
|
24
|
+
telemetry_api)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: splitclient-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.
|
4
|
+
version: 7.3.0.pre.rc3
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Split Software
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -345,9 +345,6 @@ files:
|
|
345
345
|
- lib/splitclient-rb/cache/repositories/impressions/memory_repository.rb
|
346
346
|
- lib/splitclient-rb/cache/repositories/impressions/redis_repository.rb
|
347
347
|
- lib/splitclient-rb/cache/repositories/impressions_repository.rb
|
348
|
-
- lib/splitclient-rb/cache/repositories/metrics/memory_repository.rb
|
349
|
-
- lib/splitclient-rb/cache/repositories/metrics/redis_repository.rb
|
350
|
-
- lib/splitclient-rb/cache/repositories/metrics_repository.rb
|
351
348
|
- lib/splitclient-rb/cache/repositories/repository.rb
|
352
349
|
- lib/splitclient-rb/cache/repositories/segments_repository.rb
|
353
350
|
- lib/splitclient-rb/cache/repositories/splits_repository.rb
|
@@ -357,7 +354,6 @@ files:
|
|
357
354
|
- lib/splitclient-rb/cache/senders/impressions_formatter.rb
|
358
355
|
- lib/splitclient-rb/cache/senders/impressions_sender.rb
|
359
356
|
- lib/splitclient-rb/cache/senders/localhost_repo_cleaner.rb
|
360
|
-
- lib/splitclient-rb/cache/senders/metrics_sender.rb
|
361
357
|
- lib/splitclient-rb/cache/stores/localhost_split_builder.rb
|
362
358
|
- lib/splitclient-rb/cache/stores/localhost_split_store.rb
|
363
359
|
- lib/splitclient-rb/cache/stores/sdk_blocker.rb
|
@@ -369,9 +365,9 @@ files:
|
|
369
365
|
- lib/splitclient-rb/engine/api/faraday_adapter/patched_net_http_persistent.rb
|
370
366
|
- lib/splitclient-rb/engine/api/faraday_middleware/gzip.rb
|
371
367
|
- lib/splitclient-rb/engine/api/impressions.rb
|
372
|
-
- lib/splitclient-rb/engine/api/metrics.rb
|
373
368
|
- lib/splitclient-rb/engine/api/segments.rb
|
374
369
|
- lib/splitclient-rb/engine/api/splits.rb
|
370
|
+
- lib/splitclient-rb/engine/api/telemetry_api.rb
|
375
371
|
- lib/splitclient-rb/engine/auth_api_client.rb
|
376
372
|
- lib/splitclient-rb/engine/common/impressions_counter.rb
|
377
373
|
- lib/splitclient-rb/engine/common/impressions_manager.rb
|
@@ -399,7 +395,6 @@ files:
|
|
399
395
|
- lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb
|
400
396
|
- lib/splitclient-rb/engine/matchers/whitelist_matcher.rb
|
401
397
|
- lib/splitclient-rb/engine/metrics/binary_search_latency_tracker.rb
|
402
|
-
- lib/splitclient-rb/engine/metrics/metrics.rb
|
403
398
|
- lib/splitclient-rb/engine/models/label.rb
|
404
399
|
- lib/splitclient-rb/engine/models/split.rb
|
405
400
|
- lib/splitclient-rb/engine/models/treatment.rb
|
@@ -412,7 +407,6 @@ files:
|
|
412
407
|
- lib/splitclient-rb/exceptions.rb
|
413
408
|
- lib/splitclient-rb/helpers/thread_helper.rb
|
414
409
|
- lib/splitclient-rb/managers/split_manager.rb
|
415
|
-
- lib/splitclient-rb/redis_metrics_fixer.rb
|
416
410
|
- lib/splitclient-rb/split_config.rb
|
417
411
|
- lib/splitclient-rb/split_factory.rb
|
418
412
|
- lib/splitclient-rb/split_factory_builder.rb
|
@@ -428,6 +422,27 @@ files:
|
|
428
422
|
- lib/splitclient-rb/sse/sse_handler.rb
|
429
423
|
- lib/splitclient-rb/sse/workers/segments_worker.rb
|
430
424
|
- lib/splitclient-rb/sse/workers/splits_worker.rb
|
425
|
+
- lib/splitclient-rb/telemetry/domain/constants.rb
|
426
|
+
- lib/splitclient-rb/telemetry/domain/structs.rb
|
427
|
+
- lib/splitclient-rb/telemetry/evaluation_consumer.rb
|
428
|
+
- lib/splitclient-rb/telemetry/evaluation_producer.rb
|
429
|
+
- lib/splitclient-rb/telemetry/init_consumer.rb
|
430
|
+
- lib/splitclient-rb/telemetry/init_producer.rb
|
431
|
+
- lib/splitclient-rb/telemetry/memory/memory_evaluation_consumer.rb
|
432
|
+
- lib/splitclient-rb/telemetry/memory/memory_evaluation_producer.rb
|
433
|
+
- lib/splitclient-rb/telemetry/memory/memory_init_consumer.rb
|
434
|
+
- lib/splitclient-rb/telemetry/memory/memory_init_producer.rb
|
435
|
+
- lib/splitclient-rb/telemetry/memory/memory_runtime_consumer.rb
|
436
|
+
- lib/splitclient-rb/telemetry/memory/memory_runtime_producer.rb
|
437
|
+
- lib/splitclient-rb/telemetry/memory/memory_synchronizer.rb
|
438
|
+
- lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb
|
439
|
+
- lib/splitclient-rb/telemetry/redis/redis_init_producer.rb
|
440
|
+
- lib/splitclient-rb/telemetry/redis/redis_synchronizer.rb
|
441
|
+
- lib/splitclient-rb/telemetry/runtime_consumer.rb
|
442
|
+
- lib/splitclient-rb/telemetry/runtime_producer.rb
|
443
|
+
- lib/splitclient-rb/telemetry/storages/memory.rb
|
444
|
+
- lib/splitclient-rb/telemetry/sync_task.rb
|
445
|
+
- lib/splitclient-rb/telemetry/synchronizer.rb
|
431
446
|
- lib/splitclient-rb/utilitites.rb
|
432
447
|
- lib/splitclient-rb/validators.rb
|
433
448
|
- lib/splitclient-rb/version.rb
|
@@ -450,9 +465,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
450
465
|
version: '0'
|
451
466
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
452
467
|
requirements:
|
453
|
-
- - "
|
468
|
+
- - ">"
|
454
469
|
- !ruby/object:Gem::Version
|
455
|
-
version:
|
470
|
+
version: 1.3.1
|
456
471
|
requirements: []
|
457
472
|
rubyforge_project:
|
458
473
|
rubygems_version: 2.6.14
|
@@ -1,163 +0,0 @@
|
|
1
|
-
require 'concurrent'
|
2
|
-
|
3
|
-
module SplitIoClient
|
4
|
-
module Cache
|
5
|
-
module Repositories
|
6
|
-
module Metrics
|
7
|
-
class MemoryRepository
|
8
|
-
OPERATIONS = %w(sdk.get_treatment sdk.get_treatments sdk.get_treatment_with_config sdk.get_treatments_with_config)
|
9
|
-
|
10
|
-
def initialize(_ = nil, config)
|
11
|
-
@counts = Concurrent::Array.new
|
12
|
-
@latencies = Concurrent::Array.new
|
13
|
-
@gauges = Concurrent::Array.new
|
14
|
-
@config = config
|
15
|
-
end
|
16
|
-
|
17
|
-
def add_count(counter, delta)
|
18
|
-
counter_hash = @counts.find { |c| c[:name] == counter }
|
19
|
-
if counter_hash.nil?
|
20
|
-
counter_delta = SumAndCount.new
|
21
|
-
counter_delta.add_delta(delta)
|
22
|
-
@counts << { name: counter, delta: counter_delta }
|
23
|
-
else
|
24
|
-
counter_hash[:delta].add_delta(delta)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def add_latency(operation, time_in_ms, binary_search)
|
29
|
-
if (OPERATIONS.include?(operation))
|
30
|
-
index = binary_search.add_latency_millis(time_in_ms, true)
|
31
|
-
increase_latency_bucket(operation, index)
|
32
|
-
else
|
33
|
-
concatenate_latency(operation, time_in_ms)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def add_gauge(gauge, value)
|
38
|
-
gauge_hash = @gauges.find { |g| g[:name] == gauge }
|
39
|
-
if gauge_hash.nil?
|
40
|
-
gauge_value = ValueAndCount.new
|
41
|
-
gauge_value.set_value(value)
|
42
|
-
@gauges << { name: gauge, value: gauge_value }
|
43
|
-
else
|
44
|
-
gauge_hash[:value].set_value(value)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
def counts
|
49
|
-
@counts.each_with_object({}) do |count, memo|
|
50
|
-
memo[count[:name]] = count[:delta].sum
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
def latencies
|
55
|
-
@latencies.each_with_object({}) do |latency, memo|
|
56
|
-
memo[latency[:operation]] = latency[:latencies]
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def gauges
|
61
|
-
# TODO
|
62
|
-
end
|
63
|
-
|
64
|
-
def fix_latencies
|
65
|
-
# NOOP
|
66
|
-
end
|
67
|
-
|
68
|
-
def clear_counts
|
69
|
-
@counts = Concurrent::Array.new
|
70
|
-
end
|
71
|
-
|
72
|
-
def clear_latencies
|
73
|
-
@latencies = Concurrent::Array.new
|
74
|
-
end
|
75
|
-
|
76
|
-
def clear_gauges
|
77
|
-
@gauges = Concurrent::Array.new
|
78
|
-
end
|
79
|
-
|
80
|
-
def clear
|
81
|
-
clear_counts
|
82
|
-
clear_latencies
|
83
|
-
clear_gauges
|
84
|
-
end
|
85
|
-
|
86
|
-
#
|
87
|
-
# small class to act as DTO for counts
|
88
|
-
#
|
89
|
-
class SumAndCount
|
90
|
-
attr_reader :count
|
91
|
-
attr_reader :sum
|
92
|
-
|
93
|
-
def initialize
|
94
|
-
@count = 0
|
95
|
-
@sum = 0
|
96
|
-
end
|
97
|
-
|
98
|
-
def add_delta(delta)
|
99
|
-
@count += 1
|
100
|
-
@sum += delta
|
101
|
-
end
|
102
|
-
|
103
|
-
def clear
|
104
|
-
@count = 0
|
105
|
-
@sum = 0
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
#
|
110
|
-
# small class to act as DTO for gauges
|
111
|
-
#
|
112
|
-
class ValueAndCount
|
113
|
-
attr_reader :count
|
114
|
-
attr_reader :value
|
115
|
-
|
116
|
-
def initialize
|
117
|
-
@count = 0
|
118
|
-
@value = 0
|
119
|
-
end
|
120
|
-
|
121
|
-
def set_value(value)
|
122
|
-
@count += 1
|
123
|
-
@value = value
|
124
|
-
end
|
125
|
-
|
126
|
-
def clear
|
127
|
-
@count = 0
|
128
|
-
@value = 0
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
private
|
133
|
-
|
134
|
-
def increase_latency_bucket(operation, index)
|
135
|
-
operation_latencies = find_operation_latencies(operation)
|
136
|
-
|
137
|
-
if (operation_latencies.nil?)
|
138
|
-
latencies_array = Array.new(BinarySearchLatencyTracker::BUCKETS.length, 0)
|
139
|
-
latencies_array[index] = 1
|
140
|
-
@latencies << { operation: operation, latencies: latencies_array }
|
141
|
-
else
|
142
|
-
operation_latencies[:latencies][index] += 1
|
143
|
-
end
|
144
|
-
end
|
145
|
-
|
146
|
-
def concatenate_latency(operation, time_in_ms)
|
147
|
-
operation_latencies = find_operation_latencies(operation)
|
148
|
-
|
149
|
-
if (operation_latencies.nil?)
|
150
|
-
@latencies << { operation: operation, latencies: [time_in_ms] }
|
151
|
-
else
|
152
|
-
operation_latencies[:latencies].push(time_in_ms)
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
|
-
def find_operation_latencies(operation)
|
157
|
-
@latencies.find { |l| l[:operation] == operation }
|
158
|
-
end
|
159
|
-
end
|
160
|
-
end
|
161
|
-
end
|
162
|
-
end
|
163
|
-
end
|