Skip to content

Commit 7c16859

Browse files
authored
Merge pull request #453 from splitio/SDKS-7626
[SDKS-7626] Add feature flag name in ready warning log
2 parents 1f7a755 + b337f0c commit 7c16859

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

client/src/main/java/io/split/client/SplitClientImpl.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.slf4j.LoggerFactory;
2424

2525
import java.util.ArrayList;
26+
import java.util.Arrays;
2627
import java.util.Collections;
2728
import java.util.HashMap;
2829
import java.util.List;
@@ -226,7 +227,7 @@ private SplitResult getTreatmentWithConfigInternal(String matchingKey, String bu
226227
Object> attributes, MethodEnum methodEnum) {
227228
long initTime = System.currentTimeMillis();
228229
try {
229-
checkSDKReady(methodEnum);
230+
checkSDKReady(methodEnum, Arrays.asList(featureFlag));
230231

231232
if (_container.isDestroyed()) {
232233
_log.error("Client has already been destroyed - no calls possible");
@@ -290,7 +291,7 @@ private Map<String, SplitResult> getTreatmentsWithConfigInternal(String matching
290291
return new HashMap<>();
291292
}
292293
try {
293-
checkSDKReady(methodEnum);
294+
checkSDKReady(methodEnum, featureFlagNames);
294295
if (_container.isDestroyed()) {
295296
_log.error("Client has already been destroyed - no calls possible");
296297
return createMapControl(featureFlagNames);
@@ -360,10 +361,11 @@ private Event createEvent(String key, String trafficType, String eventType) {
360361
return event;
361362
}
362363

363-
private void checkSDKReady(MethodEnum methodEnum) {
364+
private void checkSDKReady(MethodEnum methodEnum, List<String> featureFlagNames) {
365+
String toPrint = featureFlagNames.size() == 1 ? featureFlagNames.get(0): String.join(",", featureFlagNames);
364366
if (!_gates.isSDKReady()) {
365-
_log.warn(String.format("%s: the SDK is not ready, results may be incorrect. Make sure to wait for SDK readiness " +
366-
"before using this method", methodEnum.getMethod()));
367+
_log.warn(String.format("%s: the SDK is not ready, results may be incorrect for feature flag %s. Make sure to wait for " +
368+
"SDK readiness before using this method", methodEnum.getMethod(), toPrint));
367369
_telemetryConfigProducer.recordNonReadyUsage();
368370
}
369371
}

client/src/main/java/io/split/client/SplitManagerImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ public List<SplitView> splits() {
5858
@Override
5959
public SplitView split(String featureFlagName) {
6060
if (!_gates.isSDKReady()) { {
61-
_log.warn("split: the SDK is not ready, results may be incorrect. Make sure to wait for SDK readiness before using this method");
61+
_log.warn(String.format("the SDK is not ready, results may be incorrect for feature flag %s. Make sure to wait " +
62+
"for SDK readiness before using this method", featureFlagName));
6263
_telemetryConfigProducer.recordNonReadyUsage();
6364
}}
6465
Optional<String> result = SplitNameValidator.isValid(featureFlagName, "split");

0 commit comments

Comments
 (0)