Class EventProcessorBuilder
- All Implemented Interfaces:
ComponentConfigurer<EventProcessor>
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 Summary
Modifier and TypeFieldDescriptionprotected boolean
All attributes should be treated as privateprotected int
The capacity of the event bufferstatic final int
The default value forcapacity(int)
.static final int
The default value fordiagnosticRecordingIntervalMillis(int)
: 15 minutes.static final int
The default value forflushIntervalMillis(int)
: 30 seconds.protected int
The diagnostic interval in millisprotected int
The flush interval in millisstatic final int
The minimum value fordiagnosticRecordingIntervalMillis(int)
: 5 minutes.protected Set<AttributeRef>
Set of attributes by reference that will be treated as private -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionallAttributesPrivate
(boolean allAttributesPrivate) Sets whether or not all optional context attributes should be hidden from LaunchDarkly.capacity
(int capacity) Set the capacity of the events buffer.diagnosticRecordingIntervalMillis
(int diagnosticRecordingIntervalMillis) Sets the interval at which periodic diagnostic data is sent.flushIntervalMillis
(int flushIntervalMillis) Sets the interval between flushes of the event buffer.privateAttributes
(String... attributeNames) Marks a set of attribute names or subproperties as private.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.launchdarkly.sdk.android.subsystems.ComponentConfigurer
build
-
Field Details
-
DEFAULT_CAPACITY
public static final int DEFAULT_CAPACITYThe default value forcapacity(int)
.- See Also:
-
DEFAULT_DIAGNOSTIC_RECORDING_INTERVAL_MILLIS
public static final int DEFAULT_DIAGNOSTIC_RECORDING_INTERVAL_MILLISThe default value fordiagnosticRecordingIntervalMillis(int)
: 15 minutes.- See Also:
-
DEFAULT_FLUSH_INTERVAL_MILLIS
public static final int DEFAULT_FLUSH_INTERVAL_MILLISThe default value forflushIntervalMillis(int)
: 30 seconds.- See Also:
-
MIN_DIAGNOSTIC_RECORDING_INTERVAL_MILLIS
public static final int MIN_DIAGNOSTIC_RECORDING_INTERVAL_MILLISThe minimum value fordiagnosticRecordingIntervalMillis(int)
: 5 minutes.- See Also:
-
allAttributesPrivate
protected boolean allAttributesPrivateAll attributes should be treated as private -
capacity
protected int capacityThe capacity of the event buffer -
diagnosticRecordingIntervalMillis
protected int diagnosticRecordingIntervalMillisThe diagnostic interval in millis -
flushIntervalMillis
protected int flushIntervalMillisThe flush interval in millis -
privateAttributes
Set of attributes by reference that will be treated as private
-
-
Constructor Details
-
EventProcessorBuilder
public EventProcessorBuilder()
-
-
Method Details
-
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 inprivateAttributes(String...)
. By default, it isfalse
.- Parameters:
allAttributesPrivate
- true if all context attributes should be private- Returns:
- the builder
- See Also:
-
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 isMIN_DIAGNOSTIC_RECORDING_INTERVAL_MILLIS
. This property is ignored ifLDConfig.Builder.diagnosticOptOut(boolean)
is set totrue
.- Parameters:
diagnosticRecordingIntervalMillis
- the diagnostics interval in milliseconds- Returns:
- the builder
-
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
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:
-