Documentation
      ¶
    
    
  
    
  
    Index ¶
- Constants
 - func AppendHeaders(parent context.Context, headers []string) context.Context
 - func LogRequests(ctx context.Context, method string, req, reply interface{}, ...) error
 - func LogStream(ctx context.Context, sd *grpc.StreamDesc, conn *grpc.ClientConn, method string, ...) (grpc.ClientStream, error)
 - func WithPrefix(value string) string
 
Constants ¶
      View Source
      
  const CustomErrorMetadataKey = "Custom-Error"
    CustomErrorMetadataKey is the name of the metadata key storing additional error information. Metadata value is expected to be a byte-encoded JSON object.
      View Source
      
  const HttpCodeMetadataKey = "X-Http-Code"
    HttpCodeMetadataKey is the key to use when setting custom HTTP status codes in gRPC metadata.
      View Source
      
  const MetadataPrefix = "Grpc-Metadata"
    MetadataPrefix is the prefix for grpc headers on metadata
Variables ¶
This section is empty.
Functions ¶
func AppendHeaders ¶
AppendHeaders parses the provided GRPC headers and attaches them to the provided context.
func LogRequests ¶
func LogRequests( ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption, ) error
LogRequests logs the gRPC backend as well as request duration when the log level is set to debug or higher.
func LogStream ¶
func LogStream( ctx context.Context, sd *grpc.StreamDesc, conn *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption, ) (grpc.ClientStream, error)
LogStream prints the method at DEBUG level at the start of the stream.
func WithPrefix ¶
WithPrefix creates a new string with grpc metadata prefix
Types ¶
This section is empty.
 Click to show internal directories. 
   Click to hide internal directories.