Closed ppayun closed 3 months ago
This error should only be shown when the context you are providing is considered invalid. Is there a reason you are trying to use an invalid context?
The reason the context is invalid should be in the logged error.
I just checked, for some reason, the code is using an empty context(see code below). We can definitely add some context info. But still why empty context is illegal and showing as warning?
context_builder = Context.builder(client_id)
for dict_key, dict_value in context_dict.items(): # this is empty, we didn't set any values
context_builder.set(dict_key, dict_value)
context = context_builder.build()
value = ldclient.get().variation(key, context, default_value)
return value
@ppayun my apologies for the long delay in responding.
Providing a key is a requirement of our context model. We use the provided contexts to populate things like the context drop down list in our UI, and it is also used for aggregating metrics for things like experimentation, etc.
While we do not require many attributes to be set for a context, we do require a key and a valid kind (which will to default to 'user').
This issue is marked as stale because it has been open for 30 days without activity. Remove the stale label or comment, or this will be closed in 7 days.
https://github.com/launchdarkly/python-server-sdk/blob/d152455b89cb70164d8487a1cc0b47f92017a5c4/ldclient/client.py#L471
We use default value for some flags, and this logic keep writing warnings to the logs, can the log level be changed to DEBUG?