Documentation
¶
Overview ¶
Package grpc provides gRPC server and client instrumentation using OpenTelemetry.
Server instrumentation using stats handler:
server := grpc.NewServer(
grpc.StatsHandler(iongrpc.ServerHandler()),
)
Client instrumentation using stats handler:
conn, err := grpc.Dial(addr,
grpc.WithStatsHandler(iongrpc.ClientHandler()),
)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClientHandler ¶
ClientHandler returns a stats.Handler for gRPC client instrumentation. Use with grpc.WithStatsHandler() option when dialing.
Example:
conn, err := grpc.Dial(addr,
grpc.WithStatsHandler(iongrpc.ClientHandler()),
)
func ServerHandler ¶
ServerHandler returns a stats.Handler for gRPC server instrumentation. Use with grpc.StatsHandler() option when creating a gRPC server.
Example:
server := grpc.NewServer(
grpc.StatsHandler(iongrpc.ServerHandler()),
)
Types ¶
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option configures gRPC instrumentation.
func WithFilter ¶
func WithFilter(filter otelgrpc.InterceptorFilter) Option
WithFilter sets a filter function to exclude methods from tracing. Return false to skip tracing for the given request.
Example:
iongrpc.ServerHandler(iongrpc.WithFilter(func(info *otelgrpc.InterceptorInfo) bool {
return info.Method != "/grpc.health.v1.Health/Check"
}))
Click to show internal directories.
Click to hide internal directories.