Add use case for enabled_for_attribute in experiment guide
@dstull As I understand it, @nicolasdular created the invite_email_experiment feature flag as a regular percentage_of_time feature flag for use as a random experiment differentiator (currently 50%).
The invite_email_experiment_percentage flag doesn't exist (which means there is not actually a reason to add the invite_email key to the Gitlab::Experimentation::EXPERIMENTS hash imo).
Btw. I created the Gitlab::Experimentation.enabled_for_attribute?(:experiment_key, attribute) (MR) method for exactly this use case.
Advantages:
we can keep using the existing Gitlab::Experimentation.enabled?(:experiment_key) method, along with the Gitlab::Experimentation.enabled_for_attribute?(:experiment_key, attribute) method. optional added configuration in the Gitlab::Experimentation::EXPERIMENTS hash is supported we don't need to add regular feature flags it allows us to reliably bucket any objects into either a control or experimental group (ie. not just users based on cookies, but also for example invitations based on invite emails) it can be used from anywhere in the code base (not just within controllers) See here for an example: gitlab-org/gitlab!43158 (merged).
See also #209 (comment 418299008)