package grpc

import "github.com/openzipkin/zipkin-go/middleware/grpc"

Package grpc contains several gRPC handlers which can be used for instrumenting calls with Zipkin.

Index

Functions

func NewClientHandler

func NewClientHandler(tracer *zipkin.Tracer, options ...ClientOption) stats.Handler

NewClientHandler returns a stats.Handler which can be used with grpc.WithStatsHandler to add tracing to a gRPC client. The gRPC method name is used as the span name and by default the only tags are the gRPC status code if the call fails.

func NewServerHandler

func NewServerHandler(tracer *zipkin.Tracer, options ...ServerOption) stats.Handler

NewServerHandler returns a stats.Handler which can be used with grpc.WithStatsHandler to add tracing to a gRPC server. The gRPC method name is used as the span name and by default the only tags are the gRPC status code if the call fails. Use ServerTags to add additional tags that should be applied to all spans.

Types

type ClientOption

type ClientOption func(*clientHandler)

A ClientOption can be passed to NewClientHandler to customize the returned handler.

func WithRemoteServiceName

func WithRemoteServiceName(name string) ClientOption

WithRemoteServiceName will set the value for the remote endpoint's service name on all spans.

type RPCHandler

type RPCHandler func(span zipkin.Span, rpcStats stats.RPCStats)

A RPCHandler can be registered using WithClientRPCHandler or WithServerRPCHandler to intercept calls to HandleRPC of a handler for additional span customization.

type ServerOption

type ServerOption func(*serverHandler)

A ServerOption can be passed to NewServerHandler to customize the returned handler.

func EnableBaggage

func EnableBaggage(b middleware.BaggageHandler) ServerOption

EnableBaggage can be passed to NewServerHandler to enable propagation of registered fields through the SpanContext object.

func ServerTags

func ServerTags(tags map[string]string) ServerOption

ServerTags adds default Tags to inject into server spans.

Source Files

client.go doc.go server.go shared.go

Version
v0.4.3 (latest)
Published
Apr 29, 2024
Platform
linux/amd64
Imports
11 packages
Last checked
1 week ago

Tools for package owners.