Class EventProcessorBuilder

java.lang.Object
com.launchdarkly.sdk.android.integrations.EventProcessorBuilder
All Implemented Interfaces:
ComponentConfigurer<EventProcessor>

public abstract class EventProcessorBuilder extends Object implements ComponentConfigurer<EventProcessor>
Contains methods for configuring delivery of analytics events.

The SDK normally buffers analytics events and sends them to LaunchDarkly at intervals. If you want to customize this behavior, create a builder with Components.sendEvents(), change its properties with the methods of this class, and pass it to LDConfig.Builder.events(ComponentConfigurer):


     LDConfig config = new LDConfig.Builder()
         .events(Components.sendEvents().capacity(500).flushIntervalMillis(2000))
         .build();
 

Note that this class is abstract; the actual implementation is created by calling Components.sendEvents().

Since:
3.3.0
  • Field Details

    • DEFAULT_CAPACITY

      public static final int DEFAULT_CAPACITY
      The default value for capacity(int).
      See Also:
    • DEFAULT_DIAGNOSTIC_RECORDING_INTERVAL_MILLIS

      public static final int DEFAULT_DIAGNOSTIC_RECORDING_INTERVAL_MILLIS
      The default value for diagnosticRecordingIntervalMillis(int): 15 minutes.
      See Also:
    • DEFAULT_FLUSH_INTERVAL_MILLIS

      public static final int DEFAULT_FLUSH_INTERVAL_MILLIS
      The default value for flushIntervalMillis(int): 30 seconds.
      See Also:
    • MIN_DIAGNOSTIC_RECORDING_INTERVAL_MILLIS

      public static final int MIN_DIAGNOSTIC_RECORDING_INTERVAL_MILLIS
      The minimum value for diagnosticRecordingIntervalMillis(int): 5 minutes.
      See Also:
    • allAttributesPrivate

      protected boolean allAttributesPrivate
      All attributes should be treated as private
    • capacity

      protected int capacity
      The capacity of the event buffer
    • diagnosticRecordingIntervalMillis

      protected int diagnosticRecordingIntervalMillis
      The diagnostic interval in millis
    • flushIntervalMillis

      protected int flushIntervalMillis
      The flush interval in millis
    • privateAttributes

      protected Set<AttributeRef> privateAttributes
      Set of attributes by reference that will be treated as private
  • Constructor Details

    • EventProcessorBuilder

      public EventProcessorBuilder()
  • Method Details

    • allAttributesPrivate

      public EventProcessorBuilder allAttributesPrivate(boolean allAttributesPrivate)
      Sets whether or not all optional context attributes should be hidden from LaunchDarkly.

      If this is true, all context attribute values (other than the key) will be private, not just the attributes specified in privateAttributes(String...). By default, it is false.

      Parameters:
      allAttributesPrivate - true if all context attributes should be private
      Returns:
      the builder
      See Also:
    • capacity

      public EventProcessorBuilder capacity(int capacity)
      Set the capacity of the events buffer.

      The client buffers up to this many events in memory before flushing. If the capacity is exceeded before the buffer is flushed (see flushIntervalMillis(int), events will be discarded. Increasing the capacity means that events are less likely to be discarded, at the cost of consuming more memory.

      The default value is DEFAULT_CAPACITY.

      Parameters:
      capacity - the capacity of the event buffer
      Returns:
      the builder
    • diagnosticRecordingIntervalMillis

      public EventProcessorBuilder diagnosticRecordingIntervalMillis(int diagnosticRecordingIntervalMillis)
      Sets the interval at which periodic diagnostic data is sent.

      The default value is DEFAULT_DIAGNOSTIC_RECORDING_INTERVAL_MILLIS; the minimum value is MIN_DIAGNOSTIC_RECORDING_INTERVAL_MILLIS. This property is ignored if LDConfig.Builder.diagnosticOptOut(boolean) is set to true.

      Parameters:
      diagnosticRecordingIntervalMillis - the diagnostics interval in milliseconds
      Returns:
      the builder
    • flushIntervalMillis

      public EventProcessorBuilder flushIntervalMillis(int flushIntervalMillis)
      Sets the interval between flushes of the event buffer.

      Decreasing the flush interval means that the event buffer is less likely to reach capacity.

      The default value is DEFAULT_FLUSH_INTERVAL_MILLIS.

      Parameters:
      flushIntervalMillis - the flush interval in milliseconds
      Returns:
      the builder
    • privateAttributes

      public EventProcessorBuilder privateAttributes(String... attributeNames)
      Marks a set of attribute names or subproperties as private.

      Any contexts sent to LaunchDarkly with this configuration active will have attributes with these names removed. This is in addition to any attributes that were marked as private for an individual context with ContextBuilder methods.

      This method replaces any previous private attributes that were set on the same builder, rather than adding to them.

      Parameters:
      attributeNames - a set of attribute names that will be removed from context data set to LaunchDarkly
      Returns:
      the builder
      See Also: