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
1ba3c747
Commit
1ba3c747
authored
Oct 06, 2017
by
Andrew Newdigate
Committed by
Rémy Coutable
Oct 06, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Gitaly feature flag metadata
parent
c7622606
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
2 deletions
+24
-2
gitaly_feature_flag_metadata.yml
changelogs/unreleased/gitaly_feature_flag_metadata.yml
+5
-0
gitaly_client.rb
lib/gitlab/gitaly_client.rb
+19
-2
No files found.
changelogs/unreleased/gitaly_feature_flag_metadata.yml
0 → 100644
View file @
1ba3c747
---
title
:
Add client and call site metadata to Gitaly calls for better traceability
merge_request
:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/14332
author
:
type
:
added
lib/gitlab/gitaly_client.rb
View file @
1ba3c747
...
...
@@ -28,6 +28,7 @@ module Gitlab
SERVER_VERSION_FILE
=
'GITALY_SERVER_VERSION'
.
freeze
MAXIMUM_GITALY_CALLS
=
30
CLIENT_NAME
=
(
Sidekiq
.
server?
?
'gitlab-sidekiq'
:
'gitlab-web'
).
freeze
MUTEX
=
Mutex
.
new
private_constant
:MUTEX
...
...
@@ -79,7 +80,16 @@ module Gitlab
def
self
.
request_metadata
(
storage
)
encoded_token
=
Base64
.
strict_encode64
(
token
(
storage
).
to_s
)
{
metadata:
{
'authorization'
=>
"Bearer
#{
encoded_token
}
"
}
}
metadata
=
{
'authorization'
=>
"Bearer
#{
encoded_token
}
"
,
'client_name'
=>
CLIENT_NAME
}
feature_stack
=
Thread
.
current
[
:gitaly_feature_stack
]
feature
=
feature_stack
&&
feature_stack
[
0
]
metadata
[
'call_site'
]
=
feature
.
to_s
if
feature
{
metadata:
metadata
}
end
def
self
.
token
(
storage
)
...
...
@@ -137,7 +147,14 @@ module Gitlab
Gitlab
::
Metrics
.
measure
(
metric_name
)
do
# Some migrate calls wrap other migrate calls
allow_n_plus_1_calls
do
yield
is_enabled
feature_stack
=
Thread
.
current
[
:gitaly_feature_stack
]
||=
[]
feature_stack
.
unshift
(
feature
)
begin
yield
is_enabled
ensure
feature_stack
.
shift
Thread
.
current
[
:gitaly_feature_stack
]
=
nil
if
feature_stack
.
empty?
end
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