Commit 79857030 authored by Erick Bajao's avatar Erick Bajao Committed by Dmytro Zaporozhets (DZ)

Track event for downloading group coverage CSV

parent 1e0ff62a
---
title: Track downloads of group code coverage CSV in snowplow
merge_request: 40754
author:
type: added
...@@ -10,7 +10,10 @@ class Groups::Analytics::CoverageReportsController < Groups::Analytics::Applicat ...@@ -10,7 +10,10 @@ class Groups::Analytics::CoverageReportsController < Groups::Analytics::Applicat
def index def index
respond_to do |format| respond_to do |format|
format.csv { send_data(render_csv(report_results), type: 'text/csv; charset=utf-8') } format.csv do
track_event(:download_code_coverage_csv, download_tracker_params)
send_data(render_csv(report_results), type: 'text/csv; charset=utf-8')
end
end end
end end
...@@ -41,4 +44,11 @@ class Groups::Analytics::CoverageReportsController < Groups::Analytics::Applicat ...@@ -41,4 +44,11 @@ class Groups::Analytics::CoverageReportsController < Groups::Analytics::Applicat
end_date: Date.parse(params.require(:end_date)) end_date: Date.parse(params.require(:end_date))
} }
end end
def download_tracker_params
{
label: 'group_id',
value: @group.id
}
end
end end
...@@ -76,6 +76,13 @@ RSpec.describe Groups::Analytics::CoverageReportsController do ...@@ -76,6 +76,13 @@ RSpec.describe Groups::Analytics::CoverageReportsController do
end end
it 'responds 200 with CSV coverage data' do it 'responds 200 with CSV coverage data' do
expect(Gitlab::Tracking).to receive(:event).with(
described_class.name,
'download_code_coverage_csv',
label: 'group_id',
value: group.id
)
get :index, params: valid_request_params get :index, params: valid_request_params
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
......
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