@@ -115,6 +115,13 @@ func (c *SplitClient) createImpression(featureFlag string, bucketingKey *string,
115
115
}
116
116
}
117
117
118
+ func (c * SplitClient ) createImpressionDecorated (featureFlag string , bucketingKey * string , matchingKey string , evaluationResult evaluator.Result ) dtos.ImpressionDecorated {
119
+ return dtos.ImpressionDecorated {
120
+ Impression : c .createImpression (featureFlag , bucketingKey , evaluationResult .Label , matchingKey , evaluationResult .Treatment , evaluationResult .SplitChangeNumber ),
121
+ Disabled : evaluationResult .ImpressionsDisabled ,
122
+ }
123
+ }
124
+
118
125
// storeData stores impression, runs listener and stores metrics
119
126
func (c * SplitClient ) storeData (impressions []dtos.ImpressionDecorated , attributes map [string ]interface {}, metricsLabel string , evaluationTime time.Duration ) {
120
127
// Store impression
@@ -181,12 +188,7 @@ func (c *SplitClient) doTreatmentCall(key interface{}, featureFlag string, attri
181
188
}
182
189
183
190
c .storeData (
184
- []dtos.ImpressionDecorated {
185
- {
186
- Impression : c .createImpression (featureFlag , bucketingKey , evaluationResult .Label , matchingKey , evaluationResult .Treatment , evaluationResult .SplitChangeNumber ),
187
- Disabled : evaluationResult .ImpressionsDisabled ,
188
- },
189
- },
191
+ []dtos.ImpressionDecorated {c .createImpressionDecorated (featureFlag , bucketingKey , matchingKey , * evaluationResult )},
190
192
attributes ,
191
193
metricsLabel ,
192
194
evaluationResult .EvaluationTime ,
@@ -236,10 +238,7 @@ func (c *SplitClient) processResult(result evaluator.Results, operation string,
236
238
Config : nil ,
237
239
}
238
240
} else {
239
- bulkImpressions = append (bulkImpressions , dtos.ImpressionDecorated {
240
- Impression : c .createImpression (feature , bucketingKey , evaluation .Label , matchingKey , evaluation .Treatment , evaluation .SplitChangeNumber ),
241
- Disabled : evaluation .ImpressionsDisabled ,
242
- })
241
+ bulkImpressions = append (bulkImpressions , c .createImpressionDecorated (feature , bucketingKey , matchingKey , evaluation ))
243
242
244
243
treatments [feature ] = TreatmentResult {
245
244
Treatment : evaluation .Treatment ,
0 commit comments