noop.go 633 B

123456789101112131415161718192021222324252627282930313233
  1. package trace
  2. import (
  3. "context"
  4. "github.com/tal-tech/go-zero/core/trace/tracespec"
  5. )
  6. var emptyNoopSpan = noopSpan{}
  7. type noopSpan struct{}
  8. func (s noopSpan) Finish() {
  9. }
  10. func (s noopSpan) Follow(ctx context.Context, serviceName, operationName string) (context.Context, tracespec.Trace) {
  11. return ctx, emptyNoopSpan
  12. }
  13. func (s noopSpan) Fork(ctx context.Context, serviceName, operationName string) (context.Context, tracespec.Trace) {
  14. return ctx, emptyNoopSpan
  15. }
  16. func (s noopSpan) SpanId() string {
  17. return ""
  18. }
  19. func (s noopSpan) TraceId() string {
  20. return ""
  21. }
  22. func (s noopSpan) Visit(fn func(key, val string) bool) {
  23. }