Commit 865c1b98 authored by Dylan Griffith's avatar Dylan Griffith

Merge branch 'package_instrumentation_pypi' into 'master'

Instrument PyPI and Composer events via Snowplow

Closes #214905

See merge request gitlab-org/gitlab!36514
parents 6e065c62 48ba431f
---
title: Measure adoption of package registry
merge_request: 36514
author:
type: added
......@@ -123,6 +123,8 @@ module API
bad_request!
end
track_event('register_package')
::Packages::Composer::CreatePackageService
.new(authorized_user_project, current_user, declared_params)
.execute
......
......@@ -76,6 +76,8 @@ module API
package = packages_finder(project).by_file_name_and_sha256(filename, params[:sha256])
package_file = ::Packages::PackageFileFinder.new(package, filename, with_file_name_like: false).execute
track_event('pull_package')
present_carrierwave_file!(package_file.file, supports_direct_download: true)
end
......@@ -93,6 +95,8 @@ module API
get 'simple/*package_name', format: :txt do
authorize_read_package!(authorized_user_project)
track_event('list_package')
packages = find_package_versions
presenter = ::Packages::Pypi::PackagePresenter.new(packages, authorized_user_project)
......@@ -121,6 +125,8 @@ module API
post do
authorize_upload!(authorized_user_project)
track_event('push_package')
::Packages::Pypi::CreatePackageService
.new(authorized_user_project, current_user, declared_params)
.execute
......
......@@ -68,6 +68,7 @@ RSpec.shared_examples 'Composer package creation' do |user_type, status, add_mem
expect(response).to have_gitlab_http_status(status)
end
it_behaves_like 'a gitlab tracking event', described_class.name, 'register_package'
end
end
......
......@@ -38,6 +38,7 @@ RSpec.shared_examples 'PyPi package creation' do |user_type, status, add_member
context 'with correct params' do
it_behaves_like 'package workhorse uploads'
it_behaves_like 'creating pypi package files'
it_behaves_like 'a gitlab tracking event', described_class.name, 'push_package'
end
end
......@@ -103,6 +104,7 @@ RSpec.shared_examples 'PyPi package versions' do |user_type, status, add_member
end
it_behaves_like 'returning response status', status
it_behaves_like 'a gitlab tracking event', described_class.name, 'list_package'
end
end
......@@ -119,6 +121,7 @@ RSpec.shared_examples 'PyPi package download' do |user_type, status, add_member
end
it_behaves_like 'returning response status', status
it_behaves_like 'a gitlab tracking event', described_class.name, 'pull_package'
end
end
......
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