grpc

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildGrpcClientInstrumenter

func BuildGrpcClientInstrumenter() instrumenter.Instrumenter[grpcRequest, grpcResponse]

func BuildGrpcServerInstrumenter

func BuildGrpcServerInstrumenter() instrumenter.Instrumenter[grpcRequest, grpcResponse]

func NewClientHandler

func NewClientHandler(opts ...Option) stats.Handler

func NewClientNewHandler

func NewClientNewHandler(opts ...Option) stats.Handler

func NewServerHandler

func NewServerHandler(opts ...Option) stats.Handler

Types

type Event

type Event int

Event type that can be recorded, see WithMessageEvents.

const (
	ReceivedEvents Event = iota
	SentEvents
)

Different types of events that can be recorded, see WithMessageEvents.

type Filter

type Filter func(*InterceptorInfo) bool

type InterceptorInfo

type InterceptorInfo struct {
	// Method is method name registered to UnaryClient and StreamClient
	Method string
	// UnaryServerInfo is the metadata for UnaryServer
	UnaryServerInfo *grpc.UnaryServerInfo
	// StreamServerInfo if the metadata for StreamServer
	StreamServerInfo *grpc.StreamServerInfo
	// Type is the type for interceptor
	Type InterceptorType
}

InterceptorInfo is the union of some arguments to four types of gRPC interceptors.

type InterceptorType

type InterceptorType uint8

InterceptorType is the flag to define which gRPC interceptor the InterceptorInfo object is.

const (
	// UndefinedInterceptor is the type for the interceptor information that is not
	// well initialized or categorized to other types.
	UndefinedInterceptor InterceptorType = iota
	// UnaryClient is the type for grpc.UnaryClient interceptor.
	UnaryClient
	// StreamClient is the type for grpc.StreamClient interceptor.
	StreamClient
	// UnaryServer is the type for grpc.UnaryServer interceptor.
	UnaryServer
	// StreamServer is the type for grpc.StreamServer interceptor.
	StreamServer
)

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option applies an option value for a grpcOtelConfig.

func WithInterceptorFilter deprecated

func WithInterceptorFilter(f Filter) Option

WithInterceptorFilter returns an Option to use the request filter.

Deprecated: Use stats handlers instead.

func WithMessageEvents

func WithMessageEvents(events ...Event) Option

WithMessageEvents configures the Handler to record the specified events (span.AddEvent) on spans. By default only summary attributes are added at the end of the request.

Valid events are:

  • ReceivedEvents: Record the number of bytes read after every gRPC read operation.
  • SentEvents: Record the number of bytes written after every gRPC write operation.

func WithPropagators

func WithPropagators(p propagation.TextMapPropagator) Option

WithPropagators returns an Option to use the Propagators when extracting and injecting trace context from requests.

func WithSpanOptions

func WithSpanOptions(opts ...trace.SpanStartOption) Option

WithSpanOptions configures an additional set of trace.SpanOptions, which are applied to each new span.

func WithTracerProvider

func WithTracerProvider(tp trace.TracerProvider) Option

WithTracerProvider returns an Option to use the TracerProvider when creating a Tracer.

Jump to

Keyboard shortcuts

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