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
a08a8f55
Commit
a08a8f55
authored
May 06, 2020
by
Matt Kasa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add terraform state metrics to usage data
Relates to
https://gitlab.com/gitlab-org/gitlab/-/issues/207510
parent
ccd9218a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
16 additions
and
0 deletions
+16
-0
app/models/terraform/state.rb
app/models/terraform/state.rb
+2
-0
changelogs/unreleased/mattkasa-207510-terraform-state-usage-ping.yml
...unreleased/mattkasa-207510-terraform-state-usage-ping.yml
+5
-0
lib/gitlab/usage_data.rb
lib/gitlab/usage_data.rb
+2
-0
spec/factories/usage_data.rb
spec/factories/usage_data.rb
+3
-0
spec/lib/gitlab/usage_data_spec.rb
spec/lib/gitlab/usage_data_spec.rb
+2
-0
spec/support/helpers/usage_data_helpers.rb
spec/support/helpers/usage_data_helpers.rb
+2
-0
No files found.
app/models/terraform/state.rb
View file @
a08a8f55
...
...
@@ -2,6 +2,8 @@
module
Terraform
class
State
<
ApplicationRecord
include
UsageStatistics
DEFAULT
=
'{"version":1}'
.
freeze
HEX_REGEXP
=
%r{
\A\h
+
\z
}
.
freeze
UUID_LENGTH
=
32
...
...
changelogs/unreleased/mattkasa-207510-terraform-state-usage-ping.yml
0 → 100644
View file @
a08a8f55
---
title
:
Add usage data metrics for terraform states
merge_request
:
31280
author
:
type
:
added
lib/gitlab/usage_data.rb
View file @
a08a8f55
...
...
@@ -132,12 +132,14 @@ module Gitlab
projects_with_alerts_service_enabled:
count
(
AlertsService
.
active
),
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
),
protected_branches:
count
(
ProtectedBranch
),
releases:
count
(
Release
),
remote_mirrors:
count
(
RemoteMirror
),
snippets:
count
(
Snippet
),
suggestions:
count
(
Suggestion
),
terraform_reports:
count
(
::
Ci
::
JobArtifact
.
terraform_reports
),
terraform_states:
count
(
::
Terraform
::
State
),
todos:
count
(
Todo
),
uploads:
count
(
Upload
),
web_hooks:
count
(
WebHook
),
...
...
spec/factories/usage_data.rb
View file @
a08a8f55
...
...
@@ -36,6 +36,9 @@ FactoryBot.define do
create
(
:merge_request
,
:simple
,
:with_terraform_reports
,
source_project:
projects
[
0
])
create
(
:merge_request
,
:rebased
,
:with_terraform_reports
,
source_project:
projects
[
0
])
create
(
:merge_request
,
:simple
,
:with_terraform_reports
,
source_project:
projects
[
1
])
create
(
:terraform_state
,
project:
projects
[
0
])
create
(
:terraform_state
,
project:
projects
[
0
])
create
(
:terraform_state
,
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
)
create
(
:zoom_meeting
,
project:
projects
[
0
],
issue:
projects
[
0
].
issues
[
2
],
issue_status: :added
)
...
...
spec/lib/gitlab/usage_data_spec.rb
View file @
a08a8f55
...
...
@@ -58,7 +58,9 @@ describe Gitlab::UsageData, :aggregate_failures do
expect
(
count_data
[
:projects_with_alerts_service_enabled
]).
to
eq
(
1
)
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
[
:terraform_reports
]).
to
eq
(
3
)
expect
(
count_data
[
:terraform_states
]).
to
eq
(
3
)
expect
(
count_data
[
:issues_created_from_gitlab_error_tracking_ui
]).
to
eq
(
1
)
expect
(
count_data
[
:issues_with_associated_zoom_link
]).
to
eq
(
2
)
expect
(
count_data
[
:issues_using_zoom_quick_actions
]).
to
eq
(
3
)
...
...
spec/support/helpers/usage_data_helpers.rb
View file @
a08a8f55
...
...
@@ -118,6 +118,7 @@ module UsageDataHelpers
projects_with_expiration_policy_enabled_with_cadence_set_to_1month
projects_with_expiration_policy_enabled_with_cadence_set_to_3month
projects_with_terraform_reports
projects_with_terraform_states
pages_domains
protected_branches
releases
...
...
@@ -125,6 +126,7 @@ module UsageDataHelpers
snippets
suggestions
terraform_reports
terraform_states
todos
uploads
web_hooks
...
...
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