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
6764083d
Commit
6764083d
authored
May 15, 2020
by
Allison Browne
Committed by
Peter Leitzen
May 15, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add issues_created_gitlab_alerts to usage ping
Add a new metric that records issues manually created from alerts
parent
d8ed2944
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
29 additions
and
4 deletions
+29
-4
app/models/issue.rb
app/models/issue.rb
+2
-0
changelogs/unreleased/ab-north-star-usage-ping-2.yml
changelogs/unreleased/ab-north-star-usage-ping-2.yml
+5
-0
doc/user/admin_area/settings/usage_statistics.md
doc/user/admin_area/settings/usage_statistics.md
+1
-0
lib/gitlab/usage_data.rb
lib/gitlab/usage_data.rb
+1
-0
spec/factories/usage_data.rb
spec/factories/usage_data.rb
+7
-4
spec/lib/gitlab/usage_data_spec.rb
spec/lib/gitlab/usage_data_spec.rb
+1
-0
spec/models/issue_spec.rb
spec/models/issue_spec.rb
+12
-0
No files found.
app/models/issue.rb
View file @
6764083d
...
...
@@ -74,6 +74,7 @@ class Issue < ApplicationRecord
scope
:due_before
,
->
(
date
)
{
where
(
'issues.due_date < ?'
,
date
)
}
scope
:due_between
,
->
(
from_date
,
to_date
)
{
where
(
'issues.due_date >= ?'
,
from_date
).
where
(
'issues.due_date <= ?'
,
to_date
)
}
scope
:due_tomorrow
,
->
{
where
(
due_date:
Date
.
tomorrow
)
}
scope
:not_authored_by
,
->
(
user
)
{
where
.
not
(
author_id:
user
)
}
scope
:order_due_date_asc
,
->
{
reorder
(
::
Gitlab
::
Database
.
nulls_last_order
(
'due_date'
,
'ASC'
))
}
scope
:order_due_date_desc
,
->
{
reorder
(
::
Gitlab
::
Database
.
nulls_last_order
(
'due_date'
,
'DESC'
))
}
...
...
@@ -90,6 +91,7 @@ class Issue < ApplicationRecord
scope
:confidential_only
,
->
{
where
(
confidential:
true
)
}
scope
:counts_by_state
,
->
{
reorder
(
nil
).
group
(
:state_id
).
count
}
scope
:with_alert_management_alerts
,
->
{
joins
(
:alert_management_alert
)
}
# An issue can be uniquely identified by project_id and iid
# Takes one or more sets of composite IDs, expressed as hash-like records of
...
...
changelogs/unreleased/ab-north-star-usage-ping-2.yml
0 → 100644
View file @
6764083d
---
title
:
Add issues_created_gitlab_alerts to usage ping
merge_request
:
31802
author
:
type
:
added
doc/user/admin_area/settings/usage_statistics.md
View file @
6764083d
...
...
@@ -315,6 +315,7 @@ but commented out to help encourage others to add to it in the future. -->
|incident_issues|counts|monitor|Issues created by the alert bot|
|alert_bot_incident_issues|counts|monitor|Issues created by the alert bot|
|incident_labeled_issues|counts|monitor|Issues with the incident label|
|issues_created_gitlab_alerts|counts|monitor|issues created from alerts by non-alert bot users|
|ldap_group_links|counts||
|ldap_keys|counts||
|ldap_users|counts||
...
...
lib/gitlab/usage_data.rb
View file @
6764083d
...
...
@@ -114,6 +114,7 @@ module Gitlab
issues_with_associated_zoom_link:
count
(
ZoomMeeting
.
added_to_issue
),
issues_using_zoom_quick_actions:
distinct_count
(
ZoomMeeting
,
:issue_id
),
issues_with_embedded_grafana_charts_approx:
grafana_embed_usage_data
,
issues_created_gitlab_alerts:
count
(
Issue
.
with_alert_management_alerts
.
not_authored_by
(
::
User
.
alert_bot
)),
incident_issues:
alert_bot_incident_count
,
alert_bot_incident_issues:
alert_bot_incident_count
,
incident_labeled_issues:
count
(
::
Issue
.
with_label_attributes
(
IncidentManagement
::
CreateIssueService
::
INCIDENT_LABEL
)),
...
...
spec/factories/usage_data.rb
View file @
6764083d
...
...
@@ -28,11 +28,10 @@ FactoryBot.define do
create
(
:project_error_tracking_setting
,
project:
projects
[
1
],
enabled:
false
)
create
(
:alerts_service
,
project:
projects
[
0
])
create
(
:alerts_service
,
:inactive
,
project:
projects
[
1
])
create_list
(
:issue
,
2
,
project:
projects
[
0
],
author:
User
.
alert_bot
)
alert_bot_issues
=
create_list
(
:issue
,
2
,
project:
projects
[
0
],
author:
User
.
alert_bot
)
create_list
(
:issue
,
2
,
project:
projects
[
1
],
author:
User
.
alert_bot
)
create_list
(
:issue
,
4
,
project:
projects
[
0
])
create
(
:prometheus_alert
,
project:
projects
[
0
])
create
(
:prometheus_alert
,
project:
projects
[
0
])
issues
=
create_list
(
:issue
,
4
,
project:
projects
[
0
])
create_list
(
:prometheus_alert
,
2
,
project:
projects
[
0
])
create
(
:prometheus_alert
,
project:
projects
[
1
])
create
(
:zoom_meeting
,
project:
projects
[
0
],
issue:
projects
[
0
].
issues
[
0
],
issue_status: :added
)
create_list
(
:zoom_meeting
,
2
,
project:
projects
[
0
],
issue:
projects
[
0
].
issues
[
1
],
issue_status: :removed
)
...
...
@@ -50,6 +49,10 @@ FactoryBot.define do
create
(
:labeled_issue
,
project:
projects
[
1
],
labels:
[
incident_label_scoped_to_project
])
create
(
:labeled_issue
,
project:
projects
[
1
],
labels:
[
incident_label_scoped_to_group
])
# Alert Issues
create
(
:alert_management_alert
,
issue:
issues
[
0
],
project:
projects
[
0
])
create
(
:alert_management_alert
,
issue:
alert_bot_issues
[
0
],
project:
projects
[
0
])
# Enabled clusters
gcp_cluster
=
create
(
:cluster_provider_gcp
,
:created
).
cluster
create
(
:cluster_provider_aws
,
:created
)
...
...
spec/lib/gitlab/usage_data_spec.rb
View file @
6764083d
...
...
@@ -62,6 +62,7 @@ describe Gitlab::UsageData, :aggregate_failures do
expect
(
count_data
[
:issues_using_zoom_quick_actions
]).
to
eq
(
3
)
expect
(
count_data
[
:issues_with_embedded_grafana_charts_approx
]).
to
eq
(
2
)
expect
(
count_data
[
:incident_issues
]).
to
eq
(
4
)
expect
(
count_data
[
:issues_created_gitlab_alerts
]).
to
eq
(
1
)
expect
(
count_data
[
:alert_bot_incident_issues
]).
to
eq
(
4
)
expect
(
count_data
[
:incident_labeled_issues
]).
to
eq
(
3
)
...
...
spec/models/issue_spec.rb
View file @
6764083d
...
...
@@ -80,6 +80,18 @@ describe Issue do
end
end
describe
'.with_alert_management_alerts'
do
subject
{
described_class
.
with_alert_management_alerts
}
it
'gets only issues with alerts'
do
alert
=
create
(
:alert_management_alert
,
issue:
create
(
:issue
))
issue
=
create
(
:issue
)
expect
(
subject
).
to
contain_exactly
(
alert
.
issue
)
expect
(
subject
).
not_to
include
(
issue
)
end
end
describe
'locking'
do
using
RSpec
::
Parameterized
::
TableSyntax
...
...
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