flagd icon indicating copy to clipboard operation
flagd copied to clipboard

[FEATURE] Detect stale flags

Open Kavindu-Dodan opened this issue 2 years ago • 4 comments

Requirements

Background

Consider this conversation [1]. Flagd can operate with multiple sync providers. These sync providers push flag configurations which get stored in the internal in-memory store [2].

There could be occasions where individual providers shutdown, and disconnect for various reasons. For example, for an HTTP flag source, the source can undergo maintenance causing downtime. When this happens, flags stored internally could go stale

Proposal

As highlighted by the conversation [1], it could be beneficial to mark stored flag configurations to be stale and set state Reason.STALE for evaluations. This makes sure flag configurations served by flagd are consistent with their sources.

Update Given that we do not have a stale sate in existing evaluation reasons [3], a good alternative is to utilize CACHED state

[1] - https://github.com/open-feature/flagd/pull/297#discussion_r1101875472 [2] - https://github.com/open-feature/flagd/tree/main/pkg/store [3] - https://docs.openfeature.dev/docs/specification/types#resolution-details

Kavindu-Dodan avatar Feb 10 '23 17:02 Kavindu-Dodan

Hey @Kavindu-Dodan, is this issue still relevant? If so, how critical do you think it is to add support for stale flag detection?

beeme1mr avatar Mar 15 '23 15:03 beeme1mr

@beeme1mr concern highlighted in the issue is still relevant. One option is to set the resolution state to "CACHED" when the underlying source goes offline

@toddbaert what do you think?

Kavindu-Dodan avatar Mar 15 '23 20:03 Kavindu-Dodan

I think it makes sense to set it to cached in this case, ya.

We may want to add a STALE to the spec at some point, but until then I think I'd prefer CACHED (even though reasons are free-form).

toddbaert avatar Mar 16 '23 17:03 toddbaert

STALE is now included in the OpenFeature spec.

https://openfeature.dev/specification/types#resolution-details

beeme1mr avatar Sep 27 '23 18:09 beeme1mr