@@ -26,7 +26,7 @@ const (
26
26
variationValueAttribute string = "featureValue"
27
27
targetAttribute string = "target"
28
28
sdkVersionAttribute string = "SDK_VERSION"
29
- SdkVersion string = "0.1.22 "
29
+ SdkVersion string = "0.1.23 "
30
30
sdkTypeAttribute string = "SDK_TYPE"
31
31
sdkType string = "server"
32
32
sdkLanguageAttribute string = "SDK_LANGUAGE"
@@ -59,8 +59,8 @@ type AnalyticsService struct {
59
59
evaluationAnalytics SafeAnalyticsCache [string , analyticsEvent ]
60
60
targetAnalytics SafeAnalyticsCache [string , evaluation.Target ]
61
61
seenTargets SafeAnalyticsCache [string , bool ]
62
- logEvaluationLimitReached int32
63
- logTargetLimitReached int32
62
+ logEvaluationLimitReached atomic. Bool
63
+ logTargetLimitReached atomic. Bool
64
64
timeout time.Duration
65
65
logger logger.Logger
66
66
metricsClient metricsclient.ClientWithResponsesInterface
@@ -136,9 +136,9 @@ func (as *AnalyticsService) listener() {
136
136
as .evaluationAnalytics .set (analyticsKey , ad )
137
137
}
138
138
} else {
139
- if atomic . LoadInt32 ( & as .logEvaluationLimitReached ) == 0 {
139
+ if ! as .logEvaluationLimitReached . Load () {
140
140
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 )
142
142
}
143
143
}
144
144
@@ -161,9 +161,9 @@ func (as *AnalyticsService) listener() {
161
161
if as .targetAnalytics .size () < maxTargetEntries {
162
162
as .targetAnalytics .set (ad .target .Identifier , * ad .target )
163
163
} else {
164
- if atomic . LoadInt32 ( & as .logTargetLimitReached ) == 0 {
164
+ if ! as .logTargetLimitReached . Load () {
165
165
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 )
167
167
}
168
168
}
169
169
}
@@ -212,8 +212,8 @@ func (as *AnalyticsService) sendDataAndResetCache(ctx context.Context) {
212
212
as .targetAnalytics = newSafeTargetAnalytics ()
213
213
214
214
// 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 )
217
217
218
218
metricData := make ([]metricsclient.MetricsData , 0 , evaluationAnalyticsClone .size ())
219
219
targetData := make ([]metricsclient.TargetData , 0 , targetAnalyticsClone .size ())
0 commit comments