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
563d3d00
Commit
563d3d00
authored
Sep 03, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
df54952a
594f56e1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2 additions
and
42 deletions
+2
-42
lib/gitlab/correlation_id.rb
lib/gitlab/correlation_id.rb
+0
-40
lib/gitlab/tracing.rb
lib/gitlab/tracing.rb
+1
-1
spec/lib/gitlab/tracing_spec.rb
spec/lib/gitlab/tracing_spec.rb
+1
-1
No files found.
lib/gitlab/correlation_id.rb
deleted
100644 → 0
View file @
df54952a
# frozen_string_literal: true
module
Gitlab
module
CorrelationId
LOG_KEY
=
'correlation_id'
.
freeze
class
<<
self
def
use_id
(
correlation_id
,
&
blk
)
# always generate a id if null is passed
correlation_id
||=
new_id
ids
.
push
(
correlation_id
||
new_id
)
begin
yield
(
current_id
)
ensure
ids
.
pop
end
end
def
current_id
ids
.
last
end
def
current_or_new_id
current_id
||
new_id
end
private
def
ids
Thread
.
current
[
:correlation_id
]
||=
[]
end
def
new_id
SecureRandom
.
uuid
end
end
end
end
lib/gitlab/tracing.rb
View file @
563d3d00
...
...
@@ -30,7 +30,7 @@ module Gitlab
# Avoid using `format` since it can throw TypeErrors
# which we want to avoid on unsanitised env var input
tracing_url_template
.
to_s
.
gsub
(
/\{\{\s*correlation_id\s*\}\}/
,
Gitlab
::
CorrelationId
.
current_id
.
to_s
)
.
gsub
(
/\{\{\s*correlation_id\s*\}\}/
,
Labkit
::
Correlation
::
CorrelationId
.
current_id
.
to_s
)
.
gsub
(
/\{\{\s*service\s*\}\}/
,
Gitlab
.
process_name
)
end
end
...
...
spec/lib/gitlab/tracing_spec.rb
View file @
563d3d00
...
...
@@ -59,7 +59,7 @@ describe Gitlab::Tracing do
it
'returns the correct state for .tracing_url'
do
expect
(
described_class
).
to
receive
(
:tracing_url_enabled?
).
and_return
(
tracing_url_enabled?
)
allow
(
described_class
).
to
receive
(
:tracing_url_template
).
and_return
(
tracing_url_template
)
allow
(
Gitlab
::
CorrelationId
).
to
receive
(
:current_id
).
and_return
(
correlation_id
)
allow
(
Labkit
::
Correlation
::
CorrelationId
).
to
receive
(
:current_id
).
and_return
(
correlation_id
)
allow
(
Gitlab
).
to
receive
(
:process_name
).
and_return
(
process_name
)
expect
(
described_class
.
tracing_url
).
to
eq
(
tracing_url
)
...
...
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