From 9b2e17ac71ee446da0f34dada41401803af816c7 Mon Sep 17 00:00:00 2001 From: Tiago Botelho Date: Mon, 1 Oct 2018 12:15:31 +0100 Subject: Adds WebIDE commits to UsagePing Implements UsageCounters model to track feature usage counters and makes easy to extend for future counters --- lib/api/commits.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/api/commits.rb') 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) -- cgit v1.2.1 From 1e662293e8fc2f2eba9657dd27449e966736a14a Mon Sep 17 00:00:00 2001 From: Tiago Botelho Date: Tue, 2 Oct 2018 16:33:43 +0100 Subject: Implements Web IDE commits counter in Redis This makes a temporary implementation of the Web IDE commits counter using Redis while https://gitlab.com/gitlab-org/gitlab-ce/issues/52096 is being discussed further for a more generic approach to counters --- lib/api/commits.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/api/commits.rb') diff --git a/lib/api/commits.rb b/lib/api/commits.rb index e16dd29d138..ec44936d114 100644 --- a/lib/api/commits.rb +++ b/lib/api/commits.rb @@ -109,7 +109,7 @@ 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 + Gitlab::WebIdeCommitsCounter.increment if find_user_from_warden present commit_detail, with: Entities::CommitDetail else -- cgit v1.2.1