Package hnygrpc provides wrappers and other utilities for autoinstrumenting gRPC services.


The Honeycomb beeline takes advantage of gRPC interceptors to instrument RPCs. The wrapped interceptor can take a `config.GRPCIncomingConfig` object which can optionally provide a custom trace parser hook, allowing for easy interoperability between W3C, B3, Honeycomb and other trace header formats.

serverOpts := []grpc.ServerOption{
server := grpc.NewServer(serverOpts...)

Requests received by the server will now generate Honeycomb events, with metadata related to the request included as fields.

Please note that only unary RPCs are supported at this time. Support for streaming RPCs may be added later.



This section is empty.


This section is empty.


func UnaryClientInterceptor

func UnaryClientInterceptor() grpc.UnaryClientInterceptor

UnaryClientInterceptor is identical to UnaryClientInterceptorWithConfig called with an empty config.GRPCOutgoingConfig.

func UnaryClientInterceptorWithConfig

func UnaryClientInterceptorWithConfig(cfg config.GRPCOutgoingConfig) grpc.UnaryClientInterceptor

UnaryClientInterceptorWithConfig will create a Honeycomb span per invocation of the returned interceptor. It will also serialize the trace propagation context into the gRPC metadata so it can be deserialized by the server. If passed a config.GRPCOutgoingConfig with a GRPCTracePropagationHook, the hook will be called when populating the gRPC metadata, allowing it to specify how trace context information should be included in the metadata (e.g. if the remote server expects it to come in a specific format).

func UnaryServerInterceptor

func UnaryServerInterceptor() grpc.UnaryServerInterceptor

UnaryServerInterceptor is identical to UnaryServerInterceptorWithConfig called with an empty config.GRPCIncomingConfig.

func UnaryServerInterceptorWithConfig

func UnaryServerInterceptorWithConfig(cfg config.GRPCIncomingConfig) grpc.UnaryServerInterceptor

UnaryServerInterceptorWithConfig will create a Honeycomb event per invocation of the returned interceptor. If passed a config.GRPCIncomingConfig with a GRPCParserHook, the hook will be called when creating the event, allowing it to specify how trace context information should be included in the span (e.g. it may have come from a remote parent in a specific format).

Events created from GRPC interceptors will contain information from the gRPC metadata, if it exists, as well as information about the handler used and method being called.


This section is empty.

Source Files