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
74c2c527
Commit
74c2c527
authored
Sep 16, 2020
by
Peter Leitzen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move Tracing usage data ping to Core
This commit moves tracing related usage ping from Ultimate to Core.
parent
07e89322
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
22 additions
and
14 deletions
+22
-14
app/models/project.rb
app/models/project.rb
+1
-0
changelogs/unreleased/pl-tracing-core-2-usage-data.yml
changelogs/unreleased/pl-tracing-core-2-usage-data.yml
+5
-0
ee/app/models/ee/project.rb
ee/app/models/ee/project.rb
+0
-1
ee/lib/ee/gitlab/usage_data.rb
ee/lib/ee/gitlab/usage_data.rb
+1
-3
ee/spec/lib/ee/gitlab/usage_data_spec.rb
ee/spec/lib/ee/gitlab/usage_data_spec.rb
+2
-7
lib/gitlab/usage_data.rb
lib/gitlab/usage_data.rb
+3
-1
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
+6
-2
spec/support/helpers/usage_data_helpers.rb
spec/support/helpers/usage_data_helpers.rb
+1
-0
No files found.
app/models/project.rb
View file @
74c2c527
...
...
@@ -565,6 +565,7 @@ class Project < ApplicationRecord
}
scope
:imported_from
,
->
(
type
)
{
where
(
import_type:
type
)
}
scope
:with_tracing_enabled
,
->
{
joins
(
:tracing_setting
)
}
enum
auto_cancel_pending_pipelines:
{
disabled:
0
,
enabled:
1
}
...
...
changelogs/unreleased/pl-tracing-core-2-usage-data.yml
0 → 100644
View file @
74c2c527
---
title
:
Move Tracing usage data ping to Core
merge_request
:
44006
author
:
type
:
added
ee/app/models/ee/project.rb
View file @
74c2c527
...
...
@@ -135,7 +135,6 @@ module EE
scope
:with_github_service_pipeline_events
,
->
{
joins
(
:github_service
).
merge
(
GithubService
.
pipeline_hooks
)
}
scope
:with_active_prometheus_service
,
->
{
joins
(
:prometheus_service
).
merge
(
PrometheusService
.
active
)
}
scope
:with_enabled_error_tracking
,
->
{
joins
(
:error_tracking_setting
).
where
(
project_error_tracking_settings:
{
enabled:
true
})
}
scope
:with_tracing_enabled
,
->
{
joins
(
:tracing_setting
)
}
scope
:mirrored_with_enabled_pipelines
,
->
do
joins
(
:project_feature
).
mirror
.
where
(
mirror_trigger_builds:
true
,
project_features:
{
builds_access_level:
::
ProjectFeature
::
ENABLED
})
...
...
ee/lib/ee/gitlab/usage_data.rb
View file @
74c2c527
...
...
@@ -193,7 +193,6 @@ module EE
merge_requests_with_required_codeowners:
distinct_count
(
::
ApprovalMergeRequestRule
.
code_owner_approval_required
,
:merge_request_id
),
projects_mirrored_with_pipelines_enabled:
count
(
::
Project
.
mirrored_with_enabled_pipelines
),
projects_reporting_ci_cd_back_to_github:
count
(
::
GithubService
.
active
),
projects_with_tracing_enabled:
count
(
ProjectTracingSetting
),
status_page_projects:
count
(
::
StatusPage
::
ProjectSetting
.
enabled
),
status_page_issues:
count
(
::
Issue
.
on_status_page
,
start:
issue_minimum_id
,
finish:
issue_maximum_id
),
template_repositories:
count
(
::
Project
.
with_repos_templates
)
+
count
(
::
Project
.
with_groups_level_repos_templates
)
...
...
@@ -283,8 +282,7 @@ module EE
super
.
merge
({
operations_dashboard_users_with_projects_added:
distinct_count
(
UsersOpsDashboardProject
.
joins
(
:user
).
merge
(
::
User
.
active
).
where
(
time_period
),
:user_id
),
projects_prometheus_active:
distinct_count
(
::
Project
.
with_active_prometheus_service
.
where
(
time_period
),
:creator_id
),
projects_with_error_tracking_enabled:
distinct_count
(
::
Project
.
with_enabled_error_tracking
.
where
(
time_period
),
:creator_id
),
projects_with_tracing_enabled:
distinct_count
(
::
Project
.
with_tracing_enabled
.
where
(
time_period
),
:creator_id
)
projects_with_error_tracking_enabled:
distinct_count
(
::
Project
.
with_enabled_error_tracking
.
where
(
time_period
),
:creator_id
)
})
end
...
...
ee/spec/lib/ee/gitlab/usage_data_spec.rb
View file @
74c2c527
...
...
@@ -37,7 +37,6 @@ RSpec.describe Gitlab::UsageData do
create
(
:service
,
project:
projects
[
1
],
type:
'JenkinsService'
,
active:
true
)
create
(
:jira_service
,
project:
projects
[
0
],
issues_enabled:
true
,
project_key:
'GL'
)
create
(
:project_tracing_setting
,
project:
projects
[
0
])
create
(
:operations_feature_flag
,
project:
projects
[
0
])
create
(
:issue
,
project:
projects
[
1
])
...
...
@@ -107,7 +106,6 @@ RSpec.describe Gitlab::UsageData do
projects_mirrored_with_pipelines_enabled
projects_reporting_ci_cd_back_to_github
projects_with_prometheus_alerts
projects_with_tracing_enabled
sast_jobs
secret_detection_jobs
status_page_incident_publishes
...
...
@@ -422,20 +420,17 @@ RSpec.describe Gitlab::UsageData do
create
(
:users_ops_dashboard_project
,
user:
user
)
create
(
:prometheus_service
,
project:
project
)
create
(
:project_error_tracking_setting
,
project:
project
)
create
(
:project_tracing_setting
,
project:
project
)
end
expect
(
described_class
.
usage_activity_by_stage_monitor
({})).
to
include
(
operations_dashboard_users_with_projects_added:
2
,
projects_prometheus_active:
2
,
projects_with_error_tracking_enabled:
2
,
projects_with_tracing_enabled:
2
projects_with_error_tracking_enabled:
2
)
expect
(
described_class
.
usage_activity_by_stage_monitor
(
described_class
.
last_28_days_time_period
)).
to
include
(
operations_dashboard_users_with_projects_added:
1
,
projects_prometheus_active:
1
,
projects_with_error_tracking_enabled:
1
,
projects_with_tracing_enabled:
1
projects_with_error_tracking_enabled:
1
)
end
end
...
...
lib/gitlab/usage_data.rb
View file @
74c2c527
...
...
@@ -141,6 +141,7 @@ module Gitlab
projects_creating_incidents:
distinct_count
(
Issue
.
incident
,
:project_id
),
projects_imported_from_github:
count
(
Project
.
where
(
import_type:
'github'
)),
projects_with_repositories_enabled:
count
(
ProjectFeature
.
where
(
'repository_access_level > ?'
,
ProjectFeature
::
DISABLED
)),
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_prometheus_alerts:
distinct_count
(
PrometheusAlert
,
:project_id
),
...
...
@@ -573,7 +574,8 @@ module Gitlab
clusters_applications_prometheus:
cluster_applications_user_distinct_count
(
::
Clusters
::
Applications
::
Prometheus
,
time_period
),
operations_dashboard_default_dashboard:
count
(
::
User
.
active
.
with_dashboard
(
'operations'
).
where
(
time_period
),
start:
user_minimum_id
,
finish:
user_maximum_id
)
finish:
user_maximum_id
),
projects_with_tracing_enabled:
distinct_count
(
::
Project
.
with_tracing_enabled
.
where
(
time_period
),
:creator_id
)
}
end
# rubocop: enable CodeReuse/ActiveRecord
...
...
spec/factories/usage_data.rb
View file @
74c2c527
...
...
@@ -50,6 +50,9 @@ FactoryBot.define do
create
(
:protected_branch
,
project:
projects
[
0
])
create
(
:protected_branch
,
name:
'main'
,
project:
projects
[
0
])
# Tracing
create
(
:project_tracing_setting
,
project:
projects
[
0
])
# Incident Labeled Issues
incident_label
=
create
(
:label
,
:incident
,
project:
projects
[
0
])
create
(
:labeled_issue
,
project:
projects
[
0
],
labels:
[
incident_label
])
...
...
spec/lib/gitlab/usage_data_spec.rb
View file @
74c2c527
...
...
@@ -285,17 +285,20 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
cluster
=
create
(
:cluster
,
user:
user
)
create
(
:project
,
creator:
user
)
create
(
:clusters_applications_prometheus
,
:installed
,
cluster:
cluster
)
create
(
:project_tracing_setting
)
end
expect
(
described_class
.
usage_activity_by_stage_monitor
({})).
to
include
(
clusters:
2
,
clusters_applications_prometheus:
2
,
operations_dashboard_default_dashboard:
2
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
,
operations_dashboard_default_dashboard:
1
operations_dashboard_default_dashboard:
1
,
projects_with_tracing_enabled:
1
)
end
end
...
...
@@ -445,6 +448,7 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
expect
(
count_data
[
:projects_inheriting_instance_mattermost_active
]).
to
eq
(
1
)
expect
(
count_data
[
:projects_with_repositories_enabled
]).
to
eq
(
3
)
expect
(
count_data
[
:projects_with_error_tracking_enabled
]).
to
eq
(
1
)
expect
(
count_data
[
:projects_with_tracing_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
)
...
...
spec/support/helpers/usage_data_helpers.rb
View file @
74c2c527
...
...
@@ -99,6 +99,7 @@ module UsageDataHelpers
projects_with_error_tracking_enabled
projects_with_alerts_service_enabled
projects_with_prometheus_alerts
projects_with_tracing_enabled
projects_with_expiration_policy_enabled
projects_with_expiration_policy_disabled
projects_with_expiration_policy_enabled_with_keep_n_unset
...
...
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