abstract class OpenFeature::Hook
- OpenFeature::Hook
- Reference
- Object
Overview
Hooks are a mechanism whereby application developers can add arbitrary behavior to flag evaluation. They operate similarly to middleware in many web frameworks.
Hooks add their logic at any of four specific stages of flag evaluation:
#before
, immediately before flag evaluation
#after
, immediately after successful flag evaluation
#error
, immediately after an unsuccessful during flag evaluation
#finally
unconditionally after flag evaluation
Hooks can be configured to run globally (impacting all flag evaluations), per client, or per flag evaluation invocation. Some example use-cases for hook include adding additional data to the evaluation context, performing validation on the received flag value, providing data to telemetric tools, and logging errors.
Direct Known Subclasses
Defined in:
openfeature/hook.crInstance Method Summary
-
#after(ctx : HookContext, hints : Metadata, flag_details : FlagEvaluationDetails)
immediately after successful flag evaluation
-
#before(ctx : HookContext, hints : Metadata) : EvaluationContext | Nil
immediately before flag evaluation
-
#error(ctx : HookContext, hints : Metadata, ex : Exception)
immediately after an unsuccessful during flag evaluation
-
#finally(ctx : HookContext, hints : Metadata)
unconditionally after flag evaluation
Instance Method Detail
immediately after successful flag evaluation
immediately before flag evaluation
immediately after an unsuccessful during flag evaluation
unconditionally after flag evaluation