diff options
author | Tiago Botelho <tiagonbotelho@hotmail.com> | 2018-10-01 12:15:31 +0100 |
---|---|---|
committer | Tiago Botelho <tiagonbotelho@hotmail.com> | 2018-10-01 16:11:09 +0100 |
commit | 9b2e17ac71ee446da0f34dada41401803af816c7 (patch) | |
tree | a352314d1cd94dcfd43566997f119d6bdc8730ce /lib | |
parent | d924176117f3cc73f539ed90b47e1912a3478cf0 (diff) | |
download | gitlab-ce-9b2e17ac71ee446da0f34dada41401803af816c7.tar.gz |
Adds WebIDE commits to UsagePing
Implements UsageCounters model to track feature usage counters
and makes easy to extend for future counters
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/commits.rb | 3 | ||||
-rw-r--r-- | lib/gitlab/usage_data.rb | 5 |
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/api/commits.rb b/lib/api/commits.rb index 5aeffc8fb99..e16dd29d138 100644 --- a/lib/api/commits.rb +++ b/lib/api/commits.rb @@ -108,6 +108,9 @@ module API if result[:status] == :success commit_detail = user_project.repository.commit(result[:result]) + + UsageCounters.first_or_create.increment_counters(:web_ide_commits) if find_user_from_warden + present commit_detail, with: Entities::CommitDetail else render_api_error!(result[:message], 400) diff --git a/lib/gitlab/usage_data.rb b/lib/gitlab/usage_data.rb index f7d8ee571cd..afab36e89dd 100644 --- a/lib/gitlab/usage_data.rb +++ b/lib/gitlab/usage_data.rb @@ -10,6 +10,7 @@ module Gitlab .merge(features_usage_data) .merge(components_usage_data) .merge(cycle_analytics_usage_data) + .merge(usage_counters) end def to_json(force_refresh: false) @@ -106,6 +107,10 @@ module Gitlab } end + def usage_counters + UsageCounters.first_or_create.totals + end + def components_usage_data { gitlab_pages: { enabled: Gitlab.config.pages.enabled, version: Gitlab::Pages::VERSION }, |