gjf

package module
v0.0.0-...-d403085 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

README

go-jeager-grpc

使用
import github.com/GuoJiafeng/go-jeager-grpc
客户端
// 初始化
tracer, _, err := gtrace.ConfigTracerDefault("trace-core.trace-mock", "http://****.wyun.baidu.com:****/api/traces")

// 把tracer对象作为option放上去
grpc.Dial(recallControllerAddr, grpc.WithInsecure(), grpc.WithBlock(),gtrace.ClientOption(tracer))

服务端
// 初始化
tracer, _, err := gtrace.NewJaegerTracer("trace-common.trace-mock", "http://****.weiyun.baidu.com:****/api/traces")
// 把tracer对象作为option放上去
s := grpc.NewServer(gtrace.ServerOption(tracer))	

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientInterceptor

func ClientInterceptor(tracer opentracing.Tracer) grpc.UnaryClientInterceptor

ClientInterceptor grpc client wrapper

func ClientOption

func ClientOption(tracer opentracing.Tracer) grpc.DialOption

func ConfigTracerAgent

func ConfigTracerAgent(serviceName string, jaegerAgentHostPort string) (tracer opentracing.Tracer, closer io.Closer, err error)

配置trace serviceName,endPoint 此处使用LocalAgentHostPort的方式进行传输

func ConfigTracerAgentWithSamplingRate

func ConfigTracerAgentWithSamplingRate(serviceName string, jaegerAgentHostPort string, samplingrate float64) (tracer opentracing.Tracer, closer io.Closer, err error)

func ConfigTracerDefault

func ConfigTracerDefault(serviceName string, endpoint string) (tracer opentracing.Tracer, closer io.Closer, err error)

配置trace serviceName,endPoint 默认使用endPoint的方式传输

func ConfigTracerWithSamplingRate

func ConfigTracerWithSamplingRate(serviceName string, endpoint string, samplingrate float64) (tracer opentracing.Tracer, closer io.Closer, err error)

func ServerInterceptor

func ServerInterceptor(tracer opentracing.Tracer) grpc.UnaryServerInterceptor

ServerInterceptor

func ServerOption

func ServerOption(tracer opentracing.Tracer) grpc.ServerOption

ServerOption grpc server option

func Test_Tracing

func Test_Tracing()

Types

type MDReaderWriter

type MDReaderWriter struct {
	metadata.MD
}

MDReaderWriter

func (MDReaderWriter) ForeachKey

func (c MDReaderWriter) ForeachKey(handler func(key, val string) error) error

ForeachKey implements ForeachKey of opentracing.TextMapReader

func (MDReaderWriter) Set

func (c MDReaderWriter) Set(key, val string)

Set implements Set() of opentracing.TextMapWriter

Jump to

Keyboard shortcuts

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