Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mybee
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
mybee
Commits
3a61f8d4
Unverified
Commit
3a61f8d4
authored
Jul 12, 2021
by
Ivan Vandot
Committed by
GitHub
Jul 12, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: rename log field traceid to traceID (#2324)
parent
42307cab
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
doc.go
pkg/tracing/doc.go
+2
-2
tracing.go
pkg/tracing/tracing.go
+3
-3
No files found.
pkg/tracing/doc.go
View file @
3a61f8d4
...
...
@@ -34,7 +34,7 @@ Once the operation is finished, the open span should be finished:
span.Finish()
The tracing package also provides a function for creating a logger which will
inject a "trace
id
" field entry to the log line, which helps in finding out which
inject a "trace
ID
" field entry to the log line, which helps in finding out which
log lines belong to a specific trace.
To create a logger with trace just wrap an existing logger:
...
...
@@ -46,6 +46,6 @@ To create a logger with trace just wrap an existing logger:
Which will result in following log line (if the context contains tracing
information):
time="2015-09-07T08:48:33Z" level=info msg="some message" trace
id
=ed65818cc1d30c
time="2015-09-07T08:48:33Z" level=info msg="some message" trace
ID
=ed65818cc1d30c
*/
package
tracing
pkg/tracing/tracing.go
View file @
3a61f8d4
...
...
@@ -34,7 +34,7 @@ var (
type
contextKey
struct
{}
// LogField is the key in log message field that holds tracing id value.
const
LogField
=
"trace
id
"
const
LogField
=
"trace
ID
"
const
(
// TraceContextHeaderName is the http header name used to propagate tracing context.
...
...
@@ -91,7 +91,7 @@ func NewTracer(o *Options) (*Tracer, io.Closer, error) {
// StartSpanFromContext starts a new tracing span that is either a root one or a
// child of existing one from the provided Context. If logger is provided, a new
// log Entry will be returned with "trace
id
" log field.
// log Entry will be returned with "trace
ID
" log field.
func
(
t
*
Tracer
)
StartSpanFromContext
(
ctx
context
.
Context
,
operationName
string
,
l
logging
.
Logger
,
opts
...
opentracing
.
StartSpanOption
)
(
opentracing
.
Span
,
*
logrus
.
Entry
,
context
.
Context
)
{
if
t
==
nil
{
t
=
noopTracer
...
...
@@ -239,7 +239,7 @@ func FromContext(ctx context.Context) opentracing.SpanContext {
return
c
}
// NewLoggerWithTraceID creates a new log Entry with "trace
id
" field added if it
// NewLoggerWithTraceID creates a new log Entry with "trace
ID
" field added if it
// exists in tracing span context stored from go context.
func
NewLoggerWithTraceID
(
ctx
context
.
Context
,
l
logging
.
Logger
)
*
logrus
.
Entry
{
return
loggerWithTraceID
(
FromContext
(
ctx
),
l
)
...
...
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