remove unused trace_id field from log (#12878)

pull/12886/head
Jacob Marble 2019-03-25 13:03:11 -07:00 committed by GitHub
parent dcd65ee4ae
commit 6932d0323f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 9 deletions

View File

@ -9,9 +9,6 @@ import (
)
const (
// TraceIDKey is the logging context key used for identifying unique traces.
TraceIDKey = "trace_id"
// OperationNameKey is the logging context key used for identifying name of an operation.
OperationNameKey = "op_name"
@ -47,11 +44,6 @@ func nextID() string {
return gen.NextString()
}
// TraceID returns a field for tracking the trace identifier.
func TraceID(id string) zapcore.Field {
return zap.String(TraceIDKey, id)
}
// OperationName returns a field for tracking the name of an operation.
func OperationName(name string) zapcore.Field {
return zap.String(OperationNameKey, name)
@ -98,7 +90,7 @@ func Shard(id uint64) zapcore.Field {
// called when the operation concludes in order to log a corresponding message which
// includes an elapsed time and that the operation has ended.
func NewOperation(log *zap.Logger, msg, name string, fields ...zapcore.Field) (*zap.Logger, func()) {
f := []zapcore.Field{TraceID(nextID()), OperationName(name)}
f := []zapcore.Field{OperationName(name)}
if len(fields) > 0 {
f = append(f, fields...)
}