Documentation ¶
Index ¶
- Constants
- Variables
- func Now() time.Duration
- func RandId() string
- func Randn(n int) string
- func Since(d time.Duration) time.Duration
- func StartClientSpan(ctx context.Context, serviceName, operationName string) (context.Context, tracespec.Trace)
- func StartServerSpan(ctx context.Context, carrier Carrier, serviceName, operationName string) (context.Context, tracespec.Trace)
- func TakeWithPriority(fns ...func() string) string
- func Time() time.Time
- type Carrier
- type Propagator
- type Span
- func (s *Span) Finish()
- func (s *Span) Follow(ctx context.Context, serviceName, operationName string) (context.Context, tracespec.Trace)
- func (s *Span) Fork(ctx context.Context, serviceName, operationName string) (context.Context, tracespec.Trace)
- func (s *Span) SpanId() string
- func (s *Span) TraceId() string
- func (s *Span) Visit(fn func(key, val string) bool)
Constants ¶
View Source
const ( // HttpFormat means http carrier format. HttpFormat = iota // GrpcFormat means grpc carrier format. GrpcFormat )
Variables ¶
View Source
var ErrInvalidCarrier = errors.New("invalid carrier")
ErrInvalidCarrier indicates an error that the carrier is invalid.
Functions ¶
func Now ¶
Now returns a relative time duration since initTime, which is not important. The caller only needs to care about the relative value.
func StartClientSpan ¶
func StartClientSpan(ctx context.Context, serviceName, operationName string) (context.Context, tracespec.Trace)
StartClientSpan starts the client span with given context, service and operation names.
func StartServerSpan ¶
func StartServerSpan(ctx context.Context, carrier Carrier, serviceName, operationName string) ( context.Context, tracespec.Trace)
StartServerSpan starts the server span with given context, carrier, service and operation names.
func TakeWithPriority ¶
TakeWithPriority returns the first not empty result from fns.
Types ¶
type Carrier ¶
Carrier interface wraps the Get and Set method.
type Propagator ¶
type Propagator interface { Extract(carrier interface{}) (Carrier, error) Inject(carrier interface{}) (Carrier, error) }
Propagator interface wraps the Extract and Inject methods.
type Span ¶
type Span struct {
// contains filtered or unexported fields
}
A Span is a calling span that connects caller and callee.
func (*Span) Follow ¶
func (s *Span) Follow(ctx context.Context, serviceName, operationName string) (context.Context, tracespec.Trace)
Follow follows the tracing service and operation names in context.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.