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:
authorAlex Kalderimis <akalderimis@gitlab.com>2019-07-21 04:26:19 +0300
committerDouwe Maan <douwe@gitlab.com>2019-07-21 04:26:19 +0300
commit7320758611b8d8c28fb179f970e015a72357b94d (patch)
treec74e9e90c6f0fd35f5b3cf08466c2947b39128ca /lib/gitlab/usage_data.rb
parent66394bd1b7c98d7a6abbeade068b8b9c1b838ddf (diff)
Count wiki page creation
This adds a counter to count page creation, which is reflected in the usage-data we collect. The number created is stored in Redis, avoiding DB access.
Diffstat (limited to 'lib/gitlab/usage_data.rb')
-rw-r--r--lib/gitlab/usage_data.rb17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/gitlab/usage_data.rb b/lib/gitlab/usage_data.rb
index 43072053e57..db1086c9cae 100644
--- a/lib/gitlab/usage_data.rb
+++ b/lib/gitlab/usage_data.rb
@@ -6,7 +6,9 @@ module Gitlab
class << self
def data(force_refresh: false)
- Rails.cache.fetch('usage_data', force: force_refresh, expires_in: 2.weeks) { uncached_data }
+ Rails.cache.fetch('usage_data', force: force_refresh, expires_in: 2.weeks) do
+ uncached_data
+ end
end
def uncached_data
@@ -128,12 +130,15 @@ module Gitlab
}
end
+ # @return [Hash<Symbol, Integer>]
def usage_counters
- {
- web_ide_commits: Gitlab::UsageDataCounters::WebIdeCounter.total_commits_count,
- web_ide_merge_requests: Gitlab::UsageDataCounters::WebIdeCounter.total_merge_requests_count,
- web_ide_views: Gitlab::UsageDataCounters::WebIdeCounter.total_views_count
- }
+ usage_data_counters.map(&:totals).reduce({}) { |a, b| a.merge(b) }
+ end
+
+ # @return [Array<#totals>] An array of objects that respond to `#totals`
+ def usage_data_counters
+ [Gitlab::UsageDataCounters::WikiPageCounter,
+ Gitlab::UsageDataCounters::WebIdeCounter]
end
def components_usage_data