tracing

package
v2.0.0-rc.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RPCMessageTypeSent     = "SENT"
	RPCMessageTypeReceived = "RECEIVED"
)

Variables

This section is empty.

Functions

func StreamClientInterceptor

func StreamClientInterceptor(tracer Tracer) grpc.StreamClientInterceptor

StreamClientInterceptor returns a new streaming client interceptor that optionally traces the execution of external gRPC calls. Tracer will use tags (from tags package) available in current context as fields.

func StreamServerInterceptor

func StreamServerInterceptor(tracer Tracer) grpc.StreamServerInterceptor

StreamServerInterceptor returns a new stream server interceptors that optionally traces endpoint handling. Tracer will use tags (from tags package) available in current context as fields.

func UnaryClientInterceptor

func UnaryClientInterceptor(tracer Tracer) grpc.UnaryClientInterceptor

UnaryClientInterceptor returns a new unary client interceptor that optionally traces the execution of external gRPC calls. Tracer will use tags (from tags package) available in current context as fields.

func UnaryServerInterceptor

func UnaryServerInterceptor(tracer Tracer) grpc.UnaryServerInterceptor

UnaryServerInterceptor returns a new unary server interceptors that optionally traces endpoint handling. Tracer will use tags (from tags package) available in current context as fields.

Types

type Span

type Span interface {
	// End completes the span. No updates are allowed to span after it
	// ends. The only exception is setting status of the span.
	End()

	// SetStatus sets the status of the span in the form of a code
	// and a message. SetStatus overrides the value of previous
	// calls to SetStatus on the Span.
	//
	// The default span status is OK, so it is not necessary to
	// explicitly set an OK status on successful Spans unless it
	// is to add an OK message or to override a previous status on the Span.
	SetStatus(code codes.Code, msg string)

	// AddEvent adds an event to the span with key/value pairs as attributes.
	// Middleware will call it while receiving or sending messages.
	AddEvent(name string, keyvals ...interface{})

	// SetAttributes sets key/value pairs as attributes. If a key
	// already exists for an attribute of the Span it should be overwritten with
	// the value.
	SetAttributes(keyvals ...interface{})
}

type SpanKind

type SpanKind string
const (
	SpanKindServer SpanKind = "server"
	SpanKindClient SpanKind = "client"
)

type Tracer

type Tracer interface {
	Start(ctx context.Context, spanName string, kind SpanKind) (context.Context, Span)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL