Documentation ¶
Index ¶
- Constants
- Variables
- func Auth(path string) string
- func Base(path string) string
- func CreateHttpSpan(req *http.Request) (context.Context, opentracing.Span, map[string]string)
- func CreateRPCClientSpan(ctx context.Context, operationName string, info *RPCServiceDef) (context.Context, opentracing.Span, map[string]string)
- func CreateRPCServerSpan(ctx context.Context, operationName string) (context.Context, opentracing.Span, map[string]string)
- func Flow(path string) string
- func Order(path string) string
- func Product(path string) string
- func Report(path string) string
- func User(path string) string
- type ErrTracing
- type NilArg
- type RPCClient
- func NewAuthClient(ctx context.Context, serviceName string) *RPCClient
- func NewBaseClient(ctx context.Context, serviceName string) *RPCClient
- func NewFlowClient(ctx context.Context, serviceName string) *RPCClient
- func NewOrderClient(ctx context.Context, serviceName string) *RPCClient
- func NewProductClient(ctx context.Context, serviceName string) *RPCClient
- func NewRPCClient(ctx context.Context, serverAddr string, serviceName string) *RPCClient
- func NewReportClient(ctx context.Context, serviceName string) *RPCClient
- func NewUserClient(ctx context.Context, serviceName string) *RPCClient
- func (c *RPCClient) Broadcast(serviceMethod string, args interface{}, reply interface{}) error
- func (c *RPCClient) Call(serviceMethod string, args interface{}, reply interface{}) error
- func (c *RPCClient) Close() error
- func (c *RPCClient) Go(serviceMethod string, args interface{}, reply interface{}, ...) (*client.Call, error)
- func (c *RPCClient) SendFile(serviceMethod string, fileName string, rateInBytesPerSecond int64) error
- func (c *RPCClient) SendRaw(serviceMethod string, r *protocol.Message) (map[string]string, []byte, error)
- type RPCServer
- type RPCServiceDef
- type ServerFn
- type ServerPlugin
- type TracingWrapper
Constants ¶
View Source
const ( BasePrefix = "wph-micro-base:8081" UserPrefix = "wph-micro-user:8082" ProductPrefix = "wph-micro-product:8083" OrderPrefix = "wph-micro-order:8084" FlowPrefix = "wph-micro-flow:8085" ReportPrefix = "wph-micro-report:8086" AuthPrefix = "wph-micro-auth:8087" )
Variables ¶
View Source
var ( BaseRPC = RPCServiceDef{ServiceAddr: "wph-micro-base:10001", MicroServiceName: "wph-micro-base"} UserRPC = RPCServiceDef{ServiceAddr: "wph-micro-user:10002", MicroServiceName: "wph-micro-user"} ProductRPC = RPCServiceDef{ServiceAddr: "wph-micro-product:10003", MicroServiceName: "wph-micro-product"} OrderRPC = RPCServiceDef{ServiceAddr: "wph-micro-order:10004", MicroServiceName: "wph-micro-order"} FlowRPC = RPCServiceDef{ServiceAddr: "wph-micro-flow:10005", MicroServiceName: "wph-micro-flow"} ReportRPC = RPCServiceDef{ServiceAddr: "wph-micro-report:10006", MicroServiceName: "wph-micro-report"} AuthRPC = RPCServiceDef{ServiceAddr: "wph-micro-auth:10007", MicroServiceName: "wph-micro-auth"} )
Functions ¶
func CreateHttpSpan ¶
创建HTTP span
func CreateRPCClientSpan ¶
func CreateRPCClientSpan(ctx context.Context, operationName string, info *RPCServiceDef) (context.Context, opentracing.Span, map[string]string)
创建RPC客户端span
Types ¶
type ErrTracing ¶
type ErrTracing struct {
// contains filtered or unexported fields
}
预定义错误类型等
func (ErrTracing) Error ¶
func (e ErrTracing) Error() string
type RPCClient ¶
type RPCClient struct { client.XClient Ctx context.Context // contains filtered or unexported fields }
客户端
func NewRPCClient ¶
新建客户端实例
func (*RPCClient) Go ¶
func (c *RPCClient) Go(serviceMethod string, args interface{}, reply interface{}, done chan *client.Call) (*client.Call, error)
异步发送请求
type RPCServiceDef ¶
type ServerPlugin ¶
type ServerPlugin struct { }
type TracingWrapper ¶
type TracingWrapper struct {
Span opentracing.Span
}
func GetTracingWrapper ¶
func GetTracingWrapper(ctx context.Context) *TracingWrapper
func GetTracingWrapperWithName ¶
func GetTracingWrapperWithName(ctx context.Context, spanName string) *TracingWrapper
func (*TracingWrapper) Finish ¶
func (c *TracingWrapper) Finish()
func (*TracingWrapper) Log ¶
func (c *TracingWrapper) Log(msg string)
func (*TracingWrapper) LogError ¶
func (c *TracingWrapper) LogError(err error)
func (*TracingWrapper) LogFields ¶
func (c *TracingWrapper) LogFields(fields ...otlog.Field)
func (*TracingWrapper) LogKV ¶
func (c *TracingWrapper) LogKV(alternatingKeyValues ...interface{})
span.LogKV(
"event", "soft error", "type", "cache timeout", "waited.millis", 1500)
Click to show internal directories.
Click to hide internal directories.