Documentation ¶
Index ¶
- func NewContext(ctx context.Context, span Spanner) context.Context
- func Register(t Tracer)
- type Attribute
- type Carrier
- type Logger
- type NoOpTracer
- func (nt *NoOpTracer) FromContext(ctx context.Context) Spanner
- func (nt *NoOpTracer) NewContext(parent context.Context, span Spanner) context.Context
- func (nt *NoOpTracer) StartSpan(ctx context.Context, operationName string, opts ...interface{}) (context.Context, Spanner)
- func (nt *NoOpTracer) StartSpanWithRemoteParent(ctx context.Context, operationName string, carrier Carrier, ...) (context.Context, Spanner)
- type SpanLogger
- type Spanner
- type Tracer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewContext ¶
NewContext returns a new context with the given Span attached.
Types ¶
type Attribute ¶
type Attribute struct { Key string Value interface{} }
Attribute is a key value pair for decorating spans
func BoolAttribute ¶
BoolAttribute returns a bool-valued attribute.
func Int64Attribute ¶
Int64Attribute returns an int64-valued attribute.
func StringAttribute ¶
StringAttribute returns a string-valued attribute.
type Logger ¶
type Logger interface { Info(msg string, attributes ...Attribute) Error(err error, attributes ...Attribute) Fatal(msg string, attributes ...Attribute) Debug(msg string, attributes ...Attribute) }
Logger is a generic interface for logging
type NoOpTracer ¶ added in v0.1.1
type NoOpTracer struct{}
NoOpTracer is a Tracer implementation that does nothing, thus no op
func (*NoOpTracer) FromContext ¶ added in v0.1.1
func (nt *NoOpTracer) FromContext(ctx context.Context) Spanner
FromContext returns a no op Spanner without regard to the input context
func (*NoOpTracer) NewContext ¶ added in v0.1.1
NewContext returns the parent context
func (*NoOpTracer) StartSpan ¶ added in v0.1.1
func (nt *NoOpTracer) StartSpan(ctx context.Context, operationName string, opts ...interface{}) (context.Context, Spanner)
StartSpan returns the input context and a no op Spanner
func (*NoOpTracer) StartSpanWithRemoteParent ¶ added in v0.1.1
func (nt *NoOpTracer) StartSpanWithRemoteParent(ctx context.Context, operationName string, carrier Carrier, opts ...interface{}) (context.Context, Spanner)
StartSpanWithRemoteParent returns the input context and a no op Spanner
type SpanLogger ¶
type SpanLogger struct {
Span Spanner
}
SpanLogger is a Logger implementation which logs to a tracing span
func (SpanLogger) Debug ¶
func (sl SpanLogger) Debug(msg string, attributes ...Attribute)
Debug logs a debug tag with message to a span
func (SpanLogger) Error ¶
func (sl SpanLogger) Error(err error, attributes ...Attribute)
Error logs an error tag with message to a span
func (SpanLogger) Fatal ¶
func (sl SpanLogger) Fatal(msg string, attributes ...Attribute)
Fatal logs an error tag with message to a span
func (SpanLogger) Info ¶
func (sl SpanLogger) Info(msg string, attributes ...Attribute)
Info logs an info tag with message to a span
type Spanner ¶
type Spanner interface { AddAttributes(attributes ...Attribute) End() Logger() Logger Inject(carrier Carrier) error InternalSpan() interface{} }
Spanner is an abstraction over OpenTracing and OpenCensus Spans
func FromContext ¶
FromContext returns the Span stored in a context, or nil if there isn't one.
type Tracer ¶
type Tracer interface { StartSpan(ctx context.Context, operationName string, opts ...interface{}) (context.Context, Spanner) StartSpanWithRemoteParent(ctx context.Context, operationName string, carrier Carrier, opts ...interface{}) (context.Context, Spanner) FromContext(ctx context.Context) Spanner NewContext(parent context.Context, span Spanner) context.Context }
Tracer is an abstraction over OpenTracing and OpenCensus trace implementations