grpc_opentracing

package
v0.0.0-...-4d979c2 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

`grpc_opentracing` adds OpenTracing

OpenTracing Interceptors

These are both client-side and server-side interceptors for OpenTracing. They are a provider-agnostic, with backends such as Zipkin, or Google Stackdriver Trace.

For a service that sends out requests and receives requests, you *need* to use both, otherwise downstream requests will not have the appropriate requests propagated.

All server-side spans are tagged with grpc_ctxtags information.

For more information see: http://opentracing.io/documentation/ https://github.com/opentracing/specification/blob/master/semantic_conventions.md

Index

Constants

View Source
const (
	TagTraceId = "trace.traceid"
	TagSpanId  = "trace.spanid"
	TagSampled = "trace.sampled"
)
View Source
const (
	// OscarTraceContextHeaderName should be used within Oscar GRPC
	OscarTraceContextHeaderName = "oscar-trace-id"
)

Variables

This section is empty.

Functions

func ClientAddContextTags

func ClientAddContextTags(ctx context.Context, tags opentracing.Tags) context.Context

ClientAddContextTags returns a context with specified opentracing tags, which are used by UnaryClientInterceptor/StreamClientInterceptor when creating a new span.

func StreamClientInterceptor

func StreamClientInterceptor(opts ...Option) grpc.StreamClientInterceptor

StreamClientInterceptor returns a new streaming client interceptor for OpenTracing.

func StreamServerInterceptor

func StreamServerInterceptor(opts ...Option) grpc.StreamServerInterceptor

StreamServerInterceptor returns a new streaming server interceptor for OpenTracing.

func UnaryClientInterceptor

func UnaryClientInterceptor(opts ...Option) grpc.UnaryClientInterceptor

UnaryClientInterceptor returns a new unary client interceptor for OpenTracing.

func UnaryServerInterceptor

func UnaryServerInterceptor(opts ...Option) grpc.UnaryServerInterceptor

UnaryServerInterceptor returns a new unary server interceptor for OpenTracing.

Types

type FilterFunc

type FilterFunc func(ctx context.Context, fullMethodName string) bool

FilterFunc allows users to provide a function that filters out certain methods from being traced.

If it returns false, the given request will not be traced.

type OpNameFunc

type OpNameFunc func(method string) string

OpNameFunc is a func that allows custom operation names instead of the gRPC method.

type Option

type Option func(*options)

func WithFilterFunc

func WithFilterFunc(f FilterFunc) Option

WithFilterFunc customizes the function used for deciding whether a given call is traced or not.

func WithOpName

func WithOpName(f OpNameFunc) Option

WithOpName customizes the trace Operation name

func WithTraceHeaderName

func WithTraceHeaderName(name string) Option

WithTraceHeaderName customizes the trace header name where trace metadata passed with requests. Default one is `uber-trace-id`

func WithTracer

func WithTracer(tracer opentracing.Tracer) Option

WithTracer sets a custom tracer to be used for this middleware, otherwise the opentracing.GlobalTracer is used.

func WithUnaryRequestHandlerFunc

func WithUnaryRequestHandlerFunc(f UnaryRequestHandlerFunc) Option

WithUnaryRequestHandlerFunc sets a custom handler for the request

type UnaryRequestHandlerFunc

type UnaryRequestHandlerFunc func(span opentracing.Span, req interface{})

UnaryRequestHandlerFunc is a custom request handler

Jump to

Keyboard shortcuts

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