BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
7fd3ce41
Commit
7fd3ce41
authored
Nov 08, 2017
by
micael.bergeron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "add metrics tagging to the sidekiq middleware"
This reverts commit
d5859bb9
. This reverts commit
2b7e03cf
. This reverts commit
7799a9bc
.
parent
0c3877a4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
27 deletions
+29
-27
update_merge_requests_worker.rb
app/workers/update_merge_requests_worker.rb
+0
-9
.yml
changelogs/unreleased/.yml
+5
-0
sidekiq_middleware.rb
lib/gitlab/metrics/sidekiq_middleware.rb
+0
-2
sidekiq_middleware_spec.rb
spec/lib/gitlab/metrics/sidekiq_middleware_spec.rb
+24
-16
No files found.
app/workers/update_merge_requests_worker.rb
View file @
7fd3ce41
...
...
@@ -2,10 +2,6 @@ class UpdateMergeRequestsWorker
include
Sidekiq
::
Worker
include
DedicatedSidekiqQueue
def
metrics_tags
@metrics_tags
||
{}
end
def
perform
(
project_id
,
user_id
,
oldrev
,
newrev
,
ref
)
project
=
Project
.
find_by
(
id:
project_id
)
return
unless
project
...
...
@@ -13,11 +9,6 @@ class UpdateMergeRequestsWorker
user
=
User
.
find_by
(
id:
user_id
)
return
unless
user
@metrics_tags
=
{
project_id:
project_id
,
user_id:
user_id
}
MergeRequests
::
RefreshService
.
new
(
project
,
user
).
execute
(
oldrev
,
newrev
,
ref
)
end
end
changelogs/unreleased/.yml
0 → 100644
View file @
7fd3ce41
---
title
:
Remove update merge request worker tagging.
merge_request
:
author
:
type
:
removed
lib/gitlab/metrics/sidekiq_middleware.rb
View file @
7fd3ce41
...
...
@@ -11,8 +11,6 @@ module Gitlab
# Old gitlad-shell messages don't provide enqueued_at/created_at attributes
trans
.
set
(
:sidekiq_queue_duration
,
Time
.
now
.
to_f
-
(
message
[
'enqueued_at'
]
||
message
[
'created_at'
]
||
0
))
trans
.
run
{
yield
}
worker
.
metrics_tags
.
each
{
|
tag
,
value
|
trans
.
add_tag
(
tag
,
value
)
}
if
worker
.
respond_to?
(
:metrics_tags
)
rescue
Exception
=>
error
# rubocop: disable Lint/RescueException
trans
.
add_event
(
:sidekiq_exception
)
...
...
spec/lib/gitlab/metrics/sidekiq_middleware_spec.rb
View file @
7fd3ce41
...
...
@@ -4,32 +4,40 @@ describe Gitlab::Metrics::SidekiqMiddleware do
let
(
:middleware
)
{
described_class
.
new
}
let
(
:message
)
{
{
'args'
=>
[
'test'
],
'enqueued_at'
=>
Time
.
new
(
2016
,
6
,
23
,
6
,
59
).
to_f
}
}
def
run
(
worker
,
message
)
expect
(
Gitlab
::
Metrics
::
BackgroundTransaction
).
to
receive
(
:new
)
.
with
(
worker
.
class
)
.
and_call_original
expect_any_instance_of
(
Gitlab
::
Metrics
::
Transaction
).
to
receive
(
:set
)
.
with
(
:sidekiq_queue_duration
,
instance_of
(
Float
))
describe
'#call'
do
it
'tracks the transaction'
do
worker
=
double
(
:worker
,
class:
double
(
:class
,
name:
'TestWorker'
))
expect_any_instance_of
(
Gitlab
::
Metrics
::
Transaction
).
to
receive
(
:finish
)
expect
(
Gitlab
::
Metrics
::
BackgroundTransaction
).
to
receive
(
:new
)
.
with
(
worker
.
class
)
.
and_call_original
middleware
.
call
(
worker
,
message
,
:test
)
{
nil
}
end
expect_any_instance_of
(
Gitlab
::
Metrics
::
Transaction
).
to
receive
(
:set
)
.
with
(
:sidekiq_queue_duration
,
instance_of
(
Float
))
describe
'#call'
do
let
(
:test_worker_class
)
{
double
(
:class
,
name:
'TestWorker'
)
}
let
(
:worker
)
{
double
(
:worker
,
class:
test_worker_class
)
}
expect_any_instance_of
(
Gitlab
::
Metrics
::
Transaction
).
to
receive
(
:finish
)
it
'tracks the transaction'
do
run
(
worker
,
message
)
middleware
.
call
(
worker
,
message
,
:test
)
{
nil
}
end
it
'tracks the transaction (for messages without `enqueued_at`)'
do
run
(
worker
,
{})
worker
=
double
(
:worker
,
class:
double
(
:class
,
name:
'TestWorker'
))
expect
(
Gitlab
::
Metrics
::
BackgroundTransaction
).
to
receive
(
:new
)
.
with
(
worker
.
class
)
.
and_call_original
expect_any_instance_of
(
Gitlab
::
Metrics
::
Transaction
).
to
receive
(
:set
)
.
with
(
:sidekiq_queue_duration
,
instance_of
(
Float
))
expect_any_instance_of
(
Gitlab
::
Metrics
::
Transaction
).
to
receive
(
:finish
)
middleware
.
call
(
worker
,
{},
:test
)
{
nil
}
end
it
'tracks any raised exceptions'
do
worker
=
double
(
:worker
,
class:
double
(
:class
,
name:
'TestWorker'
))
expect_any_instance_of
(
Gitlab
::
Metrics
::
Transaction
)
.
to
receive
(
:run
).
and_raise
(
RuntimeError
)
...
...
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