splitclient-rb 6.3.0 → 8.11.0
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/.github/CODEOWNERS +1 -0
- data/.github/pull_request_template.md +9 -0
- data/.github/workflows/ci.yml +90 -0
- data/.github/workflows/update-license-year.yml +45 -0
- data/.gitignore +4 -0
- data/.rubocop.yml +46 -3
- data/CHANGES.txt +158 -11
- data/CONTRIBUTORS-GUIDE.md +49 -0
- data/LICENSE +169 -13
- data/NOTICE.txt +5 -0
- data/README.md +67 -27
- data/Rakefile +1 -8
- data/ext/murmurhash/3_x64_128.c +117 -0
- data/ext/murmurhash/murmurhash.c +5 -1
- data/lib/murmurhash/murmurhash.jar +0 -0
- data/lib/splitclient-rb/cache/adapters/cache_adapter.rb +3 -3
- data/lib/splitclient-rb/cache/adapters/memory_adapters/map_adapter.rb +4 -0
- data/lib/splitclient-rb/cache/adapters/memory_adapters/queue_adapter.rb +7 -0
- data/lib/splitclient-rb/cache/adapters/redis_adapter.rb +12 -4
- data/lib/splitclient-rb/cache/fetchers/segment_fetcher.rb +83 -0
- data/lib/splitclient-rb/cache/fetchers/split_fetcher.rb +70 -0
- data/lib/splitclient-rb/cache/filter/bloom_filter.rb +67 -0
- data/lib/splitclient-rb/cache/filter/filter_adapter.rb +32 -0
- data/lib/splitclient-rb/cache/filter/flag_set_filter.rb +40 -0
- data/lib/splitclient-rb/cache/hashers/impression_hasher.rb +34 -0
- data/lib/splitclient-rb/cache/observers/impression_observer.rb +22 -0
- data/lib/splitclient-rb/cache/observers/noop_impression_observer.rb +10 -0
- data/lib/splitclient-rb/cache/repositories/events/memory_repository.rb +26 -14
- data/lib/splitclient-rb/cache/repositories/events/redis_repository.rb +9 -14
- data/lib/splitclient-rb/cache/repositories/events_repository.rb +31 -10
- data/lib/splitclient-rb/cache/repositories/flag_sets/memory_repository.rb +40 -0
- data/lib/splitclient-rb/cache/repositories/flag_sets/redis_repository.rb +49 -0
- data/lib/splitclient-rb/cache/repositories/impressions/memory_repository.rb +22 -23
- data/lib/splitclient-rb/cache/repositories/impressions/redis_repository.rb +15 -22
- data/lib/splitclient-rb/cache/repositories/impressions_repository.rb +6 -31
- data/lib/splitclient-rb/cache/repositories/repository.rb +6 -5
- data/lib/splitclient-rb/cache/repositories/rule_based_segments_repository.rb +136 -0
- data/lib/splitclient-rb/cache/repositories/segments_repository.rb +46 -6
- data/lib/splitclient-rb/cache/repositories/splits_repository.rb +232 -43
- data/lib/splitclient-rb/cache/routers/impression_router.rb +24 -22
- data/lib/splitclient-rb/cache/senders/events_sender.rb +12 -29
- data/lib/splitclient-rb/cache/senders/impressions_adapter/memory_sender.rb +71 -0
- data/lib/splitclient-rb/cache/senders/impressions_adapter/redis_sender.rb +69 -0
- data/lib/splitclient-rb/cache/senders/impressions_count_sender.rb +43 -0
- data/lib/splitclient-rb/cache/senders/impressions_formatter.rb +27 -13
- data/lib/splitclient-rb/cache/senders/impressions_sender.rb +11 -25
- data/lib/splitclient-rb/cache/senders/impressions_sender_adapter.rb +21 -0
- data/lib/splitclient-rb/cache/senders/localhost_repo_cleaner.rb +47 -0
- data/lib/splitclient-rb/cache/stores/localhost_split_builder.rb +95 -0
- data/lib/splitclient-rb/cache/stores/localhost_split_store.rb +110 -0
- data/lib/splitclient-rb/cache/stores/store_utils.rb +13 -0
- data/lib/splitclient-rb/clients/split_client.rb +385 -138
- data/lib/splitclient-rb/constants.rb +16 -0
- data/lib/splitclient-rb/engine/api/client.rb +38 -43
- data/lib/splitclient-rb/engine/api/events.rb +19 -11
- data/lib/splitclient-rb/engine/api/faraday_middleware/gzip.rb +1 -0
- data/lib/splitclient-rb/engine/api/impressions.rb +49 -14
- data/lib/splitclient-rb/engine/api/segments.rb +31 -24
- data/lib/splitclient-rb/engine/api/splits.rb +108 -33
- data/lib/splitclient-rb/engine/api/telemetry_api.rb +47 -0
- data/lib/splitclient-rb/engine/auth_api_client.rb +96 -0
- data/lib/splitclient-rb/engine/back_off.rb +26 -0
- data/lib/splitclient-rb/engine/common/impressions_counter.rb +45 -0
- data/lib/splitclient-rb/engine/common/impressions_manager.rb +165 -0
- data/lib/splitclient-rb/engine/common/noop_impressions_counter.rb +27 -0
- data/lib/splitclient-rb/engine/events/events_delivery.rb +20 -0
- data/lib/splitclient-rb/engine/events/events_manager.rb +194 -0
- data/lib/splitclient-rb/engine/events/events_manager_config.rb +96 -0
- data/lib/splitclient-rb/engine/events/events_task.rb +50 -0
- data/lib/splitclient-rb/engine/events/noop_events_queue.rb +13 -0
- data/lib/splitclient-rb/engine/fallback_treatment_calculator.rb +48 -0
- data/lib/splitclient-rb/engine/impressions/noop_unique_keys_tracker.rb +17 -0
- data/lib/splitclient-rb/engine/impressions/unique_keys_tracker.rb +144 -0
- data/lib/splitclient-rb/engine/matchers/all_keys_matcher.rb +1 -1
- data/lib/splitclient-rb/engine/matchers/between_matcher.rb +7 -5
- data/lib/splitclient-rb/engine/matchers/between_semver_matcher.rb +33 -0
- data/lib/splitclient-rb/engine/matchers/combining_matcher.rb +10 -8
- data/lib/splitclient-rb/engine/matchers/contains_all_matcher.rb +2 -6
- data/lib/splitclient-rb/engine/matchers/contains_any_matcher.rb +1 -5
- data/lib/splitclient-rb/engine/matchers/contains_matcher.rb +7 -5
- data/lib/splitclient-rb/engine/matchers/dependency_matcher.rb +6 -5
- data/lib/splitclient-rb/engine/matchers/ends_with_matcher.rb +5 -4
- data/lib/splitclient-rb/engine/matchers/equal_to_boolean_matcher.rb +3 -2
- data/lib/splitclient-rb/engine/matchers/equal_to_matcher.rb +6 -4
- data/lib/splitclient-rb/engine/matchers/equal_to_semver_matcher.rb +28 -0
- data/lib/splitclient-rb/engine/matchers/equal_to_set_matcher.rb +1 -5
- data/lib/splitclient-rb/engine/matchers/greater_than_or_equal_to_matcher.rb +6 -4
- data/lib/splitclient-rb/engine/matchers/greater_than_or_equal_to_semver_matcher.rb +28 -0
- data/lib/splitclient-rb/engine/matchers/in_list_semver_matcher.rb +36 -0
- data/lib/splitclient-rb/engine/matchers/less_than_or_equal_to_matcher.rb +6 -4
- data/lib/splitclient-rb/engine/matchers/less_than_or_equal_to_semver_matcher.rb +28 -0
- data/lib/splitclient-rb/engine/matchers/matcher.rb +22 -0
- data/lib/splitclient-rb/engine/matchers/matches_string_matcher.rb +3 -2
- data/lib/splitclient-rb/engine/matchers/negation_matcher.rb +3 -2
- data/lib/splitclient-rb/engine/matchers/part_of_set_matcher.rb +2 -6
- data/lib/splitclient-rb/engine/matchers/prerequisites_matcher.rb +31 -0
- data/lib/splitclient-rb/engine/matchers/rule_based_segment_matcher.rb +78 -0
- data/lib/splitclient-rb/engine/matchers/semver.rb +201 -0
- data/lib/splitclient-rb/engine/matchers/set_matcher.rb +2 -1
- data/lib/splitclient-rb/engine/matchers/starts_with_matcher.rb +4 -3
- data/lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb +3 -2
- data/lib/splitclient-rb/engine/matchers/whitelist_matcher.rb +7 -5
- data/lib/splitclient-rb/engine/metrics/binary_search_latency_tracker.rb +3 -65
- data/lib/splitclient-rb/engine/models/evaluation_options.rb +9 -0
- data/lib/splitclient-rb/engine/models/event_active_subscriptions.rb +14 -0
- data/lib/splitclient-rb/engine/models/events_metadata.rb +10 -0
- data/lib/splitclient-rb/engine/models/fallback_treatment.rb +11 -0
- data/lib/splitclient-rb/engine/models/fallback_treatments_configuration.rb +36 -0
- data/lib/splitclient-rb/engine/models/label.rb +3 -0
- data/lib/splitclient-rb/engine/models/sdk_event.rb +4 -0
- data/lib/splitclient-rb/engine/models/sdk_event_type.rb +4 -0
- data/lib/splitclient-rb/engine/models/sdk_internal_event.rb +8 -0
- data/lib/splitclient-rb/engine/models/sdk_internal_event_notification.rb +14 -0
- data/lib/splitclient-rb/engine/models/segment_type.rb +4 -0
- data/lib/splitclient-rb/engine/models/split_http_response.rb +19 -0
- data/lib/splitclient-rb/engine/models/valid_sdk_event.rb +14 -0
- data/lib/splitclient-rb/engine/parser/condition.rb +81 -20
- data/lib/splitclient-rb/engine/parser/evaluator.rb +40 -51
- data/lib/splitclient-rb/engine/push_manager.rb +66 -0
- data/lib/splitclient-rb/engine/status_manager.rb +39 -0
- data/lib/splitclient-rb/engine/sync_manager.rb +180 -0
- data/lib/splitclient-rb/engine/synchronizer.rb +231 -0
- data/lib/splitclient-rb/exceptions.rb +20 -1
- data/lib/splitclient-rb/helpers/decryption_helper.rb +25 -0
- data/lib/splitclient-rb/helpers/evaluator_helper.rb +37 -0
- data/lib/splitclient-rb/helpers/repository_helper.rb +61 -0
- data/lib/splitclient-rb/helpers/thread_helper.rb +24 -0
- data/lib/splitclient-rb/helpers/util.rb +26 -0
- data/lib/splitclient-rb/managers/split_manager.rb +58 -20
- data/lib/splitclient-rb/spec.rb +9 -0
- data/lib/splitclient-rb/split_config.rb +336 -54
- data/lib/splitclient-rb/split_factory.rb +219 -33
- data/lib/splitclient-rb/split_factory_builder.rb +1 -22
- data/lib/splitclient-rb/split_factory_registry.rb +63 -0
- data/lib/splitclient-rb/split_logger.rb +9 -10
- data/lib/splitclient-rb/sse/event_source/client.rb +263 -0
- data/lib/splitclient-rb/sse/event_source/event_parser.rb +65 -0
- data/lib/splitclient-rb/sse/event_source/event_types.rb +15 -0
- data/lib/splitclient-rb/sse/event_source/stream_data.rb +22 -0
- data/lib/splitclient-rb/sse/notification_manager_keeper.rb +84 -0
- data/lib/splitclient-rb/sse/notification_processor.rb +48 -0
- data/lib/splitclient-rb/sse/sse_handler.rb +44 -0
- data/lib/splitclient-rb/sse/workers/segments_worker.rb +62 -0
- data/lib/splitclient-rb/sse/workers/splits_worker.rb +149 -0
- data/lib/splitclient-rb/telemetry/domain/constants.rb +48 -0
- data/lib/splitclient-rb/telemetry/domain/structs.rb +35 -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 +119 -0
- data/lib/splitclient-rb/telemetry/memory/memory_runtime_producer.rb +87 -0
- data/lib/splitclient-rb/telemetry/memory/memory_synchronizer.rb +213 -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 +27 -0
- data/lib/splitclient-rb/telemetry/runtime_consumer.rb +25 -0
- data/lib/splitclient-rb/telemetry/runtime_producer.rb +25 -0
- data/lib/splitclient-rb/telemetry/storages/memory.rb +159 -0
- data/lib/splitclient-rb/telemetry/sync_task.rb +36 -0
- data/lib/splitclient-rb/telemetry/synchronizer.rb +33 -0
- data/lib/splitclient-rb/utilitites.rb +8 -0
- data/lib/splitclient-rb/validators.rb +142 -38
- data/lib/splitclient-rb/version.rb +1 -1
- data/lib/splitclient-rb.rb +101 -16
- data/sonar-project.properties +6 -0
- data/splitclient-rb.gemspec +28 -23
- metadata +262 -82
- data/.travis.yml +0 -11
- data/Appraisals +0 -10
- data/Detailed-README.md +0 -588
- data/NEWS +0 -141
- data/lib/splitclient-rb/cache/repositories/metrics/memory_repository.rb +0 -127
- data/lib/splitclient-rb/cache/repositories/metrics/redis_repository.rb +0 -96
- data/lib/splitclient-rb/cache/repositories/metrics_repository.rb +0 -21
- data/lib/splitclient-rb/cache/senders/metrics_sender.rb +0 -56
- data/lib/splitclient-rb/cache/stores/sdk_blocker.rb +0 -46
- data/lib/splitclient-rb/cache/stores/segment_store.rb +0 -81
- data/lib/splitclient-rb/cache/stores/split_store.rb +0 -102
- data/lib/splitclient-rb/clients/localhost_split_client.rb +0 -183
- data/lib/splitclient-rb/engine/api/faraday_adapter/patched_net_http_persistent.rb +0 -46
- data/lib/splitclient-rb/engine/api/metrics.rb +0 -60
- data/lib/splitclient-rb/engine/metrics/metrics.rb +0 -80
- data/lib/splitclient-rb/engine/parser/split_adapter.rb +0 -81
- data/lib/splitclient-rb/localhost_split_factory.rb +0 -13
- data/lib/splitclient-rb/localhost_utils.rb +0 -59
- data/lib/splitclient-rb/managers/localhost_split_manager.rb +0 -60
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SplitIoClient
|
|
4
|
+
module SSE
|
|
5
|
+
module Workers
|
|
6
|
+
class SplitsWorker
|
|
7
|
+
def initialize(synchronizer, config, feature_flags_repository, telemetry_runtime_producer,
|
|
8
|
+
segment_fetcher, rule_based_segment_repository)
|
|
9
|
+
@synchronizer = synchronizer
|
|
10
|
+
@config = config
|
|
11
|
+
@feature_flags_repository = feature_flags_repository
|
|
12
|
+
@queue = Queue.new
|
|
13
|
+
@running = Concurrent::AtomicBoolean.new(false)
|
|
14
|
+
@telemetry_runtime_producer = telemetry_runtime_producer
|
|
15
|
+
@segment_fetcher = segment_fetcher
|
|
16
|
+
@rule_based_segment_repository = rule_based_segment_repository
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def start
|
|
20
|
+
if @running.value
|
|
21
|
+
@config.logger.debug('feature_flags_worker already running.') if @config.debug_enabled
|
|
22
|
+
return
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
@running.make_true
|
|
26
|
+
perform_thread
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def stop
|
|
30
|
+
unless @running.value
|
|
31
|
+
@config.logger.debug('feature_flags_worker not running.') if @config.debug_enabled
|
|
32
|
+
return
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
@running.make_false
|
|
36
|
+
Helpers::ThreadHelper.stop(:split_update_worker, @config)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def add_to_queue(notification)
|
|
40
|
+
@config.logger.debug("feature_flags_worker add to queue #{notification.data['changeNumber']}") if @config.debug_enabled
|
|
41
|
+
@queue.push(notification)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
private
|
|
45
|
+
|
|
46
|
+
def perform_thread
|
|
47
|
+
@config.threads[:split_update_worker] = Thread.new do
|
|
48
|
+
@config.logger.debug('starting feature_flags_worker ...') if @config.debug_enabled
|
|
49
|
+
perform
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def perform
|
|
54
|
+
while (notification = @queue.pop)
|
|
55
|
+
@config.logger.debug("feature_flags_worker change_number dequeue #{notification.data['changeNumber']}") if @config.debug_enabled
|
|
56
|
+
case notification.data['type']
|
|
57
|
+
when SSE::EventSource::EventTypes::SPLIT_UPDATE
|
|
58
|
+
success = update_feature_flag(notification)
|
|
59
|
+
@synchronizer.fetch_splits(notification.data['changeNumber'], 0) unless success
|
|
60
|
+
when SSE::EventSource::EventTypes::RB_SEGMENT_UPDATE
|
|
61
|
+
success = update_rule_based_segment(notification)
|
|
62
|
+
@synchronizer.fetch_splits(0, notification.data['changeNumber']) unless success
|
|
63
|
+
when SSE::EventSource::EventTypes::SPLIT_KILL
|
|
64
|
+
kill_feature_flag(notification)
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def update_feature_flag(notification)
|
|
70
|
+
return true if @feature_flags_repository.get_change_number.to_i >= notification.data['changeNumber']
|
|
71
|
+
return false unless !notification.data['d'].nil? && @feature_flags_repository.get_change_number == notification.data['pcn']
|
|
72
|
+
|
|
73
|
+
new_split = update_feature_flag_repository(notification)
|
|
74
|
+
fetch_segments_if_not_exists(Helpers::Util.segment_names_by_object(new_split, 'IN_SEGMENT'), @feature_flags_repository)
|
|
75
|
+
if fetch_rule_based_segments_if_not_exists(Helpers::Util.segment_names_by_object(new_split, 'IN_RULE_BASED_SEGMENT'),
|
|
76
|
+
notification.data['changeNumber'])
|
|
77
|
+
return true
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
@telemetry_runtime_producer.record_updates_from_sse(Telemetry::Domain::Constants::SPLITS)
|
|
81
|
+
|
|
82
|
+
true
|
|
83
|
+
rescue StandardError => e
|
|
84
|
+
@config.logger.debug("Failed to update Split: #{e.inspect}") if @config.debug_enabled
|
|
85
|
+
|
|
86
|
+
false
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def update_feature_flag_repository(notification)
|
|
90
|
+
new_split = return_object_from_json(notification)
|
|
91
|
+
SplitIoClient::Helpers::RepositoryHelper.update_feature_flag_repository(@feature_flags_repository, [new_split],
|
|
92
|
+
notification.data['changeNumber'], @config, false)
|
|
93
|
+
new_split
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def update_rule_based_segment(notification)
|
|
97
|
+
return true if @rule_based_segment_repository.get_change_number.to_i >= notification.data['changeNumber']
|
|
98
|
+
return false unless !notification.data['d'].nil? &&
|
|
99
|
+
@rule_based_segment_repository.get_change_number == notification.data['pcn']
|
|
100
|
+
|
|
101
|
+
new_rb_segment = return_object_from_json(notification)
|
|
102
|
+
SplitIoClient::Helpers::RepositoryHelper.update_rule_based_segment_repository(@rule_based_segment_repository,
|
|
103
|
+
[new_rb_segment],
|
|
104
|
+
notification.data['changeNumber'], @config)
|
|
105
|
+
fetch_segments_if_not_exists(Helpers::Util.segment_names_in_rb_segment(new_rb_segment, 'IN_SEGMENT'),
|
|
106
|
+
@rule_based_segment_repository)
|
|
107
|
+
|
|
108
|
+
# @telemetry_runtime_producer.record_updates_from_sse(Telemetry::Domain::Constants::SPLITS)
|
|
109
|
+
|
|
110
|
+
true
|
|
111
|
+
rescue StandardError => e
|
|
112
|
+
@config.logger.debug("Failed to update Split: #{e.inspect}") if @config.debug_enabled
|
|
113
|
+
|
|
114
|
+
false
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def kill_feature_flag(notification)
|
|
118
|
+
return if @feature_flags_repository.get_change_number.to_i > notification.data['changeNumber']
|
|
119
|
+
|
|
120
|
+
@config.logger.debug("feature_flags_worker kill #{notification.data['splitName']}, #{notification.data['changeNumber']}") if @config.debug_enabled
|
|
121
|
+
@feature_flags_repository.kill(notification.data['changeNumber'],
|
|
122
|
+
notification.data['splitName'],
|
|
123
|
+
notification.data['defaultTreatment'])
|
|
124
|
+
@synchronizer.fetch_splits(notification.data['changeNumber'], 0)
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def return_object_from_json(notification)
|
|
128
|
+
object_json = Helpers::DecryptionHelper.get_encoded_definition(notification.data['c'], notification.data['d'])
|
|
129
|
+
JSON.parse(object_json, symbolize_names: true)
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def fetch_segments_if_not_exists(segment_names, object_repository)
|
|
133
|
+
return if segment_names.nil?
|
|
134
|
+
|
|
135
|
+
object_repository.set_segment_names(segment_names)
|
|
136
|
+
@segment_fetcher.fetch_segments_if_not_exists(segment_names)
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def fetch_rule_based_segments_if_not_exists(segment_names, change_number)
|
|
140
|
+
return false if segment_names.nil? || segment_names.empty? || @rule_based_segment_repository.contains?(segment_names.to_a)
|
|
141
|
+
|
|
142
|
+
@synchronizer.fetch_splits(0, change_number)
|
|
143
|
+
|
|
144
|
+
true
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SplitIoClient
|
|
4
|
+
module Telemetry
|
|
5
|
+
module Domain
|
|
6
|
+
class Constants
|
|
7
|
+
BUR_TIMEOUT = 'bur_timeout'
|
|
8
|
+
NON_READY_USAGES = 'non_ready_usages'
|
|
9
|
+
|
|
10
|
+
IMPRESSIONS_DROPPED = 'impressions_dropped'
|
|
11
|
+
IMPRESSIONS_DEDUPE = 'impressions_deduped'
|
|
12
|
+
IMPRESSIONS_QUEUED = 'impressions_queued'
|
|
13
|
+
|
|
14
|
+
EVENTS_DROPPED = 'events_dropped'
|
|
15
|
+
EVENTS_QUEUED = 'events_queued'
|
|
16
|
+
|
|
17
|
+
SPLIT_SYNC = 'split_sync'
|
|
18
|
+
SEGMENT_SYNC = 'segment_sync'
|
|
19
|
+
IMPRESSIONS_SYNC = 'impressions_sync'
|
|
20
|
+
IMPRESSION_COUNT_SYNC = 'impression_count_sync'
|
|
21
|
+
EVENT_SYNC = 'event_sync'
|
|
22
|
+
TELEMETRY_SYNC = 'telemetry_sync'
|
|
23
|
+
TOKEN_SYNC = 'token_sync'
|
|
24
|
+
|
|
25
|
+
SSE_CONNECTION_ESTABLISHED = 0
|
|
26
|
+
OCCUPANCY_PRI = 10
|
|
27
|
+
OCCUPANCY_SEC = 20
|
|
28
|
+
STREAMING_STATUS = 30
|
|
29
|
+
CONNECTION_ERROR = 40
|
|
30
|
+
TOKEN_REFRESH = 50
|
|
31
|
+
ABLY_ERROR = 60
|
|
32
|
+
SYNC_MODE = 70
|
|
33
|
+
|
|
34
|
+
TREATMENT = 'treatment'
|
|
35
|
+
TREATMENTS = 'treatments'
|
|
36
|
+
TREATMENT_WITH_CONFIG = 'treatmentWithConfig'
|
|
37
|
+
TREATMENTS_WITH_CONFIG = 'treatmentsWithConfig'
|
|
38
|
+
TREATMENTS_BY_FLAG_SET = 'treatmentsByFlagSet'
|
|
39
|
+
TREATMENTS_BY_FLAG_SETS = 'treatmentsByFlagSets'
|
|
40
|
+
TREATMENTS_WITH_CONFIG_BY_FLAG_SET = 'treatmentWithConfigByFlagSet'
|
|
41
|
+
TREATMENTS_WITH_CONFIG_BY_FLAG_SETS = 'treatmentsWithConfigByFlagSets'
|
|
42
|
+
TRACK = 'track'
|
|
43
|
+
|
|
44
|
+
SPLITS = 'splits'
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SplitIoClient
|
|
4
|
+
module Telemetry
|
|
5
|
+
# sp: splits, se: segments, im: impressions, ic:impression count, ev: events, te: telemetry, to: token.
|
|
6
|
+
LastSynchronization = Struct.new(:sp, :se, :im, :ic, :ev, :te, :to)
|
|
7
|
+
HttpErrors = Struct.new(:sp, :se, :im, :ic, :ev, :te, :to)
|
|
8
|
+
HttpLatencies = Struct.new(:sp, :se, :im, :ic, :ev, :te, :to)
|
|
9
|
+
|
|
10
|
+
# sp: splits, se: segmentos, im: impressions, ev: events, t: telemetry
|
|
11
|
+
Rates = Struct.new(:sp, :se, :im, :ev, :te)
|
|
12
|
+
|
|
13
|
+
# s: sdkUrl, e: eventsUrl, a: authUrl, st: streamUrl, t: telemetryUrl
|
|
14
|
+
UrlOverrides = Struct.new(:s, :e, :a, :st, :t)
|
|
15
|
+
|
|
16
|
+
# om: operationMode, st: storage, af: activeFactories, rf: redundantActiveFactories, t: tags, se: streamingEnabled,
|
|
17
|
+
# rr: refreshRate, uo: urlOverrides, iq: impressionsQueueSize, eq: eventsQueueSize, im: impressionsMode,
|
|
18
|
+
# il: impressionListenerEnabled, hp: httpProxyDetected, tr: timeUntilSdkReady, bt: burTimeouts,
|
|
19
|
+
# nr: sdkNotReadyUsage, i: integrations, fsT: Total flagsets, fsI: Invalid flagsets
|
|
20
|
+
ConfigInit = Struct.new(:om, :st, :af, :rf, :t, :fsT, :fsI, :se, :rr, :uo, :iq, :eq, :im, :il, :hp, :tr, :bt, :nr, :i)
|
|
21
|
+
|
|
22
|
+
# ls: lastSynchronization, ml: clientMethodLatencies, me: clientMethodExceptions, he: httpErros, hl: httpLatencies,
|
|
23
|
+
# tr: tokenRefreshes, ar: authRejections, iq: impressionsQueued, ide: impressionsDeduped, idr: impressionsDropped,
|
|
24
|
+
# spc: splitsCount, sec: segmentCount, skc: segmentKeyCount, sl: sessionLengthMs, eq: eventsQueued, ed: eventsDropped,
|
|
25
|
+
# se: streamingEvents, t: tags, ufs: updates from sse
|
|
26
|
+
Usage = Struct.new(:ls, :ml, :me, :he, :hl, :tr, :ar, :iq, :ide, :idr, :spc, :sec, :skc, :sl, :eq, :ed, :se, :t, :ufs)
|
|
27
|
+
|
|
28
|
+
# t: treatment, ts: treatments, tc: treatmentWithConfig, tcs: treatmentsWithConfig, tr: track
|
|
29
|
+
ClientMethodLatencies = Struct.new(:t, :ts, :tc, :tcs, :tf, :tfs, :tcf, :tcfs, :tr)
|
|
30
|
+
ClientMethodExceptions = Struct.new(:t, :ts, :tc, :tcs, :tf, :tfs, :tcf, :tcfs, :tr)
|
|
31
|
+
|
|
32
|
+
# sp: splits
|
|
33
|
+
UpdatesFromSSE = Struct.new(:sp)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SplitIoClient
|
|
4
|
+
module Telemetry
|
|
5
|
+
class EvaluationConsumer
|
|
6
|
+
extend Forwardable
|
|
7
|
+
def_delegators :@evaluation, :pop_latencies, :pop_exceptions
|
|
8
|
+
|
|
9
|
+
def initialize(config)
|
|
10
|
+
@evaluation = SplitIoClient::Telemetry::MemoryEvaluationConsumer.new(config)
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SplitIoClient
|
|
4
|
+
module Telemetry
|
|
5
|
+
class EvaluationProducer
|
|
6
|
+
extend Forwardable
|
|
7
|
+
def_delegators :@evaluation,
|
|
8
|
+
:record_latency,
|
|
9
|
+
:record_exception
|
|
10
|
+
|
|
11
|
+
def initialize(config)
|
|
12
|
+
@evaluation = case config.telemetry_adapter.class.to_s
|
|
13
|
+
when 'SplitIoClient::Cache::Adapters::RedisAdapter'
|
|
14
|
+
SplitIoClient::Telemetry::RedisEvaluationProducer.new(config)
|
|
15
|
+
else
|
|
16
|
+
SplitIoClient::Telemetry::MemoryEvaluationProducer.new(config)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SplitIoClient
|
|
4
|
+
module Telemetry
|
|
5
|
+
class InitConsumer
|
|
6
|
+
extend Forwardable
|
|
7
|
+
def_delegators :@init, :non_ready_usages, :bur_timeouts
|
|
8
|
+
|
|
9
|
+
def initialize(config)
|
|
10
|
+
@init = SplitIoClient::Telemetry::MemoryInitConsumer.new(config)
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SplitIoClient
|
|
4
|
+
module Telemetry
|
|
5
|
+
class InitProducer
|
|
6
|
+
extend Forwardable
|
|
7
|
+
def_delegators :@init, :record_config, :record_non_ready_usages, :record_bur_timeout
|
|
8
|
+
|
|
9
|
+
def initialize(config)
|
|
10
|
+
@init = case config.telemetry_adapter.class.to_s
|
|
11
|
+
when 'SplitIoClient::Cache::Adapters::RedisAdapter'
|
|
12
|
+
SplitIoClient::Telemetry::RedisInitProducer.new(config)
|
|
13
|
+
else
|
|
14
|
+
SplitIoClient::Telemetry::MemoryInitProducer.new(config)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SplitIoClient
|
|
4
|
+
module Telemetry
|
|
5
|
+
class MemoryEvaluationConsumer
|
|
6
|
+
def initialize(config)
|
|
7
|
+
@config = config
|
|
8
|
+
@adapter = config.telemetry_adapter
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def pop_latencies
|
|
12
|
+
to_return = @adapter.latencies.each_with_object({}) do |latency, memo|
|
|
13
|
+
memo[latency[:method]] = latency[:latencies]
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
@adapter.init_latencies
|
|
17
|
+
|
|
18
|
+
to_return
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def pop_exceptions
|
|
22
|
+
to_return = @adapter.exceptions.each_with_object({}) do |exception, memo|
|
|
23
|
+
memo[exception[:method]] = exception[:exceptions].value
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
@adapter.init_exceptions
|
|
27
|
+
|
|
28
|
+
to_return
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SplitIoClient
|
|
4
|
+
module Telemetry
|
|
5
|
+
class MemoryEvaluationProducer
|
|
6
|
+
def initialize(config)
|
|
7
|
+
@config = config
|
|
8
|
+
@adapter = config.telemetry_adapter
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def record_latency(method, bucket)
|
|
12
|
+
@adapter.latencies.find { |l| l[:method] == method }[:latencies][bucket] += 1
|
|
13
|
+
rescue StandardError => e
|
|
14
|
+
@config.log_found_exception(__method__.to_s, e)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def record_exception(method)
|
|
18
|
+
@adapter.exceptions.find { |l| l[:method] == method }[:exceptions].increment
|
|
19
|
+
rescue StandardError => e
|
|
20
|
+
@config.log_found_exception(__method__.to_s, e)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SplitIoClient
|
|
4
|
+
module Telemetry
|
|
5
|
+
class MemoryInitConsumer
|
|
6
|
+
DEFAULT_VALUE = 0
|
|
7
|
+
|
|
8
|
+
def initialize(config)
|
|
9
|
+
@config = config
|
|
10
|
+
@adapter = config.telemetry_adapter
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def non_ready_usages
|
|
14
|
+
find_counts(Domain::Constants::NON_READY_USAGES)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def bur_timeouts
|
|
18
|
+
find_counts(Domain::Constants::BUR_TIMEOUT)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
def find_counts(action)
|
|
24
|
+
@adapter.factory_counters.find { |l| l[:action] == action }[:counts].value
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SplitIoClient
|
|
4
|
+
module Telemetry
|
|
5
|
+
class MemoryInitProducer
|
|
6
|
+
def initialize(config)
|
|
7
|
+
@config = config
|
|
8
|
+
@adapter = config.telemetry_adapter
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def record_config
|
|
12
|
+
# no op
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def record_bur_timeout
|
|
16
|
+
find_factory_counters(Domain::Constants::BUR_TIMEOUT)[:counts].increment
|
|
17
|
+
rescue StandardError => e
|
|
18
|
+
@config.log_found_exception(__method__.to_s, e)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def record_non_ready_usages
|
|
22
|
+
find_factory_counters(Domain::Constants::NON_READY_USAGES)[:counts].increment
|
|
23
|
+
rescue StandardError => e
|
|
24
|
+
@config.log_found_exception(__method__.to_s, e)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
private
|
|
28
|
+
|
|
29
|
+
def find_factory_counters(action)
|
|
30
|
+
@adapter.factory_counters.find { |l| l[:action] == action }
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SplitIoClient
|
|
4
|
+
module Telemetry
|
|
5
|
+
class MemoryRuntimeConsumer
|
|
6
|
+
DEFAULT_VALUE = 0
|
|
7
|
+
|
|
8
|
+
def initialize(config)
|
|
9
|
+
@config = config
|
|
10
|
+
@adapter = config.telemetry_adapter
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def pop_tags
|
|
14
|
+
to_return = @adapter.tags
|
|
15
|
+
|
|
16
|
+
@adapter.init_tags
|
|
17
|
+
|
|
18
|
+
to_return
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def impressions_stats(type)
|
|
22
|
+
@adapter.impressions_data_records.find { |l| l[:type] == type }[:value].value
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def events_stats(type)
|
|
26
|
+
@adapter.events_data_records.find { |l| l[:type] == type }[:value].value
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def last_synchronizations
|
|
30
|
+
splits = find_last_synchronization(Domain::Constants::SPLIT_SYNC)
|
|
31
|
+
segments = find_last_synchronization(Domain::Constants::SEGMENT_SYNC)
|
|
32
|
+
impressions = find_last_synchronization(Domain::Constants::IMPRESSIONS_SYNC)
|
|
33
|
+
imp_count = find_last_synchronization(Domain::Constants::IMPRESSION_COUNT_SYNC)
|
|
34
|
+
events = find_last_synchronization(Domain::Constants::EVENT_SYNC)
|
|
35
|
+
telemetry = find_last_synchronization(Domain::Constants::TELEMETRY_SYNC)
|
|
36
|
+
token = find_last_synchronization(Domain::Constants::TOKEN_SYNC)
|
|
37
|
+
|
|
38
|
+
LastSynchronization.new(splits, segments, impressions, imp_count, events, telemetry, token)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def pop_http_errors
|
|
42
|
+
splits = find_http_errors(Domain::Constants::SPLIT_SYNC)
|
|
43
|
+
segments = find_http_errors(Domain::Constants::SEGMENT_SYNC)
|
|
44
|
+
impressions = find_http_errors(Domain::Constants::IMPRESSIONS_SYNC)
|
|
45
|
+
imp_count = find_http_errors(Domain::Constants::IMPRESSION_COUNT_SYNC)
|
|
46
|
+
events = find_http_errors(Domain::Constants::EVENT_SYNC)
|
|
47
|
+
telemetry = find_http_errors(Domain::Constants::TELEMETRY_SYNC)
|
|
48
|
+
token = find_http_errors(Domain::Constants::TOKEN_SYNC)
|
|
49
|
+
|
|
50
|
+
@adapter.init_http_errors
|
|
51
|
+
|
|
52
|
+
HttpErrors.new(splits, segments, impressions, imp_count, events, telemetry, token)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def pop_http_latencies
|
|
56
|
+
splits = find_http_latencies(Domain::Constants::SPLIT_SYNC)
|
|
57
|
+
segments = find_http_latencies(Domain::Constants::SEGMENT_SYNC)
|
|
58
|
+
impressions = find_http_latencies(Domain::Constants::IMPRESSIONS_SYNC)
|
|
59
|
+
imp_count = find_http_latencies(Domain::Constants::IMPRESSION_COUNT_SYNC)
|
|
60
|
+
events = find_http_latencies(Domain::Constants::EVENT_SYNC)
|
|
61
|
+
telemetry = find_http_latencies(Domain::Constants::TELEMETRY_SYNC)
|
|
62
|
+
token = find_http_latencies(Domain::Constants::TOKEN_SYNC)
|
|
63
|
+
|
|
64
|
+
@adapter.init_http_latencies
|
|
65
|
+
|
|
66
|
+
HttpLatencies.new(splits, segments, impressions, imp_count, events, telemetry, token)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def pop_auth_rejections
|
|
70
|
+
to_return = @adapter.auth_rejections
|
|
71
|
+
|
|
72
|
+
@adapter.init_auth_rejections
|
|
73
|
+
|
|
74
|
+
to_return.value
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def pop_token_refreshes
|
|
78
|
+
to_return = @adapter.token_refreshes
|
|
79
|
+
|
|
80
|
+
@adapter.init_token_refreshes
|
|
81
|
+
|
|
82
|
+
to_return.value
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def pop_streaming_events
|
|
86
|
+
events = @adapter.streaming_events
|
|
87
|
+
|
|
88
|
+
@adapter.init_streaming_events.map
|
|
89
|
+
|
|
90
|
+
events
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def session_length
|
|
94
|
+
@adapter.session_length.value
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def pop_updates_from_sse
|
|
98
|
+
splits = @adapter.updates_from_sse[Domain::Constants::SPLITS]
|
|
99
|
+
@adapter.updates_from_sse[Domain::Constants::SPLITS] = 0
|
|
100
|
+
|
|
101
|
+
UpdatesFromSSE.new(splits)
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
private
|
|
105
|
+
|
|
106
|
+
def find_last_synchronization(type)
|
|
107
|
+
@adapter.last_synchronization.find { |l| l[:type] == type }[:value].value
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def find_http_errors(type)
|
|
111
|
+
@adapter.http_errors.find { |l| l[:type] == type }[:value]
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def find_http_latencies(type)
|
|
115
|
+
@adapter.http_latencies.find { |l| l[:type] == type }[:value]
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
end
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SplitIoClient
|
|
4
|
+
module Telemetry
|
|
5
|
+
class MemoryRuntimeProducer
|
|
6
|
+
def initialize(config)
|
|
7
|
+
@config = config
|
|
8
|
+
@adapter = config.telemetry_adapter
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def add_tag(tag)
|
|
12
|
+
return if tag.length >= 9
|
|
13
|
+
|
|
14
|
+
@adapter.tags << tag
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def record_impressions_stats(type, count)
|
|
18
|
+
@adapter.impressions_data_records.find { |l| l[:type] == type }[:value].value += count unless count.zero?
|
|
19
|
+
rescue StandardError => e
|
|
20
|
+
@config.log_found_exception(__method__.to_s, e)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def record_events_stats(type, count)
|
|
24
|
+
@adapter.events_data_records.find { |l| l[:type] == type }[:value].value += count unless count.zero?
|
|
25
|
+
rescue StandardError => e
|
|
26
|
+
@config.log_found_exception(__method__.to_s, e)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def record_successful_sync(type, value = nil)
|
|
30
|
+
value = (Time.now.to_f * 1000.0).to_i if value.nil?
|
|
31
|
+
|
|
32
|
+
@adapter.last_synchronization.find { |l| l[:type] == type }[:value] = Concurrent::AtomicFixnum.new(value)
|
|
33
|
+
rescue StandardError => e
|
|
34
|
+
@config.log_found_exception(__method__.to_s, e)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def record_sync_error(type, status)
|
|
38
|
+
http_errors = @adapter.http_errors.find { |l| l[:type] == type }[:value]
|
|
39
|
+
|
|
40
|
+
begin
|
|
41
|
+
http_errors[status] += 1
|
|
42
|
+
rescue StandardError => _e
|
|
43
|
+
http_errors[status] = 1
|
|
44
|
+
end
|
|
45
|
+
rescue StandardError => e
|
|
46
|
+
@config.log_found_exception(__method__.to_s, e)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def record_sync_latency(type, bucket)
|
|
50
|
+
@adapter.http_latencies.find { |l| l[:type] == type }[:value][bucket] += 1
|
|
51
|
+
rescue StandardError => e
|
|
52
|
+
@config.log_found_exception(__method__.to_s, e)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def record_auth_rejections
|
|
56
|
+
@adapter.auth_rejections.increment
|
|
57
|
+
rescue StandardError => e
|
|
58
|
+
@config.log_found_exception(__method__.to_s, e)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def record_token_refreshes
|
|
62
|
+
@adapter.token_refreshes.increment
|
|
63
|
+
rescue StandardError => e
|
|
64
|
+
@config.log_found_exception(__method__.to_s, e)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def record_streaming_event(type, data = nil, timestamp = nil)
|
|
68
|
+
timestamp ||= (Time.now.to_f * 1000.0).to_i
|
|
69
|
+
@adapter.streaming_events << { e: type, d: data, t: timestamp } unless @adapter.streaming_events.length >= 19
|
|
70
|
+
rescue StandardError => e
|
|
71
|
+
@config.log_found_exception(__method__.to_s, e)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def record_session_length(session)
|
|
75
|
+
@adapter.session_length.value = session
|
|
76
|
+
rescue StandardError => e
|
|
77
|
+
@config.log_found_exception(__method__.to_s, e)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def record_updates_from_sse(event)
|
|
81
|
+
@adapter.updates_from_sse[event] += 1
|
|
82
|
+
rescue StandardError => e
|
|
83
|
+
@config.log_found_exception(__method__.to_s, e)
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|