Update dependencies to add service fabric mesh via new azure-sdk-go
This commit is contained in:
35
vendor/github.com/vmware/vic/pkg/trace/operation.go
generated
vendored
35
vendor/github.com/vmware/vic/pkg/trace/operation.go
generated
vendored
@@ -129,6 +129,10 @@ func (o *Operation) ID() string {
|
||||
return o.id
|
||||
}
|
||||
|
||||
func (o *Operation) Auditf(format string, args ...interface{}) {
|
||||
o.Infof(format, args...)
|
||||
}
|
||||
|
||||
func (o *Operation) Infof(format string, args ...interface{}) {
|
||||
o.Info(fmt.Sprintf(format, args...))
|
||||
}
|
||||
@@ -213,13 +217,22 @@ func (o *Operation) Fatal(args ...interface{}) {
|
||||
}
|
||||
}
|
||||
|
||||
func (o *Operation) newChild(ctx context.Context, msg string) Operation {
|
||||
child := newOperation(ctx, o.id, 4, msg)
|
||||
func (o Operation) newChildCommon(ctx context.Context, opID string, msg string) Operation {
|
||||
child := newOperation(ctx, opID, 5, msg)
|
||||
child.t = append(child.t, o.t...)
|
||||
child.Logger = o.Logger
|
||||
return child
|
||||
}
|
||||
|
||||
func (o Operation) newChild(ctx context.Context, msg string) Operation {
|
||||
return o.newChildCommon(ctx, o.id, msg)
|
||||
}
|
||||
|
||||
func (o Operation) newChildWithChainedID(ctx context.Context, msg string) Operation {
|
||||
childOpID := fmt.Sprintf("%s.%d", o.id, atomic.AddUint64(&opCount, 1))
|
||||
return o.newChildCommon(ctx, childOpID, msg)
|
||||
}
|
||||
|
||||
func opID(opNum uint64) string {
|
||||
return fmt.Sprintf("%d.%d", opIDPrefix, opNum)
|
||||
}
|
||||
@@ -233,6 +246,24 @@ func NewOperation(ctx context.Context, format string, args ...interface{}) Opera
|
||||
return o
|
||||
}
|
||||
|
||||
// NewOperationFromID returns a an Operation with the incoming ID if valid
|
||||
// It creates a parent operation with the incoming ID and a child with
|
||||
// the parent operation ID as a prefix and a monotonically incremented
|
||||
// integer as the suffix
|
||||
func NewOperationFromID(ctx context.Context, ID *string, format string, args ...interface{}) Operation {
|
||||
var o Operation
|
||||
if ID == nil || *ID == "" {
|
||||
o = newOperation(ctx, opID(atomic.AddUint64(&opCount, 1)), 3, fmt.Sprintf(format, args...))
|
||||
} else {
|
||||
msg := fmt.Sprintf(format, args...)
|
||||
o = newOperation(ctx, *ID, 3, msg).newChildWithChainedID(ctx, msg)
|
||||
}
|
||||
|
||||
frame := o.t[0]
|
||||
o.Debugf("[NewOperationFromID] %s [%s:%d]", o.header(), frame.funcName, frame.lineNo)
|
||||
return o
|
||||
}
|
||||
|
||||
// NewOperationWithLoggerFrom will return a new operation with operationID added as a value to the
|
||||
// context and logging settings copied from the supplied operation.
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user