2020-07-26 17:09:05 +08:00
|
|
|
package trace
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2020-08-08 16:40:10 +08:00
|
|
|
"github.com/tal-tech/go-zero/core/trace/tracespec"
|
2020-07-26 17:09:05 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
var emptyNoopSpan = noopSpan{}
|
|
|
|
|
|
|
|
type noopSpan struct{}
|
|
|
|
|
|
|
|
func (s noopSpan) Finish() {
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s noopSpan) Follow(ctx context.Context, serviceName, operationName string) (context.Context, tracespec.Trace) {
|
|
|
|
return ctx, emptyNoopSpan
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s noopSpan) Fork(ctx context.Context, serviceName, operationName string) (context.Context, tracespec.Trace) {
|
|
|
|
return ctx, emptyNoopSpan
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s noopSpan) SpanId() string {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s noopSpan) TraceId() string {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s noopSpan) Visit(fn func(key, val string) bool) {
|
|
|
|
}
|