@@ -45,6 +45,8 @@ sealed class StatsigServer {
45
45
46
46
@JvmSynthetic abstract suspend fun getLayerWithCustomExposureLogging (user : StatsigUser , layerName : String , onExposure : OnLayerExposure ): Layer
47
47
48
+ @JvmSynthetic abstract suspend fun getLayerWithExposureLoggingDisabled (user : StatsigUser , layerName : String ): Layer
49
+
48
50
@JvmSynthetic abstract suspend fun shutdownSuspend ()
49
51
50
52
fun logEvent (user : StatsigUser ? , eventName : String ) {
@@ -109,6 +111,11 @@ sealed class StatsigServer {
109
111
onExposure : OnLayerExposure
110
112
): CompletableFuture <Layer >
111
113
114
+ abstract fun getLayerWithExposureLoggingDisabledAsync (
115
+ user : StatsigUser ,
116
+ layerName : String ,
117
+ ): CompletableFuture <Layer >
118
+
112
119
/* *
113
120
* @deprecated
114
121
* - we make no promises of support for this API
@@ -292,15 +299,23 @@ private class StatsigServerImpl(serverSecret: String, private val options: Stats
292
299
293
300
override suspend fun getLayer (user : StatsigUser , layerName : String ): Layer {
294
301
return this .errorBoundary.capture({
295
- return @capture getLayerImpl(user, layerName)
302
+ return @capture getLayerImpl(user, layerName, false )
296
303
}, {
297
304
return @capture Layer .empty(layerName)
298
305
})
299
306
}
300
307
301
308
override suspend fun getLayerWithCustomExposureLogging (user : StatsigUser , layerName : String , onExposure : OnLayerExposure ): Layer {
302
309
return this .errorBoundary.capture({
303
- return @capture getLayerImpl(user, layerName, onExposure)
310
+ return @capture getLayerImpl(user, layerName, false , onExposure)
311
+ }, {
312
+ return @capture Layer .empty(layerName)
313
+ })
314
+ }
315
+
316
+ override suspend fun getLayerWithExposureLoggingDisabled (user : StatsigUser , layerName : String ): Layer {
317
+ return this .errorBoundary.capture({
318
+ return @capture getLayerImpl(user, layerName, true )
304
319
}, {
305
320
return @capture Layer .empty(layerName)
306
321
})
@@ -425,6 +440,15 @@ private class StatsigServerImpl(serverSecret: String, private val options: Stats
425
440
}
426
441
}
427
442
443
+ override fun getLayerWithExposureLoggingDisabledAsync (
444
+ user : StatsigUser ,
445
+ layerName : String ,
446
+ ): CompletableFuture <Layer > {
447
+ return statsigScope.future {
448
+ return @future getLayerWithExposureLoggingDisabled(user, layerName)
449
+ }
450
+ }
451
+
428
452
/* *
429
453
* @deprecated
430
454
* - we make no promises of support for this API
@@ -441,7 +465,7 @@ private class StatsigServerImpl(serverSecret: String, private val options: Stats
441
465
logger.flush()
442
466
}
443
467
444
- private suspend fun getLayerImpl (user : StatsigUser , layerName : String , onExposure : OnLayerExposure ? = null): Layer {
468
+ private suspend fun getLayerImpl (user : StatsigUser , layerName : String , disableExposure : Boolean , onExposure : OnLayerExposure ? = null): Layer {
445
469
return this .errorBoundary.capture({
446
470
enforceActive()
447
471
val normalizedUser = normalizeUser(user)
@@ -456,10 +480,14 @@ private class StatsigServerImpl(serverSecret: String, private val options: Stats
456
480
return @capture Layer (
457
481
layerName,
458
482
result.ruleID,
459
- value as Map <String , Any >
460
- ) { layer, paramName ->
483
+ value as Map <String , Any >,
484
+ result.secondaryExposures,
485
+ result.configDelegate ? : " " ,
486
+ ) exposureFun@{ layer, paramName ->
461
487
val metadata = createLayerExposureMetadata(layer, paramName, result)
462
-
488
+ if (disableExposure) {
489
+ return @exposureFun
490
+ }
463
491
if (onExposure != null ) {
464
492
onExposure(
465
493
LayerExposureEventData (
0 commit comments