diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-20 14:22:11 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-20 14:22:11 +0000 |
commit | 0c872e02b2c822e3397515ec324051ff540f0cd5 (patch) | |
tree | ce2fb6ce7030e4dad0f4118d21ab6453e5938cdd /lib/api/commits.rb | |
parent | f7e05a6853b12f02911494c4b3fe53d9540d74fc (diff) | |
download | gitlab-ce-0c872e02b2c822e3397515ec324051ff540f0cd5.tar.gz |
Add latest changes from gitlab-org/gitlab@15-7-stable-eev15.7.0-rc42
Diffstat (limited to 'lib/api/commits.rb')
-rw-r--r-- | lib/api/commits.rb | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/lib/api/commits.rb b/lib/api/commits.rb index 63a13b83a9b..ad2bbf90917 100644 --- a/lib/api/commits.rb +++ b/lib/api/commits.rb @@ -24,6 +24,26 @@ module API forbidden!("You are not allowed to push into this branch") end end + + def track_commit_events + return unless find_user_from_warden + + Gitlab::UsageDataCounters::WebIdeCounter.increment_commits_count + Gitlab::UsageDataCounters::EditorUniqueCounter.track_web_ide_edit_action(author: current_user, project: user_project) + namespace = user_project.namespace + + return unless Feature.enabled?(:route_hll_to_snowplow_phase3, namespace) + + Gitlab::Tracking.event( + 'API::Commits', + :commit, + project: user_project, + namespace: namespace, + user: current_user, + label: 'counts.web_ide_commits', + context: [Gitlab::Tracking::ServicePingContext.new(data_source: :redis, key_path: 'counts.web_ide_commits').to_context] + ) + end end params do @@ -204,10 +224,7 @@ module API if result[:status] == :success commit_detail = user_project.repository.commit(result[:result]) - if find_user_from_warden - Gitlab::UsageDataCounters::WebIdeCounter.increment_commits_count - Gitlab::UsageDataCounters::EditorUniqueCounter.track_web_ide_edit_action(author: current_user, project: user_project) - end + track_commit_events present commit_detail, with: Entities::CommitDetail, include_stats: params[:stats], current_user: current_user else |