@@ -26,7 +26,7 @@ const (
2626 variationValueAttribute string = "featureValue"
2727 targetAttribute string = "target"
2828 sdkVersionAttribute string = "SDK_VERSION"
29- SdkVersion string = "0.1.22 "
29+ SdkVersion string = "0.1.23 "
3030 sdkTypeAttribute string = "SDK_TYPE"
3131 sdkType string = "server"
3232 sdkLanguageAttribute string = "SDK_LANGUAGE"
@@ -59,8 +59,8 @@ type AnalyticsService struct {
5959 evaluationAnalytics SafeAnalyticsCache [string , analyticsEvent ]
6060 targetAnalytics SafeAnalyticsCache [string , evaluation.Target ]
6161 seenTargets SafeAnalyticsCache [string , bool ]
62- logEvaluationLimitReached int32
63- logTargetLimitReached int32
62+ logEvaluationLimitReached atomic. Bool
63+ logTargetLimitReached atomic. Bool
6464 timeout time.Duration
6565 logger logger.Logger
6666 metricsClient metricsclient.ClientWithResponsesInterface
@@ -136,9 +136,9 @@ func (as *AnalyticsService) listener() {
136136 as .evaluationAnalytics .set (analyticsKey , ad )
137137 }
138138 } else {
139- if atomic . LoadInt32 ( & as .logEvaluationLimitReached ) == 0 {
139+ if ! as .logEvaluationLimitReached . Load () {
140140 as .logger .Warnf ("%s Evaluation analytic cache reached max size, remaining evaluation metrics for this analytics interval will not be sent" , sdk_codes .EvaluationMetricsMaxSizeReached )
141- atomic . StoreInt32 ( & as .logEvaluationLimitReached , 1 )
141+ as .logEvaluationLimitReached . Store ( true )
142142 }
143143 }
144144
@@ -161,9 +161,9 @@ func (as *AnalyticsService) listener() {
161161 if as .targetAnalytics .size () < maxTargetEntries {
162162 as .targetAnalytics .set (ad .target .Identifier , * ad .target )
163163 } else {
164- if atomic . LoadInt32 ( & as .logTargetLimitReached ) == 0 {
164+ if ! as .logTargetLimitReached . Load () {
165165 as .logger .Warnf ("%s Target analytics cache reached max size, remaining target metrics for this analytics interval will not be sent" , sdk_codes .TargetMetricsMaxSizeReached )
166- atomic . StoreInt32 ( & as .logTargetLimitReached , 1 )
166+ as .logTargetLimitReached . Store ( true )
167167 }
168168 }
169169 }
@@ -212,8 +212,8 @@ func (as *AnalyticsService) sendDataAndResetCache(ctx context.Context) {
212212 as .targetAnalytics = newSafeTargetAnalytics ()
213213
214214 // Reset flags that keep track of cache limits being reached for logging purposes
215- atomic . StoreInt32 ( & as .logEvaluationLimitReached , 0 )
216- atomic . StoreInt32 ( & as .logTargetLimitReached , 0 )
215+ as .logEvaluationLimitReached . Store ( false )
216+ as .logTargetLimitReached . Store ( false )
217217
218218 metricData := make ([]metricsclient.MetricsData , 0 , evaluationAnalyticsClone .size ())
219219 targetData := make ([]metricsclient.TargetData , 0 , targetAnalyticsClone .size ())
0 commit comments