Class EventProcessorBuilder
Contains methods for configuring delivery of analytics events.
Inherited Members
Namespace: LaunchDarkly.Sdk.Client.Integrations
Assembly: LaunchDarkly.ClientSdk.dll
Syntax
public sealed class EventProcessorBuilder : IComponentConfigurer<IEventProcessor>, IDiagnosticDescription
Remarks
The SDK normally buffers analytics events and sends them to LaunchDarkly at intervals. If you want to customize this behavior, create a builder with SendEvents(), change its properties with the methods of this class, and pass it to Events(IComponentConfigurer<IEventProcessor>).
Examples
var config = Configuration.Builder(sdkKey)
.Events(
Components.SendEvents().Capacity(5000).FlushInterval(TimeSpan.FromSeconds(2))
)
.Build();
Constructors
View SourceEventProcessorBuilder()
Declaration
public EventProcessorBuilder()
Fields
| Edit this page View SourceDefaultCapacity
The default value for Capacity(int).
Declaration
public const int DefaultCapacity = 100
Field Value
Type | Description |
---|---|
int |
DefaultDiagnosticRecordingInterval
The default value for DiagnosticRecordingInterval(TimeSpan).
Declaration
public static readonly TimeSpan DefaultDiagnosticRecordingInterval
Field Value
Type | Description |
---|---|
TimeSpan |
DefaultFlushInterval
The default value for FlushInterval(TimeSpan).
Declaration
public static readonly TimeSpan DefaultFlushInterval
Field Value
Type | Description |
---|---|
TimeSpan |
Remarks
For Android and iOS, this is 30 seconds. For all other platforms, it is 5 seconds. The difference is because the extra HTTP requests for sending events more frequently are undesirable in a mobile application as opposed to a desktop application.
MinimumDiagnosticRecordingInterval
The minimum value for DiagnosticRecordingInterval(TimeSpan): 5 minutes.
Declaration
public static readonly TimeSpan MinimumDiagnosticRecordingInterval
Field Value
Type | Description |
---|---|
TimeSpan |
Methods
| Edit this page View SourceAllAttributesPrivate(bool)
Sets whether or not all optional user attributes should be hidden from LaunchDarkly.
Declaration
public EventProcessorBuilder AllAttributesPrivate(bool allAttributesPrivate)
Parameters
Type | Name | Description |
---|---|---|
bool | allAttributesPrivate | true if all user attributes should be private |
Returns
Type | Description |
---|---|
EventProcessorBuilder | the builder |
Remarks
If this is true, all user attribute values (other than the key) will be private, not just the attributes specified in PrivateAttributes(params string[]) or on a per-user basis with LaunchDarkly.Sdk.UserBuilder methods. By default, it is false.
Build(LdClientContext)
Called internally by the SDK to create an implementation instance. Applications should not need to call this method.
Declaration
public IEventProcessor Build(LdClientContext context)
Parameters
Type | Name | Description |
---|---|---|
LdClientContext | context | provides configuration properties and other components from the current SDK client instance |
Returns
Type | Description |
---|---|
IEventProcessor | a instance of the component type |
Capacity(int)
Sets the capacity of the events buffer.
Declaration
public EventProcessorBuilder Capacity(int capacity)
Parameters
Type | Name | Description |
---|---|---|
int | capacity | the capacity of the event buffer |
Returns
Type | Description |
---|---|
EventProcessorBuilder | the builder |
Remarks
The client buffers up to this many events in memory before flushing. If the capacity is exceeded before the buffer is flushed (see FlushInterval(TimeSpan)), 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 DefaultCapacity. A zero or negative value will be changed to the default.
DescribeConfiguration(LdClientContext)
Called internally by the SDK to inspect the configuration. Applications do not need to call this method.
Declaration
public LdValue DescribeConfiguration(LdClientContext context)
Parameters
Type | Name | Description |
---|---|---|
LdClientContext | context | the context object that may provide relevant configuration details |
Returns
Type | Description |
---|---|
LdValue | a JSON value |
DiagnosticRecordingInterval(TimeSpan)
Sets the interval at which periodic diagnostic data is sent.
Declaration
public EventProcessorBuilder DiagnosticRecordingInterval(TimeSpan diagnosticRecordingInterval)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | diagnosticRecordingInterval | the diagnostics interval |
Returns
Type | Description |
---|---|
EventProcessorBuilder | the builder |
Remarks
The default value is DefaultDiagnosticRecordingInterval; the minimum value is MinimumDiagnosticRecordingInterval. This property is ignored if DiagnosticOptOut(bool) is set to true.
FlushInterval(TimeSpan)
Sets the interval between flushes of the event buffer.
Declaration
public EventProcessorBuilder FlushInterval(TimeSpan flushInterval)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | flushInterval | the flush interval |
Returns
Type | Description |
---|---|
EventProcessorBuilder | the builder |
Remarks
Decreasing the flush interval means that the event buffer is less likely to reach capacity. The default value is DefaultFlushInterval. A zero or negative value will be changed to the default.
PrivateAttributes(params string[])
Marks a set of attribute names as private.
Declaration
public EventProcessorBuilder PrivateAttributes(params string[] attributes)
Parameters
Type | Name | Description |
---|---|---|
string[] | attributes | a set of attributes that will be removed from context data set to LaunchDarkly |
Returns
Type | Description |
---|---|
EventProcessorBuilder | the builder |
Remarks
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.