Commit 80acfd27 authored by Jan Provaznik's avatar Jan Provaznik

Merge branch 'enable-pa-ff-by-default' into 'master'

Enable Productivity Analytics feature

See merge request gitlab-org/gitlab!18754
parents 2840e55c 2329ea7c
...@@ -8,7 +8,7 @@ class Analytics::ApplicationController < ApplicationController ...@@ -8,7 +8,7 @@ class Analytics::ApplicationController < ApplicationController
private private
def self.check_feature_flag(flag, *args) def self.check_feature_flag(flag, *args)
before_action(*args) { render_404 unless Feature.enabled?(flag) } before_action(*args) { render_404 unless Feature.enabled?(flag, default_enabled: Gitlab::Analytics.feature_enabled_by_default?(flag)) }
end end
def self.increment_usage_counter(counter_klass, counter, *args) def self.increment_usage_counter(counter_klass, counter, *args)
......
---
title: Enable Productivity Analytics feature by default
merge_request: 18754
author:
type: changed
...@@ -15,8 +15,12 @@ module Gitlab ...@@ -15,8 +15,12 @@ module Gitlab
TASKS_BY_TYPE_CHART_FEATURE_FLAG TASKS_BY_TYPE_CHART_FEATURE_FLAG
].freeze ].freeze
FEATURE_FLAG_DEFAULTS = {
PRODUCTIVITY_ANALYTICS_FEATURE_FLAG => true
}.freeze
def self.any_features_enabled? def self.any_features_enabled?
FEATURE_FLAGS.any? { |flag| Feature.enabled?(flag) } FEATURE_FLAGS.any? { |flag| Feature.enabled?(flag, default_enabled: feature_enabled_by_default?(flag)) }
end end
def self.code_analytics_enabled? def self.code_analytics_enabled?
...@@ -28,7 +32,11 @@ module Gitlab ...@@ -28,7 +32,11 @@ module Gitlab
end end
def self.productivity_analytics_enabled? def self.productivity_analytics_enabled?
Feature.enabled?(PRODUCTIVITY_ANALYTICS_FEATURE_FLAG) Feature.enabled?(PRODUCTIVITY_ANALYTICS_FEATURE_FLAG, default_enabled: feature_enabled_by_default?(PRODUCTIVITY_ANALYTICS_FEATURE_FLAG))
end
def self.feature_enabled_by_default?(flag)
!!FEATURE_FLAG_DEFAULTS[flag]
end end
end end
end end
# frozen_string_literal: true
require 'spec_helper'
describe Gitlab::Analytics do
describe '.productivity_analytics_enabled?' do
it 'is enabled by default' do
expect(described_class).to be_productivity_analytics_enabled
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment