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
15c3d420
Commit
15c3d420
authored
Nov 17, 2020
by
Sarah Yasonik
Committed by
Peter Leitzen
Nov 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add count of projects with new incidents to usage ping
parent
79f7a27c
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
49 additions
and
5 deletions
+49
-5
changelogs/unreleased/sy-add-new-incidents-to-usage-ping.yml
changelogs/unreleased/sy-add-new-incidents-to-usage-ping.yml
+5
-0
db/migrate/20201102184743_add_index_to_incident_issues_on_project_and_created_at.rb
...add_index_to_incident_issues_on_project_and_created_at.rb
+30
-0
db/schema_migrations/20201102184743
db/schema_migrations/20201102184743
+1
-0
db/structure.sql
db/structure.sql
+2
-2
lib/gitlab/usage_data.rb
lib/gitlab/usage_data.rb
+3
-1
spec/lib/gitlab/usage_data_spec.rb
spec/lib/gitlab/usage_data_spec.rb
+8
-2
No files found.
changelogs/unreleased/sy-add-new-incidents-to-usage-ping.yml
0 → 100644
View file @
15c3d420
---
title
:
Add new incident counts to usage ping
merge_request
:
46602
author
:
type
:
changed
db/migrate/20201102184743_add_index_to_incident_issues_on_project_and_created_at.rb
0 → 100644
View file @
15c3d420
# frozen_string_literal: true
class
AddIndexToIncidentIssuesOnProjectAndCreatedAt
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
INCIDENT_TYPE
=
1
OLD_INDEX_NAME
=
'index_issues_project_id_issue_type_incident'
NEW_INDEX_NAME
=
'index_issues_on_project_id_and_created_at_issue_type_incident'
DOWNTIME
=
false
disable_ddl_transaction!
def
up
add_concurrent_index
:issues
,
[
:project_id
,
:created_at
],
where:
"issue_type =
#{
INCIDENT_TYPE
}
"
,
name:
NEW_INDEX_NAME
remove_concurrent_index_by_name
:issues
,
OLD_INDEX_NAME
end
def
down
add_concurrent_index
:issues
,
:project_id
,
where:
"issue_type =
#{
INCIDENT_TYPE
}
"
,
name:
OLD_INDEX_NAME
remove_concurrent_index_by_name
:issues
,
NEW_INDEX_NAME
end
end
db/schema_migrations/20201102184743
0 → 100644
View file @
15c3d420
040e73d690cb315627fe16c931273aa1f86dfabb481dc2086f787d067b87642f
\ No newline at end of file
db/structure.sql
View file @
15c3d420
...
...
@@ -21029,6 +21029,8 @@ CREATE INDEX index_issues_on_moved_to_id ON issues USING btree (moved_to_id) WHE
CREATE
INDEX
index_issues_on_project_id_and_closed_at
ON
issues
USING
btree
(
project_id
,
closed_at
);
CREATE
INDEX
index_issues_on_project_id_and_created_at_issue_type_incident
ON
issues
USING
btree
(
project_id
,
created_at
)
WHERE
(
issue_type
=
1
);
CREATE
UNIQUE
INDEX
index_issues_on_project_id_and_external_key
ON
issues
USING
btree
(
project_id
,
external_key
)
WHERE
(
external_key
IS
NOT
NULL
);
CREATE
UNIQUE
INDEX
index_issues_on_project_id_and_iid
ON
issues
USING
btree
(
project_id
,
iid
);
...
...
@@ -21043,8 +21045,6 @@ CREATE INDEX index_issues_on_updated_at ON issues USING btree (updated_at);
CREATE
INDEX
index_issues_on_updated_by_id
ON
issues
USING
btree
(
updated_by_id
)
WHERE
(
updated_by_id
IS
NOT
NULL
);
CREATE
INDEX
index_issues_project_id_issue_type_incident
ON
issues
USING
btree
(
project_id
)
WHERE
(
issue_type
=
1
);
CREATE
UNIQUE
INDEX
index_jira_connect_installations_on_client_key
ON
jira_connect_installations
USING
btree
(
client_key
);
CREATE
INDEX
index_jira_connect_subscriptions_on_namespace_id
ON
jira_connect_subscriptions
USING
btree
(
namespace_id
);
...
...
lib/gitlab/usage_data.rb
View file @
15c3d420
...
...
@@ -632,7 +632,9 @@ module Gitlab
start:
user_minimum_id
,
finish:
user_maximum_id
),
projects_with_tracing_enabled:
distinct_count
(
::
Project
.
with_tracing_enabled
.
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_with_incidents:
distinct_count
(
::
Issue
.
incident
.
where
(
time_period
),
:project_id
),
projects_with_alert_incidents:
distinct_count
(
::
Issue
.
incident
.
with_alert_management_alerts
.
where
(
time_period
),
:project_id
)
}
end
# rubocop: enable CodeReuse/ActiveRecord
...
...
spec/lib/gitlab/usage_data_spec.rb
View file @
15c3d420
...
...
@@ -299,6 +299,8 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
create
(
:clusters_applications_prometheus
,
:installed
,
cluster:
cluster
)
create
(
:project_tracing_setting
)
create
(
:project_error_tracking_setting
)
create
(
:incident
)
create
(
:incident
,
alert_management_alert:
create
(
:alert_management_alert
))
end
expect
(
described_class
.
usage_activity_by_stage_monitor
({})).
to
include
(
...
...
@@ -306,7 +308,9 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
clusters_applications_prometheus:
2
,
operations_dashboard_default_dashboard:
2
,
projects_with_tracing_enabled:
2
,
projects_with_error_tracking_enabled:
2
projects_with_error_tracking_enabled:
2
,
projects_with_incidents:
4
,
projects_with_alert_incidents:
2
)
expect
(
described_class
.
usage_activity_by_stage_monitor
(
described_class
.
last_28_days_time_period
)).
to
include
(
...
...
@@ -314,7 +318,9 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
clusters_applications_prometheus:
1
,
operations_dashboard_default_dashboard:
1
,
projects_with_tracing_enabled:
1
,
projects_with_error_tracking_enabled:
1
projects_with_error_tracking_enabled:
1
,
projects_with_incidents:
2
,
projects_with_alert_incidents:
1
)
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