Skip to content

Commit 0c62aa0

Browse files
meghans-cashadrwmhickman
authored andcommitted
Add new field to LD configs to configure event capacity
This PR adds a new field, `event_capacity`, to the LaunchDarklyConfig. If no event capacity is passed, then it will use the [default capacity](https://launchdarkly.github.io/java-core/lib/sdk/server/constant-values.html#com.launchdarkly.sdk.server.integrations.EventProcessorBuilder.DEFAULT_CAPACITY) as defined by LaunchDarkly. --------- Co-authored-by: Andrew (Paradi) Alexander <[email protected]> Co-authored-by: Matt Hickman <[email protected]> GitOrigin-RevId: a89a1808b93e01320f8056f6def4196c0b55af1e
1 parent 6df3d4a commit 0c62aa0

File tree

5 files changed

+19
-8
lines changed

5 files changed

+19
-8
lines changed

misk-launchdarkly/api/misk-launchdarkly.api

+6-3
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@ public final class misk/feature/launchdarkly/LaunchDarklyConfig : wisp/config/Co
22
public fun <init> (Ljava/lang/String;Ljava/lang/String;)V
33
public fun <init> (Ljava/lang/String;Ljava/lang/String;Z)V
44
public fun <init> (Ljava/lang/String;Ljava/lang/String;ZLmisk/client/HttpClientSSLConfig;)V
5-
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;ZLmisk/client/HttpClientSSLConfig;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
5+
public fun <init> (Ljava/lang/String;Ljava/lang/String;ZLmisk/client/HttpClientSSLConfig;Ljava/lang/Integer;)V
6+
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;ZLmisk/client/HttpClientSSLConfig;Ljava/lang/Integer;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
67
public final fun component1 ()Ljava/lang/String;
78
public final fun component2 ()Ljava/lang/String;
89
public final fun component3 ()Z
910
public final fun component4 ()Lmisk/client/HttpClientSSLConfig;
10-
public final fun copy (Ljava/lang/String;Ljava/lang/String;ZLmisk/client/HttpClientSSLConfig;)Lmisk/feature/launchdarkly/LaunchDarklyConfig;
11-
public static synthetic fun copy$default (Lmisk/feature/launchdarkly/LaunchDarklyConfig;Ljava/lang/String;Ljava/lang/String;ZLmisk/client/HttpClientSSLConfig;ILjava/lang/Object;)Lmisk/feature/launchdarkly/LaunchDarklyConfig;
11+
public final fun component5 ()Ljava/lang/Integer;
12+
public final fun copy (Ljava/lang/String;Ljava/lang/String;ZLmisk/client/HttpClientSSLConfig;Ljava/lang/Integer;)Lmisk/feature/launchdarkly/LaunchDarklyConfig;
13+
public static synthetic fun copy$default (Lmisk/feature/launchdarkly/LaunchDarklyConfig;Ljava/lang/String;Ljava/lang/String;ZLmisk/client/HttpClientSSLConfig;Ljava/lang/Integer;ILjava/lang/Object;)Lmisk/feature/launchdarkly/LaunchDarklyConfig;
1214
public fun equals (Ljava/lang/Object;)Z
1315
public final fun getBase_uri ()Ljava/lang/String;
16+
public final fun getEvent_capacity ()Ljava/lang/Integer;
1417
public final fun getSdk_key ()Ljava/lang/String;
1518
public final fun getSsl ()Lmisk/client/HttpClientSSLConfig;
1619
public final fun getUse_relay_proxy ()Z

misk-launchdarkly/src/main/kotlin/misk/feature/launchdarkly/LaunchDarklyFeatureFlagsModule.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import com.google.inject.Provides
55
import com.launchdarkly.sdk.server.Components
66
import com.launchdarkly.sdk.server.LDClient
77
import com.launchdarkly.sdk.server.LDConfig
8+
import com.launchdarkly.sdk.server.integrations.EventProcessorBuilder.DEFAULT_CAPACITY
89
import com.launchdarkly.sdk.server.interfaces.LDClientInterface
910
import com.squareup.moshi.Moshi
1011
import io.micrometer.core.instrument.MeterRegistry
@@ -65,7 +66,7 @@ class LaunchDarklyModule @JvmOverloads constructor(
6566
// Set wait to 0 to not block here. Block in service initialization instead.
6667
.startWait(Duration.ofMillis(0))
6768
.dataSource(Components.streamingDataSource())
68-
.events(Components.sendEvents())
69+
.events(Components.sendEvents().capacity(config.event_capacity ?: DEFAULT_CAPACITY))
6970

7071
if (config.use_relay_proxy) {
7172
ldConfig.serviceEndpoints(
@@ -95,4 +96,5 @@ data class LaunchDarklyConfig @JvmOverloads constructor(
9596
val base_uri: String,
9697
val use_relay_proxy: Boolean = true,
9798
val ssl: HttpClientSSLConfig? = null,
99+
val event_capacity: Int? = null
98100
) : Config

wisp/wisp-launchdarkly/api/wisp-launchdarkly.api

+6-3
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,18 @@ public final class wisp/launchdarkly/LaunchDarklyConfig : wisp/config/Config {
2020
public fun <init> (Ljava/lang/String;Ljava/lang/String;)V
2121
public fun <init> (Ljava/lang/String;Ljava/lang/String;Lwisp/client/HttpClientSSLConfig;)V
2222
public fun <init> (Ljava/lang/String;Ljava/lang/String;Lwisp/client/HttpClientSSLConfig;Z)V
23-
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Lwisp/client/HttpClientSSLConfig;ZILkotlin/jvm/internal/DefaultConstructorMarker;)V
23+
public fun <init> (Ljava/lang/String;Ljava/lang/String;Lwisp/client/HttpClientSSLConfig;ZLjava/lang/Integer;)V
24+
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Lwisp/client/HttpClientSSLConfig;ZLjava/lang/Integer;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
2425
public final fun component1 ()Ljava/lang/String;
2526
public final fun component2 ()Ljava/lang/String;
2627
public final fun component3 ()Lwisp/client/HttpClientSSLConfig;
2728
public final fun component4 ()Z
28-
public final fun copy (Ljava/lang/String;Ljava/lang/String;Lwisp/client/HttpClientSSLConfig;Z)Lwisp/launchdarkly/LaunchDarklyConfig;
29-
public static synthetic fun copy$default (Lwisp/launchdarkly/LaunchDarklyConfig;Ljava/lang/String;Ljava/lang/String;Lwisp/client/HttpClientSSLConfig;ZILjava/lang/Object;)Lwisp/launchdarkly/LaunchDarklyConfig;
29+
public final fun component5 ()Ljava/lang/Integer;
30+
public final fun copy (Ljava/lang/String;Ljava/lang/String;Lwisp/client/HttpClientSSLConfig;ZLjava/lang/Integer;)Lwisp/launchdarkly/LaunchDarklyConfig;
31+
public static synthetic fun copy$default (Lwisp/launchdarkly/LaunchDarklyConfig;Ljava/lang/String;Ljava/lang/String;Lwisp/client/HttpClientSSLConfig;ZLjava/lang/Integer;ILjava/lang/Object;)Lwisp/launchdarkly/LaunchDarklyConfig;
3032
public fun equals (Ljava/lang/Object;)Z
3133
public final fun getBase_uri ()Ljava/lang/String;
34+
public final fun getEvent_capacity ()Ljava/lang/Integer;
3235
public final fun getOffline ()Z
3336
public final fun getSdk_key ()Ljava/lang/String;
3437
public final fun getSsl ()Lwisp/client/HttpClientSSLConfig;

wisp/wisp-launchdarkly/src/main/kotlin/wisp/launchdarkly/LaunchDarklyClient.kt

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package wisp.launchdarkly
33
import com.launchdarkly.sdk.server.Components
44
import com.launchdarkly.sdk.server.LDClient
55
import com.launchdarkly.sdk.server.LDConfig
6+
import com.launchdarkly.sdk.server.integrations.EventProcessorBuilder.DEFAULT_CAPACITY
67
import com.launchdarkly.sdk.server.interfaces.LDClientInterface
78
import wisp.resources.ResourceLoader
89
import wisp.security.ssl.SslContextFactory
@@ -32,6 +33,7 @@ object LaunchDarklyClient {
3233
.streaming(baseUri)
3334
.events(baseUri)
3435
)
36+
.events(Components.sendEvents().capacity(config.event_capacity ?: DEFAULT_CAPACITY))
3537

3638
config.ssl?.let {
3739
val trustStore = sslLoader.loadTrustStore(config.ssl.trust_store)!!

wisp/wisp-launchdarkly/src/main/kotlin/wisp/launchdarkly/LaunchDarklyConfig.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ data class LaunchDarklyConfig @JvmOverloads constructor(
77
val sdk_key: String,
88
val base_uri: String,
99
val ssl: HttpClientSSLConfig? = null,
10-
val offline: Boolean = false
10+
val offline: Boolean = false,
11+
val event_capacity: Int? = null
1112
) : Config

0 commit comments

Comments
 (0)