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
d07788c2
Commit
d07788c2
authored
May 26, 2021
by
Adam Hegyi
Committed by
Mark Chao
May 27, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused instance statistics workers
Remove unused instance statistics workers Changelog: removed
parent
77f229f2
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
0 additions
and
156 deletions
+0
-156
app/workers/all_queues.yml
app/workers/all_queues.yml
+0
-20
app/workers/analytics/instance_statistics/count_job_trigger_worker.rb
...analytics/instance_statistics/count_job_trigger_worker.rb
+0
-24
app/workers/analytics/instance_statistics/counter_job_worker.rb
...rkers/analytics/instance_statistics/counter_job_worker.rb
+0
-23
config/sidekiq_queues.yml
config/sidekiq_queues.yml
+0
-2
spec/workers/analytics/instance_statistics/count_job_trigger_worker_spec.rb
...tics/instance_statistics/count_job_trigger_worker_spec.rb
+0
-17
spec/workers/analytics/instance_statistics/counter_job_worker_spec.rb
.../analytics/instance_statistics/counter_job_worker_spec.rb
+0
-70
No files found.
app/workers/all_queues.yml
View file @
d07788c2
...
...
@@ -153,16 +153,6 @@
:weight:
1
:idempotent:
:tags: []
-
:name: cronjob:analytics_instance_statistics_count_job_trigger
:worker_name: Analytics::InstanceStatistics::CountJobTriggerWorker
:feature_category: :devops_reports
:has_external_dependencies:
:urgency: :low
:resource_boundary: :unknown
:weight:
1
:idempotent:
true
:tags:
- :exclude_from_kubernetes
-
:name: cronjob:analytics_usage_trends_count_job_trigger
:worker_name: Analytics::UsageTrends::CountJobTriggerWorker
:feature_category: :devops_reports
...
...
@@ -1786,16 +1776,6 @@
:weight:
1
:idempotent:
true
:tags: []
-
:name: analytics_instance_statistics_counter_job
:worker_name: Analytics::InstanceStatistics::CounterJobWorker
:feature_category: :devops_reports
:has_external_dependencies:
:urgency: :low
:resource_boundary: :unknown
:weight:
1
:idempotent:
true
:tags:
- :exclude_from_kubernetes
-
:name: analytics_usage_trends_counter_job
:worker_name: Analytics::UsageTrends::CounterJobWorker
:feature_category: :devops_reports
...
...
app/workers/analytics/instance_statistics/count_job_trigger_worker.rb
deleted
100644 → 0
View file @
77f229f2
# frozen_string_literal: true
module
Analytics
module
InstanceStatistics
# This worker will be removed in 14.0
class
CountJobTriggerWorker
include
ApplicationWorker
sidekiq_options
retry:
3
include
CronjobQueue
# rubocop:disable Scalability/CronWorkerContext
feature_category
:devops_reports
tags
:exclude_from_kubernetes
urgency
:low
idempotent!
def
perform
# Delegate to the new worker
Analytics
::
UsageTrends
::
CountJobTriggerWorker
.
new
.
perform
end
end
end
end
app/workers/analytics/instance_statistics/counter_job_worker.rb
deleted
100644 → 0
View file @
77f229f2
# frozen_string_literal: true
module
Analytics
module
InstanceStatistics
# This worker will be removed in 14.0
class
CounterJobWorker
include
ApplicationWorker
sidekiq_options
retry:
3
feature_category
:devops_reports
urgency
:low
tags
:exclude_from_kubernetes
idempotent!
def
perform
(
*
args
)
# Delegate to the new worker
Analytics
::
UsageTrends
::
CounterJobWorker
.
new
.
perform
(
*
args
)
end
end
end
end
config/sidekiq_queues.yml
View file @
d07788c2
...
...
@@ -32,8 +32,6 @@
-
1
-
-
analytics_devops_adoption_create_snapshot
-
1
-
-
analytics_instance_statistics_counter_job
-
1
-
-
analytics_usage_trends_counter_job
-
1
-
-
approval_rules_external_approval_rule_payload
...
...
spec/workers/analytics/instance_statistics/count_job_trigger_worker_spec.rb
deleted
100644 → 0
View file @
77f229f2
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Analytics
::
InstanceStatistics
::
CountJobTriggerWorker
do
it_behaves_like
'an idempotent worker'
context
'triggers a job for each measurement identifiers'
do
let
(
:expected_count
)
{
Analytics
::
UsageTrends
::
Measurement
.
identifier_query_mapping
.
keys
.
size
}
it
'triggers CounterJobWorker jobs'
do
subject
.
perform
expect
(
Analytics
::
UsageTrends
::
CounterJobWorker
.
jobs
.
count
).
to
eq
(
expected_count
)
end
end
end
spec/workers/analytics/instance_statistics/counter_job_worker_spec.rb
deleted
100644 → 0
View file @
77f229f2
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Analytics
::
InstanceStatistics
::
CounterJobWorker
do
let_it_be
(
:user_1
)
{
create
(
:user
)
}
let_it_be
(
:user_2
)
{
create
(
:user
)
}
let
(
:users_measurement_identifier
)
{
::
Analytics
::
UsageTrends
::
Measurement
.
identifiers
.
fetch
(
:users
)
}
let
(
:recorded_at
)
{
Time
.
zone
.
now
}
let
(
:job_args
)
{
[
users_measurement_identifier
,
user_1
.
id
,
user_2
.
id
,
recorded_at
]
}
before
do
allow
(
ActiveRecord
::
Base
.
connection
).
to
receive
(
:transaction_open?
).
and_return
(
false
)
end
include_examples
'an idempotent worker'
do
it
'counts a scope and stores the result'
do
subject
measurement
=
Analytics
::
UsageTrends
::
Measurement
.
users
.
first
expect
(
measurement
.
recorded_at
).
to
be_like_time
(
recorded_at
)
expect
(
measurement
.
identifier
).
to
eq
(
'users'
)
expect
(
measurement
.
count
).
to
eq
(
2
)
end
end
context
'when no records are in the database'
do
let
(
:users_measurement_identifier
)
{
::
Analytics
::
UsageTrends
::
Measurement
.
identifiers
.
fetch
(
:groups
)
}
subject
{
described_class
.
new
.
perform
(
users_measurement_identifier
,
nil
,
nil
,
recorded_at
)
}
it
'sets 0 as the count'
do
subject
measurement
=
Analytics
::
UsageTrends
::
Measurement
.
groups
.
first
expect
(
measurement
.
recorded_at
).
to
be_like_time
(
recorded_at
)
expect
(
measurement
.
identifier
).
to
eq
(
'groups'
)
expect
(
measurement
.
count
).
to
eq
(
0
)
end
end
it
'does not raise error when inserting duplicated measurement'
do
subject
expect
{
subject
}.
not_to
raise_error
end
it
'does not insert anything when BatchCount returns error'
do
allow
(
Gitlab
::
Database
::
BatchCount
).
to
receive
(
:batch_count
).
and_return
(
Gitlab
::
Database
::
BatchCounter
::
FALLBACK
)
expect
{
subject
}.
not_to
change
{
Analytics
::
UsageTrends
::
Measurement
.
count
}
end
context
'when pipelines_succeeded identifier is passed'
do
let_it_be
(
:pipeline
)
{
create
(
:ci_pipeline
,
:success
)
}
let
(
:successful_pipelines_measurement_identifier
)
{
::
Analytics
::
UsageTrends
::
Measurement
.
identifiers
.
fetch
(
:pipelines_succeeded
)
}
let
(
:job_args
)
{
[
successful_pipelines_measurement_identifier
,
pipeline
.
id
,
pipeline
.
id
,
recorded_at
]
}
it
'counts successful pipelines'
do
subject
measurement
=
Analytics
::
UsageTrends
::
Measurement
.
pipelines_succeeded
.
first
expect
(
measurement
.
recorded_at
).
to
be_like_time
(
recorded_at
)
expect
(
measurement
.
identifier
).
to
eq
(
'pipelines_succeeded'
)
expect
(
measurement
.
count
).
to
eq
(
1
)
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