@@ -11,6 +11,7 @@ import { IMPRESSION, IMPRESSION_QUEUEING } from '../logger/constants';
1111import { ISdkFactoryContext } from '../sdkFactory/types' ;
1212import { isConsumerMode } from '../utils/settingsValidation/mode' ;
1313import { Method } from '../sync/submitters/types' ;
14+ import { ImpressionDecorated } from '../trackers/types' ;
1415
1516const treatmentNotReady = { treatment : CONTROL , label : SDK_NOT_READY } ;
1617
@@ -34,11 +35,11 @@ export function clientFactory(params: ISdkFactoryContext): SplitIO.IClient | Spl
3435 const stopTelemetryTracker = telemetryTracker . trackEval ( withConfig ? TREATMENT_WITH_CONFIG : TREATMENT ) ;
3536
3637 const wrapUp = ( evaluationResult : IEvaluationResult ) => {
37- const queue : SplitIO . ImpressionDTO [ ] = [ ] ;
38+ const queue : ImpressionDecorated [ ] = [ ] ;
3839 const treatment = processEvaluation ( evaluationResult , featureFlagName , key , attributes , withConfig , methodName , queue ) ;
3940 impressionsTracker . track ( queue , attributes ) ;
4041
41- stopTelemetryTracker ( queue [ 0 ] && queue [ 0 ] . label ) ;
42+ stopTelemetryTracker ( queue [ 0 ] && queue [ 0 ] . imp . label ) ;
4243 return treatment ;
4344 } ;
4445
@@ -59,14 +60,14 @@ export function clientFactory(params: ISdkFactoryContext): SplitIO.IClient | Spl
5960 const stopTelemetryTracker = telemetryTracker . trackEval ( withConfig ? TREATMENTS_WITH_CONFIG : TREATMENTS ) ;
6061
6162 const wrapUp = ( evaluationResults : Record < string , IEvaluationResult > ) => {
62- const queue : SplitIO . ImpressionDTO [ ] = [ ] ;
63+ const queue : ImpressionDecorated [ ] = [ ] ;
6364 const treatments : Record < string , SplitIO . Treatment | SplitIO . TreatmentWithConfig > = { } ;
6465 Object . keys ( evaluationResults ) . forEach ( featureFlagName => {
6566 treatments [ featureFlagName ] = processEvaluation ( evaluationResults [ featureFlagName ] , featureFlagName , key , attributes , withConfig , methodName , queue ) ;
6667 } ) ;
6768 impressionsTracker . track ( queue , attributes ) ;
6869
69- stopTelemetryTracker ( queue [ 0 ] && queue [ 0 ] . label ) ;
70+ stopTelemetryTracker ( queue [ 0 ] && queue [ 0 ] . imp . label ) ;
7071 return treatments ;
7172 } ;
7273
@@ -87,15 +88,15 @@ export function clientFactory(params: ISdkFactoryContext): SplitIO.IClient | Spl
8788 const stopTelemetryTracker = telemetryTracker . trackEval ( method ) ;
8889
8990 const wrapUp = ( evaluationResults : Record < string , IEvaluationResult > ) => {
90- const queue : SplitIO . ImpressionDTO [ ] = [ ] ;
91+ const queue : ImpressionDecorated [ ] = [ ] ;
9192 const treatments : Record < string , SplitIO . Treatment | SplitIO . TreatmentWithConfig > = { } ;
9293 const evaluations = evaluationResults ;
9394 Object . keys ( evaluations ) . forEach ( featureFlagName => {
9495 treatments [ featureFlagName ] = processEvaluation ( evaluations [ featureFlagName ] , featureFlagName , key , attributes , withConfig , methodName , queue ) ;
9596 } ) ;
9697 impressionsTracker . track ( queue , attributes ) ;
9798
98- stopTelemetryTracker ( queue [ 0 ] && queue [ 0 ] . label ) ;
99+ stopTelemetryTracker ( queue [ 0 ] && queue [ 0 ] . imp . label ) ;
99100 return treatments ;
100101 } ;
101102
@@ -128,24 +129,27 @@ export function clientFactory(params: ISdkFactoryContext): SplitIO.IClient | Spl
128129 attributes : SplitIO . Attributes | undefined ,
129130 withConfig : boolean ,
130131 invokingMethodName : string ,
131- queue : SplitIO . ImpressionDTO [ ]
132+ queue : ImpressionDecorated [ ]
132133 ) : SplitIO . Treatment | SplitIO . TreatmentWithConfig {
133134 const matchingKey = getMatching ( key ) ;
134135 const bucketingKey = getBucketing ( key ) ;
135136
136- const { treatment, label, changeNumber, config = null } = evaluation ;
137+ const { treatment, label, changeNumber, config = null , impressionsDisabled } = evaluation ;
137138 log . info ( IMPRESSION , [ featureFlagName , matchingKey , treatment , label ] ) ;
138139
139140 if ( validateSplitExistence ( log , readinessManager , featureFlagName , label , invokingMethodName ) ) {
140141 log . info ( IMPRESSION_QUEUEING ) ;
141142 queue . push ( {
142- feature : featureFlagName ,
143- keyName : matchingKey ,
144- treatment,
145- time : Date . now ( ) ,
146- bucketingKey,
147- label,
148- changeNumber : changeNumber as number
143+ imp : {
144+ feature : featureFlagName ,
145+ keyName : matchingKey ,
146+ treatment,
147+ time : Date . now ( ) ,
148+ bucketingKey,
149+ label,
150+ changeNumber : changeNumber as number ,
151+ } ,
152+ disabled : impressionsDisabled
149153 } ) ;
150154 }
151155
0 commit comments