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
507fd6e9
Commit
507fd6e9
authored
Jun 08, 2021
by
Steve Abrams
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NuGet symbol package event tracking
Add snowplow/usage ping events for symbol uploads and downloads.
parent
96fe611a
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
398 additions
and
15 deletions
+398
-15
app/models/packages/event.rb
app/models/packages/event.rb
+4
-2
config/metrics/counts_all/20210709191135_package_events_i_package_nuget_pull_symbol_package.yml
...35_package_events_i_package_nuget_pull_symbol_package.yml
+22
-0
config/metrics/counts_all/20210709191829_package_events_i_package_nuget_push_symbol_package.yml
...29_package_events_i_package_nuget_push_symbol_package.yml
+22
-0
config/metrics/counts_all/20210709210941_package_events_i_package_pull_symbol_package.yml
...09210941_package_events_i_package_pull_symbol_package.yml
+22
-0
config/metrics/counts_all/20210709211058_package_events_i_package_pull_symbol_package_by_deploy_token.yml
..._events_i_package_pull_symbol_package_by_deploy_token.yml
+22
-0
config/metrics/counts_all/20210709211248_package_events_i_package_pull_symbol_package_by_guest.yml
...package_events_i_package_pull_symbol_package_by_guest.yml
+22
-0
config/metrics/counts_all/20210709211341_package_events_i_package_pull_symbol_package_by_user.yml
..._package_events_i_package_pull_symbol_package_by_user.yml
+22
-0
config/metrics/counts_all/20210709211439_package_events_i_package_push_symbol_package.yml
...09211439_package_events_i_package_push_symbol_package.yml
+22
-0
config/metrics/counts_all/20210709211636_package_events_i_package_push_symbol_package_by_deploy_token.yml
..._events_i_package_push_symbol_package_by_deploy_token.yml
+22
-0
config/metrics/counts_all/20210709211731_package_events_i_package_push_symbol_package_by_guest.yml
...package_events_i_package_push_symbol_package_by_guest.yml
+22
-0
config/metrics/counts_all/20210709211831_package_events_i_package_push_symbol_package_by_user.yml
..._package_events_i_package_push_symbol_package_by_user.yml
+22
-0
doc/development/usage_ping/dictionary.md
doc/development/usage_ping/dictionary.md
+140
-0
lib/api/nuget_project_packages.rb
lib/api/nuget_project_packages.rb
+17
-10
lib/gitlab/usage_data_counters/counter_events/package_events.yml
...lab/usage_data_counters/counter_events/package_events.yml
+10
-0
spec/lib/gitlab/usage_data_counters/package_event_counter_spec.rb
.../gitlab/usage_data_counters/package_event_counter_spec.rb
+1
-1
spec/support/shared_examples/requests/api/nuget_packages_shared_examples.rb
...d_examples/requests/api/nuget_packages_shared_examples.rb
+5
-1
spec/support/shared_examples/requests/api/packages_shared_examples.rb
.../shared_examples/requests/api/packages_shared_examples.rb
+1
-1
No files found.
app/models/packages/event.rb
View file @
507fd6e9
...
...
@@ -3,7 +3,7 @@
class
Packages::Event
<
ApplicationRecord
belongs_to
:package
,
optional:
true
UNIQUE_EVENTS_ALLOWED
=
%i[push_package delete_package pull_package]
.
freeze
UNIQUE_EVENTS_ALLOWED
=
%i[push_package delete_package pull_package
pull_symbol_package push_symbol_package
]
.
freeze
EVENT_SCOPES
=
::
Packages
::
Package
.
package_types
.
merge
(
container:
1000
,
tag:
1001
).
freeze
EVENT_PREFIX
=
"i_package"
...
...
@@ -21,7 +21,9 @@ class Packages::Event < ApplicationRecord
delete_tag:
7
,
delete_tag_bulk:
8
,
list_tags:
9
,
cli_metadata:
10
cli_metadata:
10
,
pull_symbol_package:
11
,
push_symbol_package:
12
}
enum
originator_type:
{
user:
0
,
deploy_token:
1
,
guest:
2
}
...
...
config/metrics/counts_all/20210709191135_package_events_i_package_nuget_pull_symbol_package.yml
0 → 100644
View file @
507fd6e9
---
key_path
:
counts.package_events_i_package_nuget_pull_symbol_package
name
:
nuget_symbol_packages_pulled
description
:
A count of NuGet symbol packages that have been downloaded from the package registry
product_section
:
ops
product_stage
:
package
product_group
:
group::package
product_category
:
package registry
value_type
:
number
status
:
implemented
milestone
:
"
14.1"
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64554
time_frame
:
all
data_source
:
redis
data_category
:
Optional
distribution
:
-
ce
-
ee
tier
:
-
free
-
premium
-
ultimate
config/metrics/counts_all/20210709191829_package_events_i_package_nuget_push_symbol_package.yml
0 → 100644
View file @
507fd6e9
---
key_path
:
counts.package_events_i_package_nuget_push_symbol_package
name
:
nuget_symbol_packages_pushed
description
:
A count of NuGet symbol packages that have been uploaded to the package registry
product_section
:
ops
product_stage
:
package
product_group
:
group::package
product_category
:
package registry
value_type
:
number
status
:
implemented
milestone
:
"
14.1"
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64554
time_frame
:
all
data_source
:
redis
data_category
:
Optional
distribution
:
-
ce
-
ee
tier
:
-
free
-
premium
-
ultimate
config/metrics/counts_all/20210709210941_package_events_i_package_pull_symbol_package.yml
0 → 100644
View file @
507fd6e9
---
key_path
:
counts.package_events_i_package_pull_symbol_package
name
:
symbol_packages_pulled
description
:
A count of symbol packages that have been pulled from the package registry
product_section
:
ops
product_stage
:
package
product_group
:
group::package
product_category
:
package registry
value_type
:
number
status
:
implemented
milestone
:
"
14.1"
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64554
time_frame
:
all
data_source
:
redis
data_category
:
Optional
distribution
:
-
ce
-
ee
tier
:
-
free
-
premium
-
ultimate
\ No newline at end of file
config/metrics/counts_all/20210709211058_package_events_i_package_pull_symbol_package_by_deploy_token.yml
0 → 100644
View file @
507fd6e9
---
key_path
:
counts.package_events_i_package_pull_symbol_package_by_deploy_token
name
:
symbol_packages_pulled_by_deploy_token
description
:
A count of symbol packages that have been pulled with a deploy token from the package registry
product_section
:
ops
product_stage
:
package
product_group
:
group::package
product_category
:
package registry
value_type
:
number
status
:
implemented
milestone
:
"
14.1"
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64554
time_frame
:
all
data_source
:
redis
data_category
:
Optional
distribution
:
-
ce
-
ee
tier
:
-
free
-
premium
-
ultimate
config/metrics/counts_all/20210709211248_package_events_i_package_pull_symbol_package_by_guest.yml
0 → 100644
View file @
507fd6e9
---
key_path
:
counts.package_events_i_package_pull_symbol_package_by_guest
name
:
symbol_packages_pulled_by_guest
description
:
A count of symbol packages that have been pulled with by a guest from the package registry
product_section
:
ops
product_stage
:
package
product_group
:
group::package
product_category
:
package registry
value_type
:
number
status
:
implemented
milestone
:
"
14.1"
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64554
time_frame
:
all
data_source
:
redis
data_category
:
Optional
distribution
:
-
ce
-
ee
tier
:
-
free
-
premium
-
ultimate
\ No newline at end of file
config/metrics/counts_all/20210709211341_package_events_i_package_pull_symbol_package_by_user.yml
0 → 100644
View file @
507fd6e9
---
key_path
:
counts.package_events_i_package_pull_symbol_package_by_user
name
:
symbol_packages_pulled_by_user
description
:
A count of symbol packages that have been pulled with by an authenticated user from the package registry
product_section
:
ops
product_stage
:
package
product_group
:
group::package
product_category
:
package registry
value_type
:
number
status
:
implemented
milestone
:
"
14.1"
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64554
time_frame
:
all
data_source
:
redis
data_category
:
Optional
distribution
:
-
ce
-
ee
tier
:
-
free
-
premium
-
ultimate
config/metrics/counts_all/20210709211439_package_events_i_package_push_symbol_package.yml
0 → 100644
View file @
507fd6e9
---
key_path
:
counts.package_events_i_package_push_symbol_package
name
:
symbol_packages_pushed
description
:
A count of symbol packages that have been pushed to the package registry
product_section
:
ops
product_stage
:
package
product_group
:
group::package
product_category
:
package registry
value_type
:
number
status
:
implemented
milestone
:
"
14.1"
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64554
time_frame
:
all
data_source
:
redis
data_category
:
Optional
distribution
:
-
ce
-
ee
tier
:
-
free
-
premium
-
ultimate
config/metrics/counts_all/20210709211636_package_events_i_package_push_symbol_package_by_deploy_token.yml
0 → 100644
View file @
507fd6e9
---
key_path
:
counts.package_events_i_package_push_symbol_package_by_deploy_token
name
:
symbol_packages_pushed_by_deploy_token
description
:
A count of symbol packages that have been pushed with a deploy token to the package registry
product_section
:
ops
product_stage
:
package
product_group
:
group::package
product_category
:
package registry
value_type
:
number
status
:
implemented
milestone
:
"
14.1"
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64554
time_frame
:
all
data_source
:
redis
data_category
:
Optional
distribution
:
-
ce
-
ee
tier
:
-
free
-
premium
-
ultimate
config/metrics/counts_all/20210709211731_package_events_i_package_push_symbol_package_by_guest.yml
0 → 100644
View file @
507fd6e9
---
key_path
:
counts.package_events_i_package_push_symbol_package_by_guest
name
:
symbol_packages_pushed_by_guest
description
:
A count of symbol packages that have been pushed by a guest to the package registry
product_section
:
ops
product_stage
:
package
product_group
:
group::package
product_category
:
package registry
value_type
:
number
status
:
implemented
milestone
:
"
14.1"
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64554
time_frame
:
all
data_source
:
redis
data_category
:
Optional
distribution
:
-
ce
-
ee
tier
:
-
free
-
premium
-
ultimate
config/metrics/counts_all/20210709211831_package_events_i_package_push_symbol_package_by_user.yml
0 → 100644
View file @
507fd6e9
---
key_path
:
counts.package_events_i_package_push_symbol_package_by_user
name
:
symbol_packages_pushed_by_user
description
:
A count of symbol packages that have been pushed by an authenticated user to the package registry
product_section
:
ops
product_stage
:
package
product_group
:
group::package
product_category
:
package registry
value_type
:
number
status
:
implemented
milestone
:
"
14.1"
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64554
time_frame
:
all
data_source
:
redis
data_category
:
Optional
distribution
:
-
ce
-
ee
tier
:
-
free
-
premium
-
ultimate
doc/development/usage_ping/dictionary.md
View file @
507fd6e9
...
...
@@ -4472,6 +4472,20 @@ Status: `data_available`
Tiers:
`free`
,
`premium`
,
`ultimate`
### `counts.package_events_i_package_nuget_pull_symbol_package`
A count of NuGet symbol packages that have been downloaded from the package registry
[
YAML definition
](
https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210709191135_package_events_i_package_nuget_pull_symbol_package.yml
)
Group:
`group::package`
Data Category:
`Optional`
Status:
`implemented`
Tiers:
`free`
,
`premium`
,
`ultimate`
### `counts.package_events_i_package_nuget_push_package`
A count of NuGet packages that have been published
...
...
@@ -4486,6 +4500,20 @@ Status: `data_available`
Tiers:
`free`
,
`premium`
,
`ultimate`
### `counts.package_events_i_package_nuget_push_symbol_package`
A count of NuGet symbol packages that have been uploaded to the package registry
[
YAML definition
](
https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210709191829_package_events_i_package_nuget_push_symbol_package.yml
)
Group:
`group::package`
Data Category:
`Optional`
Status:
`implemented`
Tiers:
`free`
,
`premium`
,
`ultimate`
### `counts.package_events_i_package_pull_package`
A count of packages that have been downloaded from the package registry
...
...
@@ -4542,6 +4570,62 @@ Status: `data_available`
Tiers:
`free`
,
`premium`
,
`ultimate`
### `counts.package_events_i_package_pull_symbol_package`
A count of symbol packages that have been pulled from the package registry
[
YAML definition
](
https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210709210941_package_events_i_package_pull_symbol_package.yml
)
Group:
`group::package`
Data Category:
`Optional`
Status:
`implemented`
Tiers:
`free`
,
`premium`
,
`ultimate`
### `counts.package_events_i_package_pull_symbol_package_by_deploy_token`
A count of symbol packages that have been pulled with a deploy token from the package registry
[
YAML definition
](
https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210709211058_package_events_i_package_pull_symbol_package_by_deploy_token.yml
)
Group:
`group::package`
Data Category:
`Optional`
Status:
`implemented`
Tiers:
`free`
,
`premium`
,
`ultimate`
### `counts.package_events_i_package_pull_symbol_package_by_guest`
A count of symbol packages that have been pulled with by a guest from the package registry
[
YAML definition
](
https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210709211248_package_events_i_package_pull_symbol_package_by_guest.yml
)
Group:
`group::package`
Data Category:
`Optional`
Status:
`implemented`
Tiers:
`free`
,
`premium`
,
`ultimate`
### `counts.package_events_i_package_pull_symbol_package_by_user`
A count of symbol packages that have been pulled with by an authenticated user from the package registry
[
YAML definition
](
https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210709211341_package_events_i_package_pull_symbol_package_by_user.yml
)
Group:
`group::package`
Data Category:
`Optional`
Status:
`implemented`
Tiers:
`free`
,
`premium`
,
`ultimate`
### `counts.package_events_i_package_push_package`
A count of packages that have been published to the package registry
...
...
@@ -4598,6 +4682,62 @@ Status: `data_available`
Tiers:
`free`
,
`premium`
,
`ultimate`
### `counts.package_events_i_package_push_symbol_package`
A count of symbol packages that have been pushed to the package registry
[
YAML definition
](
https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210709211439_package_events_i_package_push_symbol_package.yml
)
Group:
`group::package`
Data Category:
`Optional`
Status:
`implemented`
Tiers:
`free`
,
`premium`
,
`ultimate`
### `counts.package_events_i_package_push_symbol_package_by_deploy_token`
A count of symbol packages that have been pushed with a deploy token to the package registry
[
YAML definition
](
https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210709211636_package_events_i_package_push_symbol_package_by_deploy_token.yml
)
Group:
`group::package`
Data Category:
`Optional`
Status:
`implemented`
Tiers:
`free`
,
`premium`
,
`ultimate`
### `counts.package_events_i_package_push_symbol_package_by_guest`
A count of symbol packages that have been pushed by a guest to the package registry
[
YAML definition
](
https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210709211731_package_events_i_package_push_symbol_package_by_guest.yml
)
Group:
`group::package`
Data Category:
`Optional`
Status:
`implemented`
Tiers:
`free`
,
`premium`
,
`ultimate`
### `counts.package_events_i_package_push_symbol_package_by_user`
A count of symbol packages that have been pushed by an authenticated user to the package registry
[
YAML definition
](
https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210709211831_package_events_i_package_push_symbol_package_by_user.yml
)
Group:
`group::package`
Data Category:
`Optional`
Status:
`implemented`
Tiers:
`free`
,
`premium`
,
`ultimate`
### `counts.package_events_i_package_pypi_delete_package`
A count of Python packages that have been deleted from the package registry
...
...
lib/api/nuget_project_packages.rb
View file @
507fd6e9
...
...
@@ -134,7 +134,16 @@ module API
use
:file_params
end
put
'symbolpackage'
do
upload_nuget_package_file
(
symbol_package:
true
)
upload_nuget_package_file
(
symbol_package:
true
)
do
|
package
|
track_package_event
(
'push_symbol_package'
,
:nuget
,
category:
'API::NugetPackages'
,
user:
current_user
,
project:
package
.
project
,
namespace:
package
.
project
.
namespace
)
end
rescue
ObjectStorage
::
RemoteStoreError
=>
e
Gitlab
::
ErrorTracking
.
track_exception
(
e
,
extra:
{
file_name:
params
[
:file_name
],
project_id:
project_or_group
.
id
})
...
...
@@ -175,15 +184,13 @@ module API
not_found!
(
'Package'
)
unless
package_file
if
params
[
:format
]
==
'nupkg'
track_package_event
(
'pull_package'
,
:nuget
,
category:
'API::NugetPackages'
,
project:
package_file
.
project
,
namespace:
package_file
.
project
.
namespace
)
end
track_package_event
(
params
[
:format
]
==
'snupkg'
?
'pull_symbol_package'
:
'pull_package'
,
:nuget
,
category:
'API::NugetPackages'
,
project:
package_file
.
project
,
namespace:
package_file
.
project
.
namespace
)
# nuget and dotnet don't support 302 Moved status codes, supports_direct_download has to be set to false
present_carrierwave_file!
(
package_file
.
file
,
supports_direct_download:
false
)
...
...
lib/gitlab/usage_data_counters/counter_events/package_events.yml
View file @
507fd6e9
...
...
@@ -32,14 +32,24 @@
-
i_package_nuget_delete_package
-
i_package_nuget_pull_package
-
i_package_nuget_push_package
-
i_package_nuget_pull_symbol_package
-
i_package_nuget_push_symbol_package
-
i_package_pull_package
-
i_package_pull_package_by_deploy_token
-
i_package_pull_package_by_guest
-
i_package_pull_package_by_user
-
i_package_pull_symbol_package
-
i_package_pull_symbol_package_by_deploy_token
-
i_package_pull_symbol_package_by_guest
-
i_package_pull_symbol_package_by_user
-
i_package_push_package
-
i_package_push_package_by_deploy_token
-
i_package_push_package_by_guest
-
i_package_push_package_by_user
-
i_package_push_symbol_package
-
i_package_push_symbol_package_by_deploy_token
-
i_package_push_symbol_package_by_guest
-
i_package_push_symbol_package_by_user
-
i_package_pypi_delete_package
-
i_package_pypi_pull_package
-
i_package_pypi_push_package
...
...
spec/lib/gitlab/usage_data_counters/package_event_counter_spec.rb
View file @
507fd6e9
...
...
@@ -14,7 +14,7 @@ RSpec.describe Gitlab::UsageDataCounters::PackageEventCounter, :clean_gitlab_red
end
it
'includes the right events'
do
expect
(
described_class
::
KNOWN_EVENTS
.
size
).
to
eq
5
3
expect
(
described_class
::
KNOWN_EVENTS
.
size
).
to
eq
6
3
end
described_class
::
KNOWN_EVENTS
.
each
do
|
event
|
...
...
spec/support/shared_examples/requests/api/nuget_packages_shared_examples.rb
View file @
507fd6e9
...
...
@@ -170,7 +170,9 @@ RSpec.shared_examples 'process nuget upload' do |user_type, status, add_member =
it_behaves_like
'package workhorse uploads'
it_behaves_like
'creates nuget package files'
unless
symbol_package
if
symbol_package
it_behaves_like
'a package tracking event'
,
'API::NugetPackages'
,
'push_symbol_package'
else
it_behaves_like
'a package tracking event'
,
'API::NugetPackages'
,
'push_package'
end
end
...
...
@@ -311,6 +313,8 @@ RSpec.shared_examples 'process nuget download content request' do |user_type, st
expect
(
response
.
media_type
).
to
eq
(
'application/octet-stream'
)
end
it_behaves_like
'a package tracking event'
,
'API::NugetPackages'
,
'pull_symbol_package'
end
context
'with lower case package name'
do
...
...
spec/support/shared_examples/requests/api/packages_shared_examples.rb
View file @
507fd6e9
...
...
@@ -147,7 +147,7 @@ RSpec.shared_examples 'a package tracking event' do |category, action|
stub_feature_flags
(
collect_package_events:
true
)
end
it
"creates a gitlab tracking event
#{
action
}
"
,
:snowplow
do
it
"creates a gitlab tracking event
#{
action
}
"
,
:snowplow
,
:aggregate_failures
do
expect
{
subject
}.
to
change
{
Packages
::
Event
.
count
}.
by
(
1
)
expect_snowplow_event
(
category:
category
,
action:
action
,
**
snowplow_gitlab_standard_context
)
...
...
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