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
ebf045fb
Commit
ebf045fb
authored
May 15, 2020
by
Allison Browne
Committed by
Peter Leitzen
May 15, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Account for identical group labels
Labels are group or project scoped
parent
1e638da0
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
46 additions
and
2 deletions
+46
-2
app/models/issue.rb
app/models/issue.rb
+1
-0
changelogs/unreleased/213894-northstar-metric-monitor-health.yml
...ogs/unreleased/213894-northstar-metric-monitor-health.yml
+5
-0
doc/user/admin_area/settings/usage_statistics.md
doc/user/admin_area/settings/usage_statistics.md
+3
-1
lib/gitlab/usage_data.rb
lib/gitlab/usage_data.rb
+5
-1
spec/factories/usage_data.rb
spec/factories/usage_data.rb
+10
-0
spec/lib/gitlab/usage_data_spec.rb
spec/lib/gitlab/usage_data_spec.rb
+2
-0
spec/models/issue_spec.rb
spec/models/issue_spec.rb
+20
-0
No files found.
app/models/issue.rb
View file @
ebf045fb
...
...
@@ -84,6 +84,7 @@ class Issue < ApplicationRecord
scope
:preload_associated_models
,
->
{
preload
(
:assignees
,
:labels
,
project: :namespace
)
}
scope
:with_api_entity_associations
,
->
{
preload
(
:timelogs
,
:assignees
,
:author
,
:notes
,
:labels
,
project:
[
:route
,
{
namespace: :route
}]
)
}
scope
:with_label_attributes
,
->
(
label_attributes
)
{
joins
(
:labels
).
where
(
labels:
label_attributes
)
}
scope
:public_only
,
->
{
where
(
confidential:
false
)
}
scope
:confidential_only
,
->
{
where
(
confidential:
true
)
}
...
...
changelogs/unreleased/213894-northstar-metric-monitor-health.yml
0 → 100644
View file @
ebf045fb
---
title
:
Add incident_labeled_issues to usage ping
merge_request
:
31406
author
:
type
:
added
doc/user/admin_area/settings/usage_statistics.md
View file @
ebf045fb
...
...
@@ -312,7 +312,9 @@ but commented out to help encourage others to add to it in the future. -->
|epics|counts||
|feature_flags|counts||
|geo_nodes|counts||
|incident_issues|counts||
|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|
|ldap_group_links|counts||
|ldap_keys|counts||
|ldap_users|counts||
...
...
lib/gitlab/usage_data.rb
View file @
ebf045fb
...
...
@@ -63,6 +63,8 @@ module Gitlab
# rubocop: disable Metrics/AbcSize
# rubocop: disable CodeReuse/ActiveRecord
def
system_usage_data
alert_bot_incident_count
=
count
(
::
Issue
.
authored
(
::
User
.
alert_bot
))
{
counts:
{
assignee_lists:
count
(
List
.
assignee
),
...
...
@@ -112,7 +114,9 @@ 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
,
incident_issues:
count
(
::
Issue
.
authored
(
::
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
)),
keys:
count
(
Key
),
label_lists:
count
(
List
.
label
),
lfs_objects:
count
(
LfsObject
),
...
...
spec/factories/usage_data.rb
View file @
ebf045fb
...
...
@@ -40,6 +40,16 @@ FactoryBot.define do
create_list
(
:zoom_meeting
,
2
,
project:
projects
[
0
],
issue:
projects
[
0
].
issues
[
2
],
issue_status: :removed
)
create
(
:sentry_issue
,
issue:
projects
[
0
].
issues
[
0
])
# Incident Labeled Issues
incident_label_attrs
=
IncidentManagement
::
CreateIssueService
::
INCIDENT_LABEL
incident_label
=
create
(
:label
,
project:
projects
[
0
],
**
incident_label_attrs
)
create
(
:labeled_issue
,
project:
projects
[
0
],
labels:
[
incident_label
])
incident_group
=
create
(
:group
)
incident_label_scoped_to_project
=
create
(
:label
,
project:
projects
[
1
],
**
incident_label_attrs
)
incident_label_scoped_to_group
=
create
(
:group_label
,
group:
incident_group
,
**
incident_label_attrs
)
create
(
:labeled_issue
,
project:
projects
[
1
],
labels:
[
incident_label_scoped_to_project
])
create
(
:labeled_issue
,
project:
projects
[
1
],
labels:
[
incident_label_scoped_to_group
])
# Enabled clusters
gcp_cluster
=
create
(
:cluster_provider_gcp
,
:created
).
cluster
create
(
:cluster_provider_aws
,
:created
)
...
...
spec/lib/gitlab/usage_data_spec.rb
View file @
ebf045fb
...
...
@@ -62,6 +62,8 @@ 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
[
:alert_bot_incident_issues
]).
to
eq
(
4
)
expect
(
count_data
[
:incident_labeled_issues
]).
to
eq
(
3
)
expect
(
count_data
[
:clusters_enabled
]).
to
eq
(
6
)
expect
(
count_data
[
:project_clusters_enabled
]).
to
eq
(
4
)
...
...
spec/models/issue_spec.rb
View file @
ebf045fb
...
...
@@ -1030,4 +1030,24 @@ describe Issue do
it
{
is_expected
.
to
contain_exactly
(
design_a
,
design_c
)
}
end
end
describe
'.with_label_attributes'
do
subject
{
described_class
.
with_label_attributes
(
label_attributes
)
}
let
(
:label_attributes
)
{
{
title:
'hello world'
,
description:
'hi'
}
}
it
'gets issues with given label attributes'
do
label
=
create
(
:label
,
**
label_attributes
)
labeled_issue
=
create
(
:labeled_issue
,
project:
label
.
project
,
labels:
[
label
])
expect
(
subject
).
to
include
(
labeled_issue
)
end
it
'excludes issues without given label attributes'
do
label
=
create
(
:label
,
title:
'GitLab'
,
description:
'tanuki'
)
labeled_issue
=
create
(
:labeled_issue
,
project:
label
.
project
,
labels:
[
label
])
expect
(
subject
).
not_to
include
(
labeled_issue
)
end
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