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
af10069f
Commit
af10069f
authored
Jan 13, 2021
by
drew cimino
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Track metrics report uploaders from CreateJobArtifactsService
parent
9c266113
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
0 deletions
+29
-0
app/services/ci/create_job_artifacts_service.rb
app/services/ci/create_job_artifacts_service.rb
+8
-0
lib/gitlab/usage_data_counters/known_events/common.yml
lib/gitlab/usage_data_counters/known_events/common.yml
+5
-0
spec/services/ci/create_job_artifacts_service_spec.rb
spec/services/ci/create_job_artifacts_service_spec.rb
+16
-0
No files found.
app/services/ci/create_job_artifacts_service.rb
View file @
af10069f
...
...
@@ -42,6 +42,8 @@ module Ci
artifact
,
artifact_metadata
=
build_artifact
(
artifacts_file
,
params
,
metadata_file
)
result
=
parse_artifact
(
artifact
)
track_artifact_uploader
(
artifact
)
return
result
unless
result
[
:status
]
==
:success
persist_artifact
(
artifact
,
artifact_metadata
,
params
)
...
...
@@ -152,6 +154,12 @@ module Ci
)
end
def
track_artifact_uploader
(
artifact
)
return
unless
artifact
.
file_type
==
'metrics'
track_usage_event
(
'i_metrics_report_artifact_uploaders'
,
@job
.
user_id
)
end
def
parse_dotenv_artifact
(
artifact
)
Ci
::
ParseDotenvArtifactService
.
new
(
project
,
current_user
).
execute
(
artifact
)
end
...
...
lib/gitlab/usage_data_counters/known_events/common.yml
View file @
af10069f
...
...
@@ -278,6 +278,11 @@
redis_slot
:
testing
aggregation
:
weekly
feature_flag
:
usage_data_i_testing_load_performance_widget_total
-
name
:
i_testing_metrics_report_artifact_uploaders
category
:
testing
redis_slot
:
testing
aggregation
:
weekly
feature_flag
:
usage_data_i_testing_metrics_report_artifact_uploaders
# Project Management group
-
name
:
g_project_management_issue_title_changed
category
:
issues_edit
...
...
spec/services/ci/create_job_artifacts_service_spec.rb
View file @
af10069f
...
...
@@ -42,6 +42,12 @@ RSpec.describe Ci::CreateJobArtifactsService do
expect
(
new_artifact
.
file_sha256
).
to
eq
(
artifacts_sha256
)
end
it
'does not track the job user_id'
do
expect
(
service
).
not_to
receive
(
:track_usage_event
)
subject
end
context
'when metadata file is also uploaded'
do
let
(
:metadata_file
)
do
file_to_upload
(
'spec/fixtures/ci_build_artifacts_metadata.gz'
,
sha256:
artifacts_sha256
)
...
...
@@ -174,6 +180,16 @@ RSpec.describe Ci::CreateJobArtifactsService do
end
end
context
'when artifact_type is metrics'
do
let
(
:params
)
{
{
'artifact_type'
=>
'metrics'
,
'artifact_format'
=>
'gzip'
}.
with_indifferent_access
}
it
'tracks the job user_id'
do
expect
(
service
).
to
receive
(
:track_usage_event
).
with
(
'i_metrics_report_artifact_uploaders'
,
job
.
user_id
)
subject
end
end
context
'when artifact type is cluster_applications'
do
let
(
:artifacts_file
)
do
file_to_upload
(
'spec/fixtures/helm/helm_list_v2_prometheus_missing.json.gz'
,
sha256:
artifacts_sha256
)
...
...
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