Skip to content

Commit 34a9a00

Browse files
committed
pr feedback
1 parent c66fc51 commit 34a9a00

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

splitio/client/client.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,13 @@ func (c *SplitClient) createImpression(featureFlag string, bucketingKey *string,
115115
}
116116
}
117117

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+
118125
// storeData stores impression, runs listener and stores metrics
119126
func (c *SplitClient) storeData(impressions []dtos.ImpressionDecorated, attributes map[string]interface{}, metricsLabel string, evaluationTime time.Duration) {
120127
// Store impression
@@ -181,12 +188,7 @@ func (c *SplitClient) doTreatmentCall(key interface{}, featureFlag string, attri
181188
}
182189

183190
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)},
190192
attributes,
191193
metricsLabel,
192194
evaluationResult.EvaluationTime,
@@ -236,10 +238,7 @@ func (c *SplitClient) processResult(result evaluator.Results, operation string,
236238
Config: nil,
237239
}
238240
} 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))
243242

244243
treatments[feature] = TreatmentResult{
245244
Treatment: evaluation.Treatment,

0 commit comments

Comments
 (0)