context

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConnectTimeout

func GetConnectTimeout(ctx context.Context) int

func GetFusingProperties

func GetFusingProperties(ctx context.Context) map[string]string

func GetHttpHeader

func GetHttpHeader(ctx context.Context) http.Header

func GetLbHashKey

func GetLbHashKey(ctx context.Context) string

func GetRecvTimeout

func GetRecvTimeout(ctx context.Context) int

func GetRpcCluster

func GetRpcCluster(ctx context.Context) string

func GetSendTimeout

func GetSendTimeout(ctx context.Context) int

Types

type CallInfo

type CallInfo struct {
	// 其它
	RetryFlag int // 当前是第几次重试
	// 延迟信息
	Latency   time.Duration
	Footprint *Footprint
	// 错误信息
	ErrNo  int
	ErrMsg string
	// Host
	Host string
	Ip   string

	KeepAlive       bool
	Timeout         int
	ConnectTimeout  int
	Retry           int
	Chaos           int
	FusingType      string // 熔断类型 取值:auto、manual
	MeshDegradeType string

	/***** http *******/
	// 入参、出参
	Url  string
	Path string
	Body string
	Resp string
	// Header
	Headers http.Header

	//mesh真实访问ip
	MeshRealIp string
}

func NewCallInfo

func NewCallInfo() *CallInfo

type Context

type Context struct {
	CallInfo   *common.CallInfo
	HttpHeader http.Header

	//用于上报没有设置trace的metric
	NoTraceFlag bool

	//用于hashringlb负载.
	LbHashKey string
	// contains filtered or unexported fields
}

func NewContext

func NewContext() *Context

func (*Context) GetConfig

func (ctx *Context) GetConfig() *config.ServiceConfig

func (*Context) GetConnectTimeoutMsec

func (ctx *Context) GetConnectTimeoutMsec() int

func (*Context) GetFusingProperties

func (ctx *Context) GetFusingProperties() map[string]string

func (*Context) GetLbHashKey

func (ctx *Context) GetLbHashKey() string

func (*Context) GetRecvTimeoutMsec

func (ctx *Context) GetRecvTimeoutMsec() int

func (*Context) GetRpcCluster

func (ctx *Context) GetRpcCluster() string

func (*Context) GetSendTimeoutMsec

func (ctx *Context) GetSendTimeoutMsec() int

func (*Context) SetConfig

func (ctx *Context) SetConfig(conf *config.ServiceConfig)

func (*Context) SetConnectTimeoutMsec

func (ctx *Context) SetConnectTimeoutMsec(connectTimeoutMsec int)

func (*Context) SetFusingProperties

func (ctx *Context) SetFusingProperties(fusingProperties map[string]string)

func (*Context) SetHintInfo

func (ctx *Context) SetHintInfo(hintcode string, hintcontent string)

func (*Context) SetLbHashKey

func (ctx *Context) SetLbHashKey(key string)

func (*Context) SetRecvTimeoutMsec

func (ctx *Context) SetRecvTimeoutMsec(recvTimeoutMsec int)

func (*Context) SetRpcCluster

func (ctx *Context) SetRpcCluster(cluster string)

func (*Context) SetSendTimeoutMsec

func (ctx *Context) SetSendTimeoutMsec(sendTimeoutMsec int)

func (*Context) SetTraceInfo

func (ctx *Context) SetTraceInfo(traceid string, spanid string)

type DirpcContext

type DirpcContext struct {
	gin.Context

	CallInfo *CallInfo
	Conf     *config.ServiceConfig
}

func NewDirpcContext

func NewDirpcContext(ctx gin.Context) *DirpcContext

func (*DirpcContext) GetCACert

func (p *DirpcContext) GetCACert() string

func (*DirpcContext) GetConnectTimeoutMsec

func (p *DirpcContext) GetConnectTimeoutMsec() int

func (*DirpcContext) GetCustomHttpHeader

func (p *DirpcContext) GetCustomHttpHeader() http.Header

func (*DirpcContext) GetFusingProperties

func (p *DirpcContext) GetFusingProperties() map[string]string

func (*DirpcContext) GetKeepAlive

func (p *DirpcContext) GetKeepAlive() *bool

func (*DirpcContext) GetLogEntry

func (p *DirpcContext) GetLogEntry() string

func (*DirpcContext) GetRecvTimeoutMsec

func (p *DirpcContext) GetRecvTimeoutMsec() int

func (*DirpcContext) GetRestfulUrl

func (p *DirpcContext) GetRestfulUrl() string

func (*DirpcContext) GetRetryNum

func (p *DirpcContext) GetRetryNum() *int

func (*DirpcContext) GetRpcCluster

func (p *DirpcContext) GetRpcCluster() string

func (*DirpcContext) GetScheme

func (p *DirpcContext) GetScheme() string

func (*DirpcContext) GetSendTimeoutMsec

func (p *DirpcContext) GetSendTimeoutMsec() int

func (*DirpcContext) GetTimeoutMsec

func (p *DirpcContext) GetTimeoutMsec() int

func (*DirpcContext) GetUrlValues

func (p *DirpcContext) GetUrlValues() url.Values

func (*DirpcContext) SetErr

func (p *DirpcContext) SetErr(err error) *DirpcContext

func (*DirpcContext) SetLatency

func (p *DirpcContext) SetLatency(latency time.Duration) *DirpcContext

type Footprint

type Footprint struct {
	// contains filtered or unexported fields
}

func NewFootprint

func NewFootprint() *Footprint

func (*Footprint) Step

func (p *Footprint) Step(addr string, code int, msg string, latency time.Duration, meshRealIp string)

func (*Footprint) String

func (p *Footprint) String() string

type MapForRestFulUrl

type MapForRestFulUrl struct{}

type UriForCallee

type UriForCallee struct{}

Jump to

Keyboard shortcuts

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