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
9de3acdf
Commit
9de3acdf
authored
Nov 04, 2020
by
Sean Arnold
Committed by
Mayra Cabrera
Nov 04, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add project with alerts created metric
parent
f883775b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
1 deletion
+12
-1
changelogs/unreleased/263552-number-of-projects-active-alerts.yml
...gs/unreleased/263552-number-of-projects-active-alerts.yml
+5
-0
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
+4
-0
No files found.
changelogs/unreleased/263552-number-of-projects-active-alerts.yml
0 → 100644
View file @
9de3acdf
---
title
:
Add metric count for projects with alerts created
merge_request
:
46636
author
:
type
:
added
lib/gitlab/usage_data.rb
View file @
9de3acdf
...
...
@@ -160,6 +160,7 @@ module Gitlab
projects_with_tracing_enabled:
count
(
ProjectTracingSetting
),
projects_with_error_tracking_enabled:
count
(
::
ErrorTracking
::
ProjectErrorTrackingSetting
.
where
(
enabled:
true
)),
projects_with_alerts_service_enabled:
count
(
AlertsService
.
active
),
projects_with_alerts_created:
distinct_count
(
::
AlertManagement
::
Alert
,
:project_id
),
projects_with_prometheus_alerts:
distinct_count
(
PrometheusAlert
,
:project_id
),
projects_with_terraform_reports:
distinct_count
(
::
Ci
::
JobArtifact
.
terraform_reports
,
:project_id
),
projects_with_terraform_states:
distinct_count
(
::
Terraform
::
State
,
:project_id
),
...
...
@@ -215,7 +216,8 @@ module Gitlab
# rubocop: enable UsageData/LargeTable:
packages:
count
(
::
Packages
::
Package
.
where
(
last_28_days_time_period
)),
personal_snippets:
count
(
PersonalSnippet
.
where
(
last_28_days_time_period
)),
project_snippets:
count
(
ProjectSnippet
.
where
(
last_28_days_time_period
))
project_snippets:
count
(
ProjectSnippet
.
where
(
last_28_days_time_period
)),
projects_with_alerts_created:
distinct_count
(
::
AlertManagement
::
Alert
.
where
(
last_28_days_time_period
),
:project_id
)
}.
merge
(
snowplow_event_counts
(
last_28_days_time_period
(
column: :collector_tstamp
))
).
tap
do
|
data
|
...
...
spec/lib/gitlab/usage_data_spec.rb
View file @
9de3acdf
...
...
@@ -302,6 +302,7 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
operations_dashboard_default_dashboard:
2
,
projects_with_tracing_enabled:
2
)
expect
(
described_class
.
usage_activity_by_stage_monitor
(
described_class
.
last_28_days_time_period
)).
to
include
(
clusters:
1
,
clusters_applications_prometheus:
1
,
...
...
@@ -463,6 +464,7 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
expect
(
count_data
[
:projects_with_prometheus_alerts
]).
to
eq
(
2
)
expect
(
count_data
[
:projects_with_terraform_reports
]).
to
eq
(
2
)
expect
(
count_data
[
:projects_with_terraform_states
]).
to
eq
(
2
)
expect
(
count_data
[
:projects_with_alerts_created
]).
to
eq
(
1
)
expect
(
count_data
[
:protected_branches
]).
to
eq
(
2
)
expect
(
count_data
[
:protected_branches_except_default
]).
to
eq
(
1
)
expect
(
count_data
[
:terraform_reports
]).
to
eq
(
6
)
...
...
@@ -604,6 +606,7 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
create
(
:deployment
,
:success
,
deployment_options
)
create
(
:project_snippet
,
project:
project
,
created_at:
n
.
days
.
ago
)
create
(
:personal_snippet
,
created_at:
n
.
days
.
ago
)
create
(
:alert_management_alert
,
project:
project
,
created_at:
n
.
days
.
ago
)
end
stub_application_setting
(
self_monitoring_project:
project
)
...
...
@@ -624,6 +627,7 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
expect
(
counts_monthly
[
:snippets
]).
to
eq
(
2
)
expect
(
counts_monthly
[
:personal_snippets
]).
to
eq
(
1
)
expect
(
counts_monthly
[
:project_snippets
]).
to
eq
(
1
)
expect
(
counts_monthly
[
:projects_with_alerts_created
]).
to
eq
(
1
)
expect
(
counts_monthly
[
:packages
]).
to
eq
(
1
)
expect
(
counts_monthly
[
:promoted_issues
]).
to
eq
(
1
)
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