Skip to content

Log with level ERROR when try to get feature value first time #35

@roman-struchev

Description

@roman-struchev

Context
We use feature hub to manage feature toggles

Also, we have 2 additional point

  • not all feature toggles exist in feature hub, the responsible person often creates it when feature toggle is needed
  • we have several feature toggle sources with priority, for example, feature hub, application properties, environment, etc

Issue

public FeatureState getFeatureState(String key) {
return features.computeIfAbsent(
key,
key1 -> {
if (hasReceivedInitialState) {
log.error(
"FeatureHub error: application requesting use of invalid key after initialization: `{}`",
key1);
}
return new FeatureStateBase(null, this, key);
});
}

When we try to get feature value in java (io.featurehub.client.ClientFeatureRepository#getFeatureState) first time, then we have such log for our applications FeatureHub error: application requesting use of invalid key after initialization: XXX.

This happens only for the first request for the feature toggle (not existing in feature hub), after instance of application was restarted (because of java.util.Map#computeIfAbsent used)

So in monitoring of our applications we have error cases by logs

Fix
Idea how to fix #34

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions