gotracing

package module
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2022 License: Apache-2.0 Imports: 6 Imported by: 5

README

gotracing

Abstract the various tracing providers into a single interface, so you can pick the one you want

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MuxTagging

func MuxTagging(t Tracing) func(handler http.Handler) http.Handler

MuxTagging adds key/value tags to the context for a handler based upon the mux Vars

Types

type Config

type Config struct {
	ServiceName string
	Log         *zapctx.Logger
	Env         []string
}

type Constructor

type Constructor func(config Config) (Tracing, error)

type Noop

type Noop struct{}

func (Noop) AttachTag

func (n Noop) AttachTag(_ context.Context, _ string, _ interface{})

func (Noop) CreateRootMux

func (n Noop) CreateRootMux() (*mux.Router, http.Handler)

func (Noop) DynamicFields

func (n Noop) DynamicFields() []zapctx.DynamicFields

func (Noop) GrpcClientInterceptors added in v0.2.0

func (n Noop) GrpcClientInterceptors(_ string) ([]grpc.UnaryClientInterceptor, []grpc.StreamClientInterceptor)

func (Noop) GrpcServerInterceptors added in v0.2.0

func (n Noop) GrpcServerInterceptors(_ string) ([]grpc.UnaryServerInterceptor, []grpc.StreamServerInterceptor)

func (Noop) StartSpanFromContext

func (n Noop) StartSpanFromContext(ctx context.Context, _ SpanConfig, callback func(ctx context.Context) error) error

func (Noop) WrapRoundTrip

func (n Noop) WrapRoundTrip(rt http.RoundTripper) http.RoundTripper

type Registry

type Registry struct {
	Constructors map[string]Constructor
}

func (*Registry) New

func (r *Registry) New(name string, config Config) (Tracing, error)

type SpanConfig

type SpanConfig struct {
	OperationName string
}

type Tracing

type Tracing interface {
	WrapRoundTrip(rt http.RoundTripper) http.RoundTripper
	AttachTag(ctx context.Context, key string, value interface{})
	DynamicFields() []zapctx.DynamicFields
	CreateRootMux() (*mux.Router, http.Handler)
	GrpcServerInterceptors(serviceName string) ([]grpc.UnaryServerInterceptor, []grpc.StreamServerInterceptor)
	GrpcClientInterceptors(serviceName string) ([]grpc.UnaryClientInterceptor, []grpc.StreamClientInterceptor)
	StartSpanFromContext(ctx context.Context, cfg SpanConfig, callback func(ctx context.Context) error) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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