Module: LaunchDarkly

Defined in:
lib/ldclient-rb.rb,
lib/ldclient-rb/impl.rb,
lib/ldclient-rb/util.rb,
lib/ldclient-rb/config.rb,
lib/ldclient-rb/events.rb,
lib/ldclient-rb/stream.rb,
lib/ldclient-rb/polling.rb,
lib/ldclient-rb/version.rb,
lib/ldclient-rb/ldclient.rb,
lib/ldclient-rb/newrelic.rb,
lib/ldclient-rb/impl/util.rb,
lib/ldclient-rb/requestor.rb,
lib/ldclient-rb/interfaces.rb,
lib/ldclient-rb/cache_store.rb,
lib/ldclient-rb/flags_state.rb,
lib/ldclient-rb/redis_store.rb,
lib/ldclient-rb/user_filter.rb,
lib/ldclient-rb/integrations.rb,
lib/ldclient-rb/expiring_cache.rb,
lib/ldclient-rb/impl/evaluator.rb,
lib/ldclient-rb/memoized_value.rb,
lib/ldclient-rb/in_memory_store.rb,
lib/ldclient-rb/event_summarizer.rb,
lib/ldclient-rb/file_data_source.rb,
lib/ldclient-rb/simple_lru_cache.rb,
lib/ldclient-rb/evaluation_detail.rb,
lib/ldclient-rb/impl/event_sender.rb,
lib/ldclient-rb/impl/event_factory.rb,
lib/ldclient-rb/integrations/redis.rb,
lib/ldclient-rb/impl/unbounded_pool.rb,
lib/ldclient-rb/integrations/consul.rb,
lib/ldclient-rb/integrations/dynamodb.rb,
lib/ldclient-rb/impl/diagnostic_events.rb,
lib/ldclient-rb/impl/evaluator_bucketing.rb,
lib/ldclient-rb/impl/evaluator_operators.rb,
lib/ldclient-rb/impl/model/serialization.rb,
lib/ldclient-rb/non_blocking_thread_pool.rb,
lib/ldclient-rb/impl/store_client_wrapper.rb,
lib/ldclient-rb/impl/store_data_set_sorter.rb,
lib/ldclient-rb/impl/integrations/redis_impl.rb,
lib/ldclient-rb/impl/integrations/consul_impl.rb,
lib/ldclient-rb/impl/integrations/dynamodb_impl.rb,
lib/ldclient-rb/integrations/util/store_wrapper.rb

Overview

Analytics event processing in the SDK involves several components. The purpose of this design is to minimize overhead on the application threads that are generating analytics events.

EventProcessor receives an analytics event from the SDK client, on an application thread. It places the event in a bounded queue, the “inbox”, and immediately returns.

On a separate worker thread, EventDispatcher consumes events from the inbox. These are considered “input events” because they may or may not actually be sent to LaunchDarkly; most flag evaluation events are not sent, but are counted and the counters become part of a single summary event. EventDispatcher updates those counters, creates “index” events for any users that have not been seen recently, and places any events that will be sent to LaunchDarkly into the “outbox” queue.

When it is time to flush events to LaunchDarkly, the contents of the outbox are handed off to another worker thread which sends the HTTP request.

Defined Under Namespace

Modules: Impl, Integrations, Interfaces, Util Classes: Config, DiagnosticEventMessage, EvaluationDetail, EvaluationReason, EventBuffer, EventDispatcher, EventMessage, EventOutputFormatter, EventProcessor, EventSummarizer, EventSummary, ExpiringCache, FeatureFlagsState, FileDataSource, FileDataSourceImpl, FlushMessage, FlushPayload, FlushUsersMessage, InMemoryFeatureStore, LDClient, LDNewRelic, MemoizedValue, NonBlockingThreadPool, NullEventProcessor, NullUpdateProcessor, PollingProcessor, RedisFeatureStore, Requestor, SimpleLRUCacheSet, StopMessage, StreamProcessor, SynchronousMessage, TestSyncMessage, ThreadSafeMemoryStore, UnexpectedResponseError, UserFilter

Constant Summary collapse

PUT =
:put
PATCH =
:patch
DELETE =
:delete
READ_TIMEOUT_SECONDS =
300
KEY_PATHS =
{
  FEATURES => "/flags/",
  SEGMENTS => "/segments/"
}
VERSION =
"6.1.0"
FEATURES =
{
  namespace: "features",
  priority: 1,  # that is, features should be stored after segments
  get_dependency_keys: lambda { |flag| (flag[:prerequisites] || []).map { |p| p[:key] } }
}.freeze
SEGMENTS =
{
  namespace: "segments",
  priority: 0
}.freeze
@@have_listen =

To avoid pulling in ‘listen’ and its transitive dependencies for people who aren’t using the file data source or who don’t need auto-updating, we only enable auto-update if the ‘listen’ gem has been provided by the host app.

false

Class Method Summary collapse

Class Method Details

.have_listen?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/ldclient-rb/file_data_source.rb', line 19

def self.have_listen?
  @@have_listen
end