Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-01-27 00:09:04 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-01-27 00:09:04 +0300
commitdafbc31897e3751b6a4b34a7e32e1ecf5bfd4657 (patch)
treee454cd0c43ad4e73980cd0adb906a663faa07965 /app/experiments
parent25eb713a7fdb787a67d74a88a89433839aab5642 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/experiments')
-rw-r--r--app/experiments/application_experiment.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/app/experiments/application_experiment.rb b/app/experiments/application_experiment.rb
index 7a8851d11ce..9a1a37a6b19 100644
--- a/app/experiments/application_experiment.rb
+++ b/app/experiments/application_experiment.rb
@@ -1,13 +1,20 @@
# frozen_string_literal: true
class ApplicationExperiment < Gitlab::Experiment
+ def enabled?
+ return false if Feature::Definition.get(name).nil? # there has to be a feature flag yaml file
+ return false unless Gitlab.dev_env_or_com? # we're in an environment that allows experiments
+
+ Feature.get(name).state != :off # rubocop:disable Gitlab/AvoidFeatureGet
+ end
+
def publish(_result)
track(:assignment) # track that we've assigned a variant for this context
Gon.global.push({ experiment: { name => signature } }, true) # push to client
end
def track(action, **event_args)
- return if excluded? # no events for opted out actors or excluded subjects
+ return unless should_track? # no events for opted out actors or excluded subjects
Gitlab::Tracking.event(name, action.to_s, **event_args.merge(
context: (event_args[:context] || []) << SnowplowTracker::SelfDescribingJson.new(