diff options
Diffstat (limited to 'app/experiments/application_experiment.rb')
-rw-r--r-- | app/experiments/application_experiment.rb | 26 |
1 files changed, 3 insertions, 23 deletions
diff --git a/app/experiments/application_experiment.rb b/app/experiments/application_experiment.rb index 859716b4739..f6af7ca15bb 100644 --- a/app/experiments/application_experiment.rb +++ b/app/experiments/application_experiment.rb @@ -1,14 +1,6 @@ # frozen_string_literal: true -class ApplicationExperiment < Gitlab::Experiment # rubocop:disable Gitlab/NamespacedClass - def enabled? - return false if Feature::Definition.get(feature_flag_name).nil? # there has to be a feature flag yaml file - return false unless Gitlab.dev_env_or_com? # we have to be in an environment that allows experiments - - # the feature flag has to be rolled out - Feature.get(feature_flag_name).state != :off # rubocop:disable Gitlab/AvoidFeatureGet - end - +class ApplicationExperiment < Gitlab::Experiment def publish(_result = nil) super @@ -41,10 +33,6 @@ class ApplicationExperiment < Gitlab::Experiment # rubocop:disable Gitlab/Namesp # define a default nil control behavior so we can omit it when not needed end - def track(action, **event_args) - super(action, **tracking_context.merge(event_args)) - end - # TODO: remove # This is deprecated logic as of v0.6.0 and should eventually be removed, but # needs to stay intact for actively running experiments. The new strategy @@ -64,24 +52,16 @@ class ApplicationExperiment < Gitlab::Experiment # rubocop:disable Gitlab/Namesp private - def tracking_context + def tracking_context(event_args) { namespace: context.try(:namespace) || context.try(:group), project: context.try(:project), user: user_or_actor - }.compact || {} + }.merge(event_args) end def user_or_actor actor = context.try(:actor) actor.respond_to?(:id) ? actor : context.try(:user) end - - def feature_flag_name - name.tr('/', '_') - end - - def experiment_group? - Feature.enabled?(feature_flag_name, self, type: :experiment, default_enabled: :yaml) - end end |