Commit 2329ea7c authored by Adam Hegyi's avatar Adam Hegyi Committed by Jan Provaznik

Enable Productivity Analytics feature

This MR turns on the productivity_analytics feature flag by default.
parent 2840e55c
...@@ -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