Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
48ba431f
Commit
48ba431f
authored
Jul 10, 2020
by
Tim Rizzi
Committed by
Dylan Griffith
Jul 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Instrument PyPI and Composer events via Snowplow
parent
02f27285
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
0 deletions
+17
-0
changelogs/unreleased/214905-measure-package-adoption.yml
changelogs/unreleased/214905-measure-package-adoption.yml
+5
-0
ee/lib/api/composer_packages.rb
ee/lib/api/composer_packages.rb
+2
-0
ee/lib/api/pypi_packages.rb
ee/lib/api/pypi_packages.rb
+6
-0
ee/spec/support/shared_examples/requests/api/composer_packages_shared_examples.rb
...xamples/requests/api/composer_packages_shared_examples.rb
+1
-0
ee/spec/support/shared_examples/requests/api/pypi_packages_shared_examples.rb
...ed_examples/requests/api/pypi_packages_shared_examples.rb
+3
-0
No files found.
changelogs/unreleased/214905-measure-package-adoption.yml
0 → 100644
View file @
48ba431f
---
title
:
Measure adoption of package registry
merge_request
:
36514
author
:
type
:
added
ee/lib/api/composer_packages.rb
View file @
48ba431f
...
@@ -123,6 +123,8 @@ module API
...
@@ -123,6 +123,8 @@ module API
bad_request!
bad_request!
end
end
track_event
(
'register_package'
)
::
Packages
::
Composer
::
CreatePackageService
::
Packages
::
Composer
::
CreatePackageService
.
new
(
authorized_user_project
,
current_user
,
declared_params
)
.
new
(
authorized_user_project
,
current_user
,
declared_params
)
.
execute
.
execute
...
...
ee/lib/api/pypi_packages.rb
View file @
48ba431f
...
@@ -76,6 +76,8 @@ module API
...
@@ -76,6 +76,8 @@ module API
package
=
packages_finder
(
project
).
by_file_name_and_sha256
(
filename
,
params
[
:sha256
])
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
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
)
present_carrierwave_file!
(
package_file
.
file
,
supports_direct_download:
true
)
end
end
...
@@ -93,6 +95,8 @@ module API
...
@@ -93,6 +95,8 @@ module API
get
'simple/*package_name'
,
format: :txt
do
get
'simple/*package_name'
,
format: :txt
do
authorize_read_package!
(
authorized_user_project
)
authorize_read_package!
(
authorized_user_project
)
track_event
(
'list_package'
)
packages
=
find_package_versions
packages
=
find_package_versions
presenter
=
::
Packages
::
Pypi
::
PackagePresenter
.
new
(
packages
,
authorized_user_project
)
presenter
=
::
Packages
::
Pypi
::
PackagePresenter
.
new
(
packages
,
authorized_user_project
)
...
@@ -121,6 +125,8 @@ module API
...
@@ -121,6 +125,8 @@ module API
post
do
post
do
authorize_upload!
(
authorized_user_project
)
authorize_upload!
(
authorized_user_project
)
track_event
(
'push_package'
)
::
Packages
::
Pypi
::
CreatePackageService
::
Packages
::
Pypi
::
CreatePackageService
.
new
(
authorized_user_project
,
current_user
,
declared_params
)
.
new
(
authorized_user_project
,
current_user
,
declared_params
)
.
execute
.
execute
...
...
ee/spec/support/shared_examples/requests/api/composer_packages_shared_examples.rb
View file @
48ba431f
...
@@ -68,6 +68,7 @@ RSpec.shared_examples 'Composer package creation' do |user_type, status, add_mem
...
@@ -68,6 +68,7 @@ RSpec.shared_examples 'Composer package creation' do |user_type, status, add_mem
expect
(
response
).
to
have_gitlab_http_status
(
status
)
expect
(
response
).
to
have_gitlab_http_status
(
status
)
end
end
it_behaves_like
'a gitlab tracking event'
,
described_class
.
name
,
'register_package'
end
end
end
end
...
...
ee/spec/support/shared_examples/requests/api/pypi_packages_shared_examples.rb
View file @
48ba431f
...
@@ -38,6 +38,7 @@ RSpec.shared_examples 'PyPi package creation' do |user_type, status, add_member
...
@@ -38,6 +38,7 @@ RSpec.shared_examples 'PyPi package creation' do |user_type, status, add_member
context
'with correct params'
do
context
'with correct params'
do
it_behaves_like
'package workhorse uploads'
it_behaves_like
'package workhorse uploads'
it_behaves_like
'creating pypi package files'
it_behaves_like
'creating pypi package files'
it_behaves_like
'a gitlab tracking event'
,
described_class
.
name
,
'push_package'
end
end
end
end
...
@@ -103,6 +104,7 @@ RSpec.shared_examples 'PyPi package versions' do |user_type, status, add_member
...
@@ -103,6 +104,7 @@ RSpec.shared_examples 'PyPi package versions' do |user_type, status, add_member
end
end
it_behaves_like
'returning response status'
,
status
it_behaves_like
'returning response status'
,
status
it_behaves_like
'a gitlab tracking event'
,
described_class
.
name
,
'list_package'
end
end
end
end
...
@@ -119,6 +121,7 @@ RSpec.shared_examples 'PyPi package download' do |user_type, status, add_member
...
@@ -119,6 +121,7 @@ RSpec.shared_examples 'PyPi package download' do |user_type, status, add_member
end
end
it_behaves_like
'returning response status'
,
status
it_behaves_like
'returning response status'
,
status
it_behaves_like
'a gitlab tracking event'
,
described_class
.
name
,
'pull_package'
end
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment