public abstract class EventProcessorBuilder extends java.lang.Object implements EventProcessorFactory
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(EventProcessorFactory)
:
LDConfig config = new LDConfig.Builder()
.events(Components.sendEvents().capacity(5000).flushIntervalSeconds(2))
.build();
These properties will override any equivalent deprecated properties that were set with LDConfig.Builder
,
such as LDConfig.Builder.capacity(int)
.
Note that this class is abstract; the actual implementation is created by calling Components.sendEvents()
.
Constructor and Description |
---|
EventProcessorBuilder() |
Modifier and Type | Method and Description |
---|---|
EventProcessorBuilder |
allAttributesPrivate(boolean allAttributesPrivate)
Sets whether or not all optional user attributes should be hidden from LaunchDarkly.
|
EventProcessorBuilder |
baseURI(java.net.URI baseURI)
Sets a custom base URI for the events service.
|
EventProcessorBuilder |
capacity(int capacity)
Set the capacity of the events buffer.
|
EventProcessorBuilder |
diagnosticRecordingIntervalSeconds(int diagnosticRecordingIntervalSeconds)
Sets the interval at which periodic diagnostic data is sent.
|
EventProcessorBuilder |
eventSender(EventSenderFactory eventSenderFactory)
Specifies a custom implementation for event delivery.
|
EventProcessorBuilder |
flushIntervalSeconds(int flushIntervalSeconds)
Sets the interval between flushes of the event buffer.
|
EventProcessorBuilder |
inlineUsersInEvents(boolean inlineUsersInEvents)
Sets whether to include full user details in every analytics event.
|
EventProcessorBuilder |
privateAttributeNames(java.lang.String... attributeNames)
Marks a set of attribute names as private.
|
EventProcessorBuilder |
userKeysCapacity(int userKeysCapacity)
Sets the number of user keys that the event processor can remember at any one time.
|
EventProcessorBuilder |
userKeysFlushIntervalSeconds(int userKeysFlushIntervalSeconds)
Sets the interval at which the event processor will reset its cache of known user keys.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createEventProcessor
public static final int DEFAULT_CAPACITY
capacity(int)
.public static final int DEFAULT_DIAGNOSTIC_RECORDING_INTERVAL_SECONDS
diagnosticRecordingIntervalSeconds(int)
.public static final int DEFAULT_FLUSH_INTERVAL_SECONDS
flushIntervalSeconds(int)
.public static final int DEFAULT_USER_KEYS_CAPACITY
userKeysCapacity(int)
.public static final int DEFAULT_USER_KEYS_FLUSH_INTERVAL_SECONDS
userKeysFlushIntervalSeconds(int)
.public static final int MIN_DIAGNOSTIC_RECORDING_INTERVAL_SECONDS
diagnosticRecordingIntervalSeconds(int)
.protected boolean allAttributesPrivate
protected java.net.URI baseURI
protected int capacity
protected int diagnosticRecordingIntervalSeconds
protected int flushIntervalSeconds
protected boolean inlineUsersInEvents
protected java.util.Set<java.lang.String> privateAttrNames
protected int userKeysCapacity
protected int userKeysFlushIntervalSeconds
protected EventSenderFactory eventSenderFactory
public EventProcessorBuilder allAttributesPrivate(boolean allAttributesPrivate)
If this is true
, all user attribute values (other than the key) will be private, not just
the attributes specified in privateAttributeNames(String...)
or on a per-user basis with
LDUser.Builder
methods. By default, it is false
.
allAttributesPrivate
- true if all user attributes should be privateprivateAttributeNames(String...)
,
LDUser.Builder
public EventProcessorBuilder baseURI(java.net.URI baseURI)
You will only need to change this value in the following cases:
streamUri
to the base URI of the Relay Proxy instance.
baseURI
- the base URI of the events service; null to use the defaultpublic EventProcessorBuilder capacity(int capacity)
The client buffers up to this many events in memory before flushing. If the capacity is exceeded before
the buffer is flushed (see flushIntervalSeconds(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
.
capacity
- the capacity of the event bufferpublic EventProcessorBuilder diagnosticRecordingIntervalSeconds(int diagnosticRecordingIntervalSeconds)
The default value is DEFAULT_DIAGNOSTIC_RECORDING_INTERVAL_SECONDS
; the minimum value is
MIN_DIAGNOSTIC_RECORDING_INTERVAL_SECONDS
. This property is ignored if
LDConfig.Builder.diagnosticOptOut(boolean)
is set to true
.
diagnosticRecordingIntervalSeconds
- the diagnostics interval in secondsLDConfig.Builder.diagnosticOptOut(boolean)
public EventProcessorBuilder eventSender(EventSenderFactory eventSenderFactory)
The standard event delivery implementation sends event data via HTTP/HTTPS to the LaunchDarkly events
service endpoint (or any other endpoint specified with baseURI(URI)
. Providing a custom
implementation may be useful in tests, or if the event data needs to be stored and forwarded.
eventSenderFactory
- a factory for an EventSender
implementationpublic EventProcessorBuilder flushIntervalSeconds(int flushIntervalSeconds)
Decreasing the flush interval means that the event buffer is less likely to reach capacity.
The default value is DEFAULT_FLUSH_INTERVAL_SECONDS
.
flushIntervalSeconds
- the flush interval in secondspublic EventProcessorBuilder inlineUsersInEvents(boolean inlineUsersInEvents)
The default is false
: events will only include the user key, except for one "index" event
that provides the full details for the user).
inlineUsersInEvents
- true if you want full user details in each eventpublic EventProcessorBuilder privateAttributeNames(java.lang.String... attributeNames)
Any users 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 user with LDUser.Builder
methods.
attributeNames
- a set of names that will be removed from user data set to LaunchDarklyallAttributesPrivate(boolean)
,
LDUser.Builder
public EventProcessorBuilder userKeysCapacity(int userKeysCapacity)
To avoid sending duplicate user details in analytics events, the SDK maintains a cache of
recently seen user keys, expiring at an interval set by userKeysFlushIntervalSeconds(int)
.
The default value is DEFAULT_USER_KEYS_CAPACITY
.
userKeysCapacity
- the maximum number of user keys to rememberpublic EventProcessorBuilder userKeysFlushIntervalSeconds(int userKeysFlushIntervalSeconds)
The default value is DEFAULT_USER_KEYS_FLUSH_INTERVAL_SECONDS
.
userKeysFlushIntervalSeconds
- the flush interval in seconds