rpctracing

package
v0.0.0-...-cd54735 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2024 License: MIT Imports: 7 Imported by: 6

Documentation

Overview

Package rpctracing implements tracing for rpc.

Package rpctracing implements tracing for rpc.

Package rpctracing implements tracing for rpc.

Index

Constants

View Source
const (
	// TraceID is the key we use to store trace id value into context.
	TraceID = "trace-id"
	// ParentID is the key we use to store parent's span id value into context.
	ParentID = "parent-id"
	// Sampled is the key we use to store sampled flag into context.
	Sampled = "sampled"
)

Variables

This section is empty.

Functions

func IsExcluded

func IsExcluded(span *monkit.Span) bool

IsExcluded check if span shouldn't be reported to remote location. Deprecated: use tracing.IsExcluded.

func WithoutDistributedTracing

func WithoutDistributedTracing(ctx context.Context) context.Context

WithoutDistributedTracing disables distributed tracing for the current span. Deprecated: use tracing.WithoutDistributedTracing.

Types

type ExtractorFunc

type ExtractorFunc func(metadata map[string]string) (trace *monkit.Trace, parentID int64)

ExtractorFunc extracts from some metadata the trace information.

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler implements drpc handler interface and takes in a callback function to extract the trace information from some metadata.

func NewHandler

func NewHandler(handler drpc.Handler, cb ExtractorFunc) *Handler

NewHandler returns a new instance of Handler. If the callback is nil, a default one is used.

func (*Handler) HandleRPC

func (handler *Handler) HandleRPC(stream drpc.Stream, rpc string) (err error)

HandleRPC adds tracing metadata onto server stream.

type TracingWrapper

type TracingWrapper struct {
	rpcpool.Conn
}

TracingWrapper wraps a drpc.Conn with tracing information.

func NewTracingWrapper

func NewTracingWrapper(conn rpcpool.Conn) *TracingWrapper

NewTracingWrapper creates a new instance of the wrapper.

func (*TracingWrapper) Invoke

func (c *TracingWrapper) Invoke(ctx context.Context, rpc string, enc drpc.Encoding, in drpc.Message, out drpc.Message) (err error)

Invoke implements drpc.Conn's Invoke method with tracing information injected into the context.

func (*TracingWrapper) NewStream

func (c *TracingWrapper) NewStream(ctx context.Context, rpc string, enc drpc.Encoding) (_ drpc.Stream, err error)

NewStream implements drpc.Conn's NewStream method with tracing information injected into the context.

Jump to

Keyboard shortcuts

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