diff --git a/splitio/client/client.go b/splitio/client/client.go index e4dfd39..7d8f7c0 100644 --- a/splitio/client/client.go +++ b/splitio/client/client.go @@ -4,6 +4,7 @@ import ( "errors" "fmt" "runtime/debug" + "strings" "time" "github.com/splitio/go-client/v6/splitio/conf" @@ -57,7 +58,8 @@ func (c *SplitClient) getEvaluationResult(matchingKey string, bucketingKey *stri if c.isReady() { return c.evaluator.EvaluateFeature(matchingKey, bucketingKey, featureFlag, attributes) } - c.logger.Warning(operation + ": the SDK is not ready, results may be incorrect. Make sure to wait for SDK readiness before using this method") + + c.logger.Warning(fmt.Sprintf("%s: the SDK is not ready, results may be incorrect for feature flag %s. Make sure to wait for SDK readiness before using this method", operation, featureFlag)) c.initTelemetry.RecordNonReadyUsage() return &evaluator.Result{ Treatment: evaluator.Control, @@ -71,7 +73,8 @@ func (c *SplitClient) getEvaluationsResult(matchingKey string, bucketingKey *str if c.isReady() { return c.evaluator.EvaluateFeatures(matchingKey, bucketingKey, featureFlags, attributes) } - c.logger.Warning(operation + ": the SDK is not ready, results may be incorrect. Make sure to wait for SDK readiness before using this method") + featureFlagsToPrint := strings.Join(featureFlags, ",") + c.logger.Warning(fmt.Sprintf("%s: the SDK is not ready, results may be incorrect for feature flag %s. Make sure to wait for SDK readiness before using this method", operation, featureFlagsToPrint)) c.initTelemetry.RecordNonReadyUsage() result := evaluator.Results{ EvaluationTime: 0, diff --git a/splitio/client/input_validator_test.go b/splitio/client/input_validator_test.go index 73e401a..0344dc0 100644 --- a/splitio/client/input_validator_test.go +++ b/splitio/client/input_validator_test.go @@ -554,27 +554,28 @@ func TestNotReadyYet(t *testing.T) { factoryNotReady.status.Store(sdkStatusInitializing) expectedMessage := "{operation}: the SDK is not ready, results may be incorrect. Make sure to wait for SDK readiness before using this method" + expectedMessage1 := "{operation}: the SDK is not ready, results may be incorrect for feature flag feature. Make sure to wait for SDK readiness before using this method" + expectedMessage2 := "{operation}: the SDK is not ready, results may be incorrect for feature flag feature,feature_2. Make sure to wait for SDK readiness before using this method" clientNotReady.Treatment("test", "feature", nil) - if !mW.Matches(strings.Replace(expectedMessage, "{operation}", "Treatment", 1)) { + if !mW.Matches(strings.Replace(expectedMessage1, "{operation}", "Treatment", 1)) { t.Error("Wrong message") } clientNotReady.Treatments("test", []string{"feature", "feature_2"}, nil) - if !mW.Matches(strings.Replace(expectedMessage, "{operation}", "Treatments", 1)) { + if !mW.Matches(strings.Replace(expectedMessage2, "{operation}", "Treatments", 1)) { t.Error("Wrong message") } clientNotReady.TreatmentWithConfig("test", "feature", nil) - if !mW.Matches(strings.Replace(expectedMessage, "{operation}", "TreatmentWithConfig", 1)) { + if !mW.Matches(strings.Replace(expectedMessage1, "{operation}", "TreatmentWithConfig", 1)) { t.Error("Wrong message") } clientNotReady.TreatmentsWithConfig("test", []string{"feature", "feature_2"}, nil) - if !mW.Matches(strings.Replace(expectedMessage, "{operation}", "TreatmentsWithConfig", 1)) { + if !mW.Matches(strings.Replace(expectedMessage2, "{operation}", "TreatmentsWithConfig", 1)) { t.Error("Wrong message") } - expected := "Track: the SDK is not ready, results may be incorrect. Make sure to wait for SDK readiness before using this method" expectedTrack(clientNotReady.Track("key", "traffic", "eventType", nil, nil), expected, t)