Class: SplitIoClient::Telemetry::MemoryRuntimeConsumer
- Inherits:
-
Object
- Object
- SplitIoClient::Telemetry::MemoryRuntimeConsumer
- Defined in:
- lib/splitclient-rb/telemetry/memory/memory_runtime_consumer.rb
Constant Summary collapse
- DEFAULT_VALUE =
0
Instance Method Summary collapse
- #events_stats(type) ⇒ Object
- #impressions_stats(type) ⇒ Object
-
#initialize(config) ⇒ MemoryRuntimeConsumer
constructor
A new instance of MemoryRuntimeConsumer.
- #last_synchronizations ⇒ Object
- #pop_auth_rejections ⇒ Object
- #pop_http_errors ⇒ Object
- #pop_http_latencies ⇒ Object
- #pop_streaming_events ⇒ Object
- #pop_tags ⇒ Object
- #pop_token_refreshes ⇒ Object
- #pop_updates_from_sse ⇒ Object
- #session_length ⇒ Object
Constructor Details
#initialize(config) ⇒ MemoryRuntimeConsumer
Returns a new instance of MemoryRuntimeConsumer.
8 9 10 11 |
# File 'lib/splitclient-rb/telemetry/memory/memory_runtime_consumer.rb', line 8 def initialize(config) @config = config @adapter = config.telemetry_adapter end |
Instance Method Details
#events_stats(type) ⇒ Object
25 26 27 |
# File 'lib/splitclient-rb/telemetry/memory/memory_runtime_consumer.rb', line 25 def events_stats(type) @adapter.events_data_records.find { |l| l[:type] == type }[:value].value end |
#impressions_stats(type) ⇒ Object
21 22 23 |
# File 'lib/splitclient-rb/telemetry/memory/memory_runtime_consumer.rb', line 21 def impressions_stats(type) @adapter.impressions_data_records.find { |l| l[:type] == type }[:value].value end |
#last_synchronizations ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/splitclient-rb/telemetry/memory/memory_runtime_consumer.rb', line 29 def last_synchronizations splits = find_last_synchronization(Domain::Constants::SPLIT_SYNC) segments = find_last_synchronization(Domain::Constants::SEGMENT_SYNC) impressions = find_last_synchronization(Domain::Constants::IMPRESSIONS_SYNC) imp_count = find_last_synchronization(Domain::Constants::IMPRESSION_COUNT_SYNC) events = find_last_synchronization(Domain::Constants::EVENT_SYNC) telemetry = find_last_synchronization(Domain::Constants::TELEMETRY_SYNC) token = find_last_synchronization(Domain::Constants::TOKEN_SYNC) LastSynchronization.new(splits, segments, impressions, imp_count, events, telemetry, token) end |
#pop_auth_rejections ⇒ Object
69 70 71 72 73 74 75 |
# File 'lib/splitclient-rb/telemetry/memory/memory_runtime_consumer.rb', line 69 def pop_auth_rejections to_return = @adapter.auth_rejections @adapter.init_auth_rejections to_return.value end |
#pop_http_errors ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/splitclient-rb/telemetry/memory/memory_runtime_consumer.rb', line 41 def pop_http_errors splits = find_http_errors(Domain::Constants::SPLIT_SYNC) segments = find_http_errors(Domain::Constants::SEGMENT_SYNC) impressions = find_http_errors(Domain::Constants::IMPRESSIONS_SYNC) imp_count = find_http_errors(Domain::Constants::IMPRESSION_COUNT_SYNC) events = find_http_errors(Domain::Constants::EVENT_SYNC) telemetry = find_http_errors(Domain::Constants::TELEMETRY_SYNC) token = find_http_errors(Domain::Constants::TOKEN_SYNC) @adapter.init_http_errors HttpErrors.new(splits, segments, impressions, imp_count, events, telemetry, token) end |
#pop_http_latencies ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/splitclient-rb/telemetry/memory/memory_runtime_consumer.rb', line 55 def pop_http_latencies splits = find_http_latencies(Domain::Constants::SPLIT_SYNC) segments = find_http_latencies(Domain::Constants::SEGMENT_SYNC) impressions = find_http_latencies(Domain::Constants::IMPRESSIONS_SYNC) imp_count = find_http_latencies(Domain::Constants::IMPRESSION_COUNT_SYNC) events = find_http_latencies(Domain::Constants::EVENT_SYNC) telemetry = find_http_latencies(Domain::Constants::TELEMETRY_SYNC) token = find_http_latencies(Domain::Constants::TOKEN_SYNC) @adapter.init_http_latencies HttpLatencies.new(splits, segments, impressions, imp_count, events, telemetry, token) end |
#pop_streaming_events ⇒ Object
85 86 87 88 89 90 91 |
# File 'lib/splitclient-rb/telemetry/memory/memory_runtime_consumer.rb', line 85 def pop_streaming_events events = @adapter.streaming_events @adapter.init_streaming_events.map events end |
#pop_tags ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/splitclient-rb/telemetry/memory/memory_runtime_consumer.rb', line 13 def to_return = @adapter. @adapter. to_return end |
#pop_token_refreshes ⇒ Object
77 78 79 80 81 82 83 |
# File 'lib/splitclient-rb/telemetry/memory/memory_runtime_consumer.rb', line 77 def pop_token_refreshes to_return = @adapter.token_refreshes @adapter.init_token_refreshes to_return.value end |
#pop_updates_from_sse ⇒ Object
97 98 99 100 101 102 |
# File 'lib/splitclient-rb/telemetry/memory/memory_runtime_consumer.rb', line 97 def pop_updates_from_sse splits = @adapter.updates_from_sse[Domain::Constants::SPLITS] @adapter.updates_from_sse[Domain::Constants::SPLITS] = 0 UpdatesFromSSE.new(splits) end |
#session_length ⇒ Object
93 94 95 |
# File 'lib/splitclient-rb/telemetry/memory/memory_runtime_consumer.rb', line 93 def session_length @adapter.session_length.value end |