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
ad7f689f
Commit
ad7f689f
authored
Oct 12, 2020
by
Sean Arnold
Committed by
Peter Leitzen
Oct 15, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add projects_incident_sla_enabled metric to usage data
We are skipping the time period last 28 days.
parent
5247e5ae
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
28 additions
and
3 deletions
+28
-3
ee/app/models/ee/project.rb
ee/app/models/ee/project.rb
+1
-0
ee/changelogs/unreleased/255986-metric-incident-sla-enabled.yml
...ngelogs/unreleased/255986-metric-incident-sla-enabled.yml
+5
-0
ee/lib/ee/gitlab/usage_data.rb
ee/lib/ee/gitlab/usage_data.rb
+2
-1
ee/spec/factories/incident_management/project_incident_management_settings.rb
...cident_management/project_incident_management_settings.rb
+5
-0
ee/spec/lib/ee/gitlab/usage_data_spec.rb
ee/spec/lib/ee/gitlab/usage_data_spec.rb
+5
-2
ee/spec/models/project_spec.rb
ee/spec/models/project_spec.rb
+10
-0
No files found.
ee/app/models/ee/project.rb
View file @
ad7f689f
...
...
@@ -135,6 +135,7 @@ module EE
scope
:with_github_service_pipeline_events
,
->
{
joins
(
:github_service
).
merge
(
GithubService
.
pipeline_hooks
)
}
scope
:with_active_prometheus_service
,
->
{
joins
(
:prometheus_service
).
merge
(
PrometheusService
.
active
)
}
scope
:with_enabled_error_tracking
,
->
{
joins
(
:error_tracking_setting
).
where
(
project_error_tracking_settings:
{
enabled:
true
})
}
scope
:with_enabled_incident_sla
,
->
{
joins
(
:incident_management_setting
).
where
(
project_incident_management_settings:
{
sla_timer:
true
})
}
scope
:mirrored_with_enabled_pipelines
,
->
do
joins
(
:project_feature
).
mirror
.
where
(
mirror_trigger_builds:
true
,
project_features:
{
builds_access_level:
::
ProjectFeature
::
ENABLED
})
...
...
ee/changelogs/unreleased/255986-metric-incident-sla-enabled.yml
0 → 100644
View file @
ad7f689f
---
title
:
Add metric count for projects with incident sla enabled
merge_request
:
45092
author
:
type
:
added
ee/lib/ee/gitlab/usage_data.rb
View file @
ad7f689f
...
...
@@ -294,7 +294,8 @@ module EE
super
.
merge
({
operations_dashboard_users_with_projects_added:
distinct_count
(
UsersOpsDashboardProject
.
joins
(
:user
).
merge
(
::
User
.
active
).
where
(
time_period
),
:user_id
),
projects_prometheus_active:
distinct_count
(
::
Project
.
with_active_prometheus_service
.
where
(
time_period
),
:creator_id
),
projects_with_error_tracking_enabled:
distinct_count
(
::
Project
.
with_enabled_error_tracking
.
where
(
time_period
),
:creator_id
)
projects_with_error_tracking_enabled:
distinct_count
(
::
Project
.
with_enabled_error_tracking
.
where
(
time_period
),
:creator_id
),
projects_incident_sla_enabled:
count
(
::
Project
.
with_enabled_incident_sla
)
})
end
...
...
ee/spec/factories/incident_management/project_incident_management_settings.rb
View file @
ad7f689f
...
...
@@ -4,5 +4,10 @@ FactoryBot.modify do
factory
:project_incident_management_setting
,
class:
'IncidentManagement::ProjectIncidentManagementSetting'
do
sla_timer
{
false
}
sla_timer_minutes
{
nil
}
trait
:sla_enabled
do
sla_timer
{
true
}
sla_timer_minutes
{
15
}
end
end
end
ee/spec/lib/ee/gitlab/usage_data_spec.rb
View file @
ad7f689f
...
...
@@ -437,17 +437,20 @@ RSpec.describe Gitlab::UsageData do
create
(
:users_ops_dashboard_project
,
user:
user
)
create
(
:prometheus_service
,
project:
project
)
create
(
:project_error_tracking_setting
,
project:
project
)
create
(
:project_incident_management_setting
,
:sla_enabled
,
project:
project
)
end
expect
(
described_class
.
usage_activity_by_stage_monitor
({})).
to
include
(
operations_dashboard_users_with_projects_added:
2
,
projects_prometheus_active:
2
,
projects_with_error_tracking_enabled:
2
projects_with_error_tracking_enabled:
2
,
projects_incident_sla_enabled:
2
)
expect
(
described_class
.
usage_activity_by_stage_monitor
(
described_class
.
last_28_days_time_period
)).
to
include
(
operations_dashboard_users_with_projects_added:
1
,
projects_prometheus_active:
1
,
projects_with_error_tracking_enabled:
1
projects_with_error_tracking_enabled:
1
,
projects_incident_sla_enabled:
2
)
end
end
...
...
ee/spec/models/project_spec.rb
View file @
ad7f689f
...
...
@@ -195,6 +195,16 @@ RSpec.describe Project do
end
end
describe
'.with_enabled_incident_sla'
do
it
'returns the correct project'
do
project_with_enabled_incident_sla
=
create
(
:project_incident_management_setting
,
:sla_enabled
).
project
project_without_enabled_incident_sla
=
create
(
:project_incident_management_setting
).
project
expect
(
described_class
.
with_enabled_incident_sla
).
to
include
(
project_with_enabled_incident_sla
)
expect
(
described_class
.
with_enabled_incident_sla
).
not_to
include
(
project_without_enabled_incident_sla
)
end
end
describe
'.with_shared_runners_limit_enabled'
do
let
(
:public_cost_factor
)
{
1.0
}
...
...
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