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
c4ae56bc
Commit
c4ae56bc
authored
Aug 18, 2021
by
Cameron Swords
Committed by
Steve Abrams
Aug 18, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deprecate Secure user scan metrics
Deprecated for performance reasons. Changelog: changed EE: true
parent
46bb9dc7
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
60 additions
and
67 deletions
+60
-67
ee/config/metrics/counts_28d/20210607041718_user_dast_scans.yml
...fig/metrics/counts_28d/20210607041718_user_dast_scans.yml
+1
-1
ee/config/metrics/counts_28d/20210607043218_user_sast_scans.yml
...fig/metrics/counts_28d/20210607043218_user_sast_scans.yml
+1
-1
ee/config/metrics/counts_28d/20210607043301_user_dependency_scanning_scans.yml
...nts_28d/20210607043301_user_dependency_scanning_scans.yml
+1
-1
ee/config/metrics/counts_28d/20210607043336_user_container_scanning_scans.yml
...unts_28d/20210607043336_user_container_scanning_scans.yml
+1
-1
ee/config/metrics/counts_28d/20210607043410_user_secret_detection_scans.yml
...counts_28d/20210607043410_user_secret_detection_scans.yml
+1
-1
ee/config/metrics/counts_28d/20210607043509_user_coverage_fuzzing_scans.yml
...counts_28d/20210607043509_user_coverage_fuzzing_scans.yml
+1
-1
ee/config/metrics/counts_28d/20210607043622_user_api_fuzzing_scans.yml
...rics/counts_28d/20210607043622_user_api_fuzzing_scans.yml
+1
-1
ee/config/metrics/counts_28d/20210810034303_user_cluster_image_scanning_scans.yml
..._28d/20210810034303_user_cluster_image_scanning_scans.yml
+16
-0
ee/config/metrics/counts_all/20210607043109_user_dast_scans.yml
...fig/metrics/counts_all/20210607043109_user_dast_scans.yml
+2
-2
ee/config/metrics/counts_all/20210607043741_user_sast_scans.yml
...fig/metrics/counts_all/20210607043741_user_sast_scans.yml
+1
-1
ee/config/metrics/counts_all/20210607043819_user_dependency_scanning_scans.yml
...nts_all/20210607043819_user_dependency_scanning_scans.yml
+1
-1
ee/config/metrics/counts_all/20210607043902_user_container_scanning_scans.yml
...unts_all/20210607043902_user_container_scanning_scans.yml
+1
-1
ee/config/metrics/counts_all/20210607043957_user_secret_detection_scans.yml
...counts_all/20210607043957_user_secret_detection_scans.yml
+1
-1
ee/config/metrics/counts_all/20210607044040_user_coverage_fuzzing_scans.yml
...counts_all/20210607044040_user_coverage_fuzzing_scans.yml
+2
-1
ee/config/metrics/counts_all/20210607044126_user_api_fuzzing_scans.yml
...rics/counts_all/20210607044126_user_api_fuzzing_scans.yml
+1
-1
ee/config/metrics/counts_all/20210810033334_user_cluster_image_scanning_scans.yml
..._all/20210810033334_user_cluster_image_scanning_scans.yml
+16
-0
ee/lib/ee/gitlab/usage_data.rb
ee/lib/ee/gitlab/usage_data.rb
+3
-21
ee/spec/config/metrics/every_metric_definition_spec.rb
ee/spec/config/metrics/every_metric_definition_spec.rb
+0
-7
ee/spec/lib/ee/gitlab/usage_data_non_sql_metrics_spec.rb
ee/spec/lib/ee/gitlab/usage_data_non_sql_metrics_spec.rb
+1
-1
ee/spec/lib/ee/gitlab/usage_data_spec.rb
ee/spec/lib/ee/gitlab/usage_data_spec.rb
+8
-23
No files found.
ee/config/metrics/counts_28d/20210607041718_user_dast_scans.yml
View file @
c4ae56bc
...
...
@@ -6,7 +6,7 @@ product_stage: secure
product_group
:
group::dynamic analysis
product_category
:
dynamic_application_security_testing
value_type
:
number
status
:
d
ata_available
status
:
d
eprecated
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49444
time_frame
:
28d
data_source
:
database
...
...
ee/config/metrics/counts_28d/20210607043218_user_sast_scans.yml
View file @
c4ae56bc
...
...
@@ -6,7 +6,7 @@ product_stage: secure
product_group
:
group::static analysis
product_category
:
static_application_security_testing
value_type
:
number
status
:
d
ata_available
status
:
d
eprecated
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49444
time_frame
:
28d
data_source
:
database
...
...
ee/config/metrics/counts_28d/20210607043301_user_dependency_scanning_scans.yml
View file @
c4ae56bc
...
...
@@ -6,7 +6,7 @@ product_stage: secure
product_group
:
group::composition analysis
product_category
:
dependency_scanning
value_type
:
number
status
:
d
ata_available
status
:
d
eprecated
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49444
time_frame
:
28d
data_source
:
database
...
...
ee/config/metrics/counts_28d/20210607043336_user_container_scanning_scans.yml
View file @
c4ae56bc
...
...
@@ -6,7 +6,7 @@ product_stage: secure
product_group
:
group::composition analysis
product_category
:
container_scanning
value_type
:
number
status
:
d
ata_available
status
:
d
eprecated
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49444
time_frame
:
28d
data_source
:
database
...
...
ee/config/metrics/counts_28d/20210607043410_user_secret_detection_scans.yml
View file @
c4ae56bc
...
...
@@ -6,7 +6,7 @@ product_stage: secure
product_group
:
group::static analysis
product_category
:
secret_detection
value_type
:
number
status
:
d
ata_available
status
:
d
eprecated
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49444
time_frame
:
28d
data_source
:
database
...
...
ee/config/metrics/counts_28d/20210607043509_user_coverage_fuzzing_scans.yml
View file @
c4ae56bc
...
...
@@ -6,7 +6,7 @@ product_stage: secure
product_group
:
group::dynamic analysis
product_category
:
fuzz-testing
value_type
:
number
status
:
d
ata_available
status
:
d
eprecated
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49444
time_frame
:
28d
data_source
:
database
...
...
ee/config/metrics/counts_28d/20210607043622_user_api_fuzzing_scans.yml
View file @
c4ae56bc
...
...
@@ -6,7 +6,7 @@ product_stage: secure
product_group
:
group::dynamic analysis
product_category
:
fuzz-testing
value_type
:
number
status
:
d
ata_available
status
:
d
eprecated
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49444
time_frame
:
28d
data_source
:
database
...
...
ee/config/metrics/counts_28d/20210810034303_user_cluster_image_scanning_scans.yml
0 → 100644
View file @
c4ae56bc
---
key_path
:
usage_activity_by_stage_monthly.secure.user_cluster_image_scanning_scans
description
:
Number of users who have run a Cluster image scan
product_section
:
sec
product_stage
:
protect
product_group
:
group::container security
value_type
:
number
status
:
deprecated
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49444
time_frame
:
28d
data_source
:
database
data_category
:
Operational
distribution
:
-
ee
tier
:
-
ultimate
ee/config/metrics/counts_all/20210607043109_user_dast_scans.yml
View file @
c4ae56bc
...
...
@@ -6,11 +6,11 @@ product_stage: secure
product_group
:
group::dynamic analysis
product_category
:
dynamic_application_security_testing
value_type
:
number
status
:
data_available
status
:
deprecated
data_category
:
optional
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49444
time_frame
:
all
data_source
:
database
data_category
:
operational
distribution
:
-
ee
tier
:
...
...
ee/config/metrics/counts_all/20210607043741_user_sast_scans.yml
View file @
c4ae56bc
...
...
@@ -6,7 +6,7 @@ product_stage: secure
product_group
:
group::static analysis
product_category
:
static_application_security_testing
value_type
:
number
status
:
d
ata_available
status
:
d
eprecated
data_category
:
optional
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49444
time_frame
:
all
...
...
ee/config/metrics/counts_all/20210607043819_user_dependency_scanning_scans.yml
View file @
c4ae56bc
...
...
@@ -6,7 +6,7 @@ product_stage: secure
product_group
:
group::composition analysis
product_category
:
dependency_scanning
value_type
:
number
status
:
d
ata_available
status
:
d
eprecated
data_category
:
optional
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49444
time_frame
:
all
...
...
ee/config/metrics/counts_all/20210607043902_user_container_scanning_scans.yml
View file @
c4ae56bc
...
...
@@ -6,7 +6,7 @@ product_stage: secure
product_group
:
group::composition analysis
product_category
:
container_scanning
value_type
:
number
status
:
d
ata_available
status
:
d
eprecated
data_category
:
optional
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49444
time_frame
:
all
...
...
ee/config/metrics/counts_all/20210607043957_user_secret_detection_scans.yml
View file @
c4ae56bc
...
...
@@ -6,7 +6,7 @@ product_stage: secure
product_group
:
group::static analysis
product_category
:
secret_detection
value_type
:
number
status
:
d
ata_available
status
:
d
eprecated
data_category
:
optional
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49444
time_frame
:
all
...
...
ee/config/metrics/counts_all/20210607044040_user_coverage_fuzzing_scans.yml
View file @
c4ae56bc
...
...
@@ -6,7 +6,8 @@ product_stage: secure
product_group
:
group::dynamic analysis
product_category
:
fuzz-testing
value_type
:
number
status
:
data_available
status
:
deprecated
data_category
:
optional
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49444
time_frame
:
all
data_source
:
database
...
...
ee/config/metrics/counts_all/20210607044126_user_api_fuzzing_scans.yml
View file @
c4ae56bc
...
...
@@ -6,7 +6,7 @@ product_stage: secure
product_group
:
group::dynamic analysis
product_category
:
fuzz-testing
value_type
:
number
status
:
d
ata_available
status
:
d
eprecated
data_category
:
optional
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49444
time_frame
:
all
...
...
ee/config/metrics/counts_all/20210810033334_user_cluster_image_scanning_scans.yml
0 → 100644
View file @
c4ae56bc
---
key_path
:
usage_activity_by_stage.secure.user_cluster_image_scanning_scans
description
:
Number of users who have run a Cluster image scan
product_section
:
sec
product_stage
:
protect
product_group
:
group::container security
value_type
:
number
status
:
deprecated
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49444
time_frame
:
all
data_source
:
database
data_category
:
Optional
distribution
:
-
ee
tier
:
-
ultimate
ee/lib/ee/gitlab/usage_data.rb
View file @
c4ae56bc
...
...
@@ -370,7 +370,7 @@ module EE
finish:
maximum_id
(
::
User
))
end
results
.
merge!
(
count_secure_user_scans
(
time_period
)
)
results
.
merge!
(
count_secure_user_scans
)
results
.
merge!
(
count_secure_pipelines
(
time_period
))
results
.
merge!
(
count_secure_scans
(
time_period
))
...
...
@@ -388,28 +388,10 @@ module EE
private
# rubocop:disable UsageData/LargeTable
# rubocop:disable CodeReuse/ActiveRecord
def
count_secure_user_scans
(
time_period
)
return
{}
if
time_period
.
blank?
user_scans
=
{}
start_id
,
finish_id
=
min_max_security_scan_id
(
time_period
)
::
Security
::
Scan
.
scan_types
.
each
do
|
name
,
scan_type
|
relation
=
::
Security
::
Scan
.
latest_successful_by_build
.
by_scan_types
(
scan_type
)
.
where
(
security_scans:
time_period
)
if
start_id
&&
finish_id
user_scans
[
"user_
#{
name
}
_scans"
.
to_sym
]
=
estimate_batch_distinct_count
(
relation
,
:user_id
,
batch_size:
1000
,
start:
start_id
,
finish:
finish_id
)
end
end
user_scans
def
count_secure_user_scans
::
Security
::
Scan
.
scan_types
.
to_h
{
|
name
,
_
|
[
"user_
#{
name
}
_scans"
.
to_sym
,
::
Gitlab
::
UsageData
::
DEPRECATED_VALUE
]
}
end
# rubocop:enable UsageData/LargeTable
# rubocop:enable CodeReuse/ActiveRecord
# rubocop:disable CodeReuse/ActiveRecord
# rubocop: disable UsageData/LargeTable
...
...
ee/spec/config/metrics/every_metric_definition_spec.rb
View file @
c4ae56bc
...
...
@@ -29,13 +29,6 @@ RSpec.describe 'Every metric definition' do
mock_ci
mock_monitoring
user_auth_by_provider
user_dast_scans
user_sast_scans
user_dependency_scanning_scans
user_container_scanning_scans
user_secret_detection_scans
user_coverage_fuzzing_scans
user_api_fuzzing_scans
)
.
freeze
end
...
...
ee/spec/lib/ee/gitlab/usage_data_non_sql_metrics_spec.rb
View file @
c4ae56bc
...
...
@@ -15,7 +15,7 @@ RSpec.describe Gitlab::UsageDataNonSqlMetrics do
described_class
.
uncached_data
end
expect
(
recorder
.
count
).
to
eq
(
5
6
)
expect
(
recorder
.
count
).
to
eq
(
5
4
)
end
end
end
ee/spec/lib/ee/gitlab/usage_data_spec.rb
View file @
c4ae56bc
...
...
@@ -744,30 +744,15 @@ RSpec.describe Gitlab::UsageData do
)
end
it
'counts users who have run scans'
do
for_defined_days_back
do
create
(
:ee_ci_build
,
:api_fuzzing
,
:success
,
user:
user3
)
create
(
:ee_ci_build
,
:dast
,
:running
,
user:
user2
)
create
(
:ee_ci_build
,
:dast
,
:success
,
user:
user3
)
create
(
:ee_ci_build
,
:container_scanning
,
:success
,
user:
user3
)
create
(
:ee_ci_build
,
:coverage_fuzzing
,
:success
,
user:
user
)
create
(
:ee_ci_build
,
:dependency_scanning
,
:success
,
user:
user
)
create
(
:ee_ci_build
,
:dependency_scanning
,
:failed
,
user:
user2
)
create
(
:ee_ci_build
,
:sast
,
:success
,
user:
user2
)
create
(
:ee_ci_build
,
:sast
,
:success
,
user:
user3
)
create
(
:ee_ci_build
,
:secret_detection
,
:success
,
user:
user
)
create
(
:ee_ci_build
,
:secret_detection
,
:success
,
user:
user
)
create
(
:ee_ci_build
,
:secret_detection
,
:failed
,
user:
user2
)
end
it
'deprecates count for users who have run scans'
do
expect
(
described_class
.
usage_activity_by_stage_secure
(
described_class
.
monthly_time_range_db_params
)).
to
include
(
user_api_fuzzing_scans:
be_within
(
error_rate
).
percent_of
(
1
)
,
user_container_scanning_scans:
be_within
(
error_rate
).
percent_of
(
1
)
,
user_coverage_fuzzing_scans:
be_within
(
error_rate
).
percent_of
(
1
)
,
user_dast_scans:
be_within
(
error_rate
).
percent_of
(
1
)
,
user_dependency_scanning_scans:
be_within
(
error_rate
).
percent_of
(
1
)
,
user_sast_scans:
be_within
(
error_rate
).
percent_of
(
2
)
,
user_secret_detection_scans:
be_within
(
error_rate
).
percent_of
(
1
)
user_api_fuzzing_scans:
described_class
::
DEPRECATED_VALUE
,
user_container_scanning_scans:
described_class
::
DEPRECATED_VALUE
,
user_coverage_fuzzing_scans:
described_class
::
DEPRECATED_VALUE
,
user_dast_scans:
described_class
::
DEPRECATED_VALUE
,
user_dependency_scanning_scans:
described_class
::
DEPRECATED_VALUE
,
user_sast_scans:
described_class
::
DEPRECATED_VALUE
,
user_secret_detection_scans:
described_class
::
DEPRECATED_VALUE
)
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