hnygrpc

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Overview

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

Usage

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{
    grpc.UnaryInterceptor(hnygrpc.UnaryServerInterceptorWithConfig(cfg)),
}
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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UnaryClientInterceptor added in v1.1.0

func UnaryClientInterceptor() grpc.UnaryClientInterceptor

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

func UnaryClientInterceptorWithConfig added in v1.1.0

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 added in v1.1.0

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.

Types

This section is empty.

Jump to

Keyboard shortcuts

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