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
48e9431e
Commit
48e9431e
authored
May 06, 2020
by
Matt Kasa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add terraform reports metrics to usage data
Relates to
https://gitlab.com/gitlab-org/gitlab/-/issues/207532
parent
6f044688
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
36 additions
and
0 deletions
+36
-0
app/models/ci/job_artifact.rb
app/models/ci/job_artifact.rb
+1
-0
changelogs/unreleased/mattkasa-207532-add-usage-ping-for-terraform-reports.yml
.../mattkasa-207532-add-usage-ping-for-terraform-reports.yml
+5
-0
db/migrate/20200512160004_add_index_to_ci_job_artifacts_for_terraform_reports.rb
...04_add_index_to_ci_job_artifacts_for_terraform_reports.rb
+18
-0
db/structure.sql
db/structure.sql
+3
-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/ci/job_artifact.rb
View file @
48e9431e
...
...
@@ -5,6 +5,7 @@ module Ci
include
AfterCommitQueue
include
ObjectStorage
::
BackgroundMove
include
UpdateProjectStatistics
include
UsageStatistics
include
Sortable
extend
Gitlab
::
Ci
::
Model
...
...
changelogs/unreleased/mattkasa-207532-add-usage-ping-for-terraform-reports.yml
0 → 100644
View file @
48e9431e
---
title
:
Add usage data metrics for terraform reports
merge_request
:
31281
author
:
type
:
added
db/migrate/20200512160004_add_index_to_ci_job_artifacts_for_terraform_reports.rb
0 → 100644
View file @
48e9431e
# frozen_string_literal: true
class
AddIndexToCiJobArtifactsForTerraformReports
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
INDEX_NAME
=
'index_ci_job_artifacts_for_terraform_reports'
disable_ddl_transaction!
def
up
add_concurrent_index
:ci_job_artifacts
,
[
:project_id
,
:id
],
where:
'file_type = 18'
,
name:
INDEX_NAME
end
def
down
remove_concurrent_index_by_name
:ci_job_artifacts
,
INDEX_NAME
end
end
db/structure.sql
View file @
48e9431e
...
...
@@ -9258,6 +9258,8 @@ CREATE UNIQUE INDEX index_ci_instance_variables_on_key ON public.ci_instance_var
CREATE
INDEX
index_ci_job_artifacts_file_store_is_null
ON
public
.
ci_job_artifacts
USING
btree
(
id
)
WHERE
(
file_store
IS
NULL
);
CREATE
INDEX
index_ci_job_artifacts_for_terraform_reports
ON
public
.
ci_job_artifacts
USING
btree
(
project_id
,
id
)
WHERE
(
file_type
=
18
);
CREATE
INDEX
index_ci_job_artifacts_on_expire_at_and_job_id
ON
public
.
ci_job_artifacts
USING
btree
(
expire_at
,
job_id
);
CREATE
INDEX
index_ci_job_artifacts_on_file_store
ON
public
.
ci_job_artifacts
USING
btree
(
file_store
);
...
...
@@ -13856,6 +13858,7 @@ COPY "schema_migrations" (version) FROM STDIN;
20200511162115
20200511220023
20200512085150
20200512160004
20200512164334
20200513160930
20200513171959
...
...
lib/gitlab/usage_data.rb
View file @
48e9431e
...
...
@@ -131,11 +131,13 @@ module Gitlab
projects_with_error_tracking_enabled:
count
(
::
ErrorTracking
::
ProjectErrorTrackingSetting
.
where
(
enabled:
true
)),
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
),
protected_branches:
count
(
ProtectedBranch
),
releases:
count
(
Release
),
remote_mirrors:
count
(
RemoteMirror
),
snippets:
count
(
Snippet
),
suggestions:
count
(
Suggestion
),
terraform_reports:
count
(
::
Ci
::
JobArtifact
.
terraform_reports
),
todos:
count
(
Todo
),
uploads:
count
(
Upload
),
web_hooks:
count
(
WebHook
),
...
...
spec/factories/usage_data.rb
View file @
48e9431e
...
...
@@ -33,6 +33,9 @@ FactoryBot.define do
issues
=
create_list
(
:issue
,
4
,
project:
projects
[
0
])
create_list
(
:prometheus_alert
,
2
,
project:
projects
[
0
])
create
(
:prometheus_alert
,
project:
projects
[
1
])
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
(
: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 @
48e9431e
...
...
@@ -57,6 +57,8 @@ describe Gitlab::UsageData, :aggregate_failures do
expect
(
count_data
[
:projects_with_error_tracking_enabled
]).
to
eq
(
1
)
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
[
:terraform_reports
]).
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 @
48e9431e
...
...
@@ -117,12 +117,14 @@ module UsageDataHelpers
projects_with_expiration_policy_enabled_with_cadence_set_to_14d
projects_with_expiration_policy_enabled_with_cadence_set_to_1month
projects_with_expiration_policy_enabled_with_cadence_set_to_3month
projects_with_terraform_reports
pages_domains
protected_branches
releases
remote_mirrors
snippets
suggestions
terraform_reports
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