public abstract class EventProcessorBuilder extends java.lang.Object implements 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(5000).flushIntervalSeconds(2))
.build();
Note that this class is abstract; the actual implementation is created by calling Components.sendEvents()
.
Modifier and Type | Field and Description |
---|---|
protected boolean |
allAttributesPrivate |
protected int |
capacity |
static int |
DEFAULT_CAPACITY
The default value for
capacity(int) . |
static java.time.Duration |
DEFAULT_DIAGNOSTIC_RECORDING_INTERVAL
The default value for
diagnosticRecordingInterval(Duration) : 15 minutes. |
static java.time.Duration |
DEFAULT_FLUSH_INTERVAL
The default value for
flushInterval(Duration) : 5 seconds. |
static int |
DEFAULT_USER_KEYS_CAPACITY
The default value for
userKeysCapacity(int) . |
static java.time.Duration |
DEFAULT_USER_KEYS_FLUSH_INTERVAL
The default value for
userKeysFlushInterval(Duration) : 5 minutes. |
protected java.time.Duration |
diagnosticRecordingInterval |
protected ComponentConfigurer<EventSender> |
eventSenderConfigurer |
protected java.time.Duration |
flushInterval |
static java.time.Duration |
MIN_DIAGNOSTIC_RECORDING_INTERVAL
The minimum value for
diagnosticRecordingInterval(Duration) : 60 seconds. |
protected java.util.Set<AttributeRef> |
privateAttributes |
protected int |
userKeysCapacity |
protected java.time.Duration |
userKeysFlushInterval |
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 |
capacity(int capacity)
Set the capacity of the events buffer.
|
EventProcessorBuilder |
diagnosticRecordingInterval(java.time.Duration diagnosticRecordingInterval)
Sets the interval at which periodic diagnostic data is sent.
|
EventProcessorBuilder |
eventSender(ComponentConfigurer<EventSender> eventSenderConfigurer)
Specifies a custom implementation for event delivery.
|
EventProcessorBuilder |
flushInterval(java.time.Duration flushInterval)
Sets the interval between flushes of the event buffer.
|
EventProcessorBuilder |
privateAttributes(java.lang.String... attributeNames)
Marks a set of attribute names or subproperties as private.
|
EventProcessorBuilder |
userKeysCapacity(int userKeysCapacity)
Sets the number of user keys that the event processor can remember at any one time.
|
EventProcessorBuilder |
userKeysFlushInterval(java.time.Duration userKeysFlushInterval)
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
build
public static final int DEFAULT_CAPACITY
capacity(int)
.public static final java.time.Duration DEFAULT_DIAGNOSTIC_RECORDING_INTERVAL
diagnosticRecordingInterval(Duration)
: 15 minutes.public static final java.time.Duration DEFAULT_FLUSH_INTERVAL
flushInterval(Duration)
: 5 seconds.public static final int DEFAULT_USER_KEYS_CAPACITY
userKeysCapacity(int)
.public static final java.time.Duration DEFAULT_USER_KEYS_FLUSH_INTERVAL
userKeysFlushInterval(Duration)
: 5 minutes.public static final java.time.Duration MIN_DIAGNOSTIC_RECORDING_INTERVAL
diagnosticRecordingInterval(Duration)
: 60 seconds.protected boolean allAttributesPrivate
protected int capacity
protected java.time.Duration diagnosticRecordingInterval
protected java.time.Duration flushInterval
protected java.util.Set<AttributeRef> privateAttributes
protected int userKeysCapacity
protected java.time.Duration userKeysFlushInterval
protected ComponentConfigurer<EventSender> eventSenderConfigurer
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 privateAttributes(String...)
or on a per-user basis with
ContextBuilder
methods. By default, it is false
.
allAttributesPrivate
- true if all user attributes should be privateprivateAttributes(String...)
,
ContextBuilder
public 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 flushInterval(Duration)
, 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 diagnosticRecordingInterval(java.time.Duration diagnosticRecordingInterval)
The default value is DEFAULT_DIAGNOSTIC_RECORDING_INTERVAL
; the minimum value is
MIN_DIAGNOSTIC_RECORDING_INTERVAL
. This property is ignored if
LDConfig.Builder.diagnosticOptOut(boolean)
is set to true
.
diagnosticRecordingInterval
- the diagnostics interval; null to use the defaultLDConfig.Builder.diagnosticOptOut(boolean)
public EventProcessorBuilder eventSender(ComponentConfigurer<EventSender> eventSenderConfigurer)
The standard event delivery implementation sends event data via HTTP/HTTPS to the LaunchDarkly events
service endpoint (or any other endpoint specified with LDConfig.Builder.serviceEndpoints(ServiceEndpointsBuilder)
.
Providing a custom implementation may be useful in tests, or if the event data needs to be stored and forwarded.
eventSenderConfigurer
- a factory for an EventSender
implementationpublic EventProcessorBuilder flushInterval(java.time.Duration flushInterval)
Decreasing the flush interval means that the event buffer is less likely to reach capacity.
The default value is DEFAULT_FLUSH_INTERVAL
.
flushInterval
- the flush interval; null to use the defaultpublic EventProcessorBuilder privateAttributes(java.lang.String... attributeNames)
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.
If and only if a parameter starts with a slash, it is interpreted as a slash-delimited path that can denote a nested property within a JSON object. For instance, "/address/street" means that if there is an attribute called "address" that is a JSON object, and one of the object's properties is "street", the "street" property will be redacted from the analytics data but other properties within "address" will still be sent. This syntax also uses the JSON Pointer convention of escaping a literal slash character as "~1" and a tilde as "~0".
This method replaces any previous private attributes that were set on the same builder, rather than adding to them.
attributeNames
- a set of names or paths that will be removed from context data set to LaunchDarklyallAttributesPrivate(boolean)
,
ContextBuilder.privateAttributes(String...)
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 userKeysFlushInterval(Duration)
.
The default value is DEFAULT_USER_KEYS_CAPACITY
.
userKeysCapacity
- the maximum number of user keys to rememberpublic EventProcessorBuilder userKeysFlushInterval(java.time.Duration userKeysFlushInterval)
The default value is DEFAULT_USER_KEYS_FLUSH_INTERVAL
.
userKeysFlushInterval
- the flush interval; null to use the default