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
ba413053
Commit
ba413053
authored
Dec 16, 2020
by
Igor Wiedler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Propagate client identity to gitaly
parent
d2ea47cd
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
0 deletions
+12
-0
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+1
-0
changelogs/unreleased/gitaly-client-identity.yml
changelogs/unreleased/gitaly-client-identity.yml
+5
-0
lib/gitlab/application_context.rb
lib/gitlab/application_context.rb
+2
-0
lib/gitlab/gitaly_client.rb
lib/gitlab/gitaly_client.rb
+4
-0
No files found.
app/controllers/application_controller.rb
View file @
ba413053
...
...
@@ -468,6 +468,7 @@ class ApplicationController < ActionController::Base
project:
->
{
@project
if
@project
&
.
persisted?
},
namespace:
->
{
@group
if
@group
&
.
persisted?
},
caller_id:
caller_id
,
remote_ip:
request
.
ip
,
feature_category:
feature_category
)
do
yield
ensure
...
...
changelogs/unreleased/gitaly-client-identity.yml
0 → 100644
View file @
ba413053
---
title
:
Propagate client identity to gitaly
merge_request
:
50161
author
:
type
:
other
lib/gitlab/application_context.rb
View file @
ba413053
...
...
@@ -12,6 +12,7 @@ module Gitlab
Attribute
.
new
(
:namespace
,
Namespace
),
Attribute
.
new
(
:user
,
User
),
Attribute
.
new
(
:caller_id
,
String
),
Attribute
.
new
(
:remote_ip
,
String
),
Attribute
.
new
(
:related_class
,
String
),
Attribute
.
new
(
:feature_category
,
String
)
].
freeze
...
...
@@ -45,6 +46,7 @@ module Gitlab
hash
[
:project
]
=
->
{
project_path
}
if
set_values
.
include?
(
:project
)
hash
[
:root_namespace
]
=
->
{
root_namespace_path
}
if
include_namespace?
hash
[
:caller_id
]
=
caller_id
if
set_values
.
include?
(
:caller_id
)
hash
[
:remote_ip
]
=
remote_ip
if
set_values
.
include?
(
:remote_ip
)
hash
[
:related_class
]
=
related_class
if
set_values
.
include?
(
:related_class
)
hash
[
:feature_category
]
=
feature_category
if
set_values
.
include?
(
:feature_category
)
end
...
...
lib/gitlab/gitaly_client.rb
View file @
ba413053
...
...
@@ -215,12 +215,16 @@ module Gitlab
'client_name'
=>
CLIENT_NAME
}
context_data
=
Labkit
::
Context
.
current
&
.
to_h
feature_stack
=
Thread
.
current
[
:gitaly_feature_stack
]
feature
=
feature_stack
&&
feature_stack
[
0
]
metadata
[
'call_site'
]
=
feature
.
to_s
if
feature
metadata
[
'gitaly-servers'
]
=
address_metadata
(
remote_storage
)
if
remote_storage
metadata
[
'x-gitlab-correlation-id'
]
=
Labkit
::
Correlation
::
CorrelationId
.
current_id
if
Labkit
::
Correlation
::
CorrelationId
.
current_id
metadata
[
'gitaly-session-id'
]
=
session_id
metadata
[
'username'
]
=
context_data
[
'meta.user'
]
if
context_data
&
.
fetch
(
'meta.user'
,
nil
)
metadata
[
'remote_ip'
]
=
context_data
[
'meta.remote_ip'
]
if
context_data
&
.
fetch
(
'meta.remote_ip'
,
nil
)
metadata
.
merge!
(
Feature
::
Gitaly
.
server_feature_flags
)
deadline_info
=
request_deadline
(
timeout
)
...
...
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