Documentation
¶
Index ¶
Constants ¶
const CONNECT_ERR = "connect"
降级原因
const FUSING_AUTO = "auto"
const FUSING_MANUAL = "manual"
const RESPFLAG_ERR = "respFlag"
const RPC_BEGIN = "begin"
const RPC_END = "end"
const STATISTIC_ERR = "errRatio"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallInfo ¶
type CallInfo struct { Type string `key:"type"` Process string `key:"process"` CalleeLidc string `key:"callee_lidc"` // caller&callee CallerSu string `key:"caller_su"` CalleeSu string `key:"callee_su"` CalleeIp string `key:"callee_ip"` CallerMethod string `key:"caller_method"` CalleeMethod string `key:"function_name"` // trace TraceId string `key:"traceid"` SpanId string `key:"spanid"` CSpanId string `key:"cspanid"` // hint info HintCode string `key:"hintCode"` HintContent string `key:"hintContent"` // press flow IsPressTraffic bool `key:"pressTraffic"` // total time for flush, including loadbalance Latency time.Duration `key:"proc_time"` Start time.Time `key:"start"` // rpc 开始时间 // footprint Footprint *Footprint `key:"footprint"` // errinfo ErrNo int `key:"errno"` ErrMsg string `key:"errmsg"` // grpc Body string `key:"body"` Resp string `key:"resp"` // timeout Timeout int `key:"timeout"` ConnectTimeout int `key:"connectTimeout"` SendTimeout int `key:"sendTimeout"` RecvTimeout int `key:"recvTimeout"` // retry Retry int `key:"retry"` //标准链路透传header StandardTraceHeader string `key:"standardTraceHeader"` RegionKeyName string `key:"regionKeyName"` RegionKeyValue string `key:"regionKeyValue"` // 其它 RetryFlag int `key:"retryFlag"` // 当前是第几次重试 Chaos int `key:"chaos"` // 是否被放火 FusingType string `key:"fusingType"` // 熔断类型 取值:auto、manual MeshDegradeType string `key:"meshDegradeType"` // mesh降级类型 MapForChaos map[string]interface{} `key:"mapForChaos"` // 给放火插件里传各类型的值 }
func NewCallInfo ¶
func NewCallInfo() *CallInfo
func (*CallInfo) GetLogEntry ¶
type Footprint ¶
type Footprint struct {
// contains filtered or unexported fields
}
func NewFootprint ¶
func NewFootprint() *Footprint
type Match ¶
type Match struct { // The segments in the input corresponding to parameterized segments in Path. Params map[string]string // The trailing segments from the input. Note that the leading slash from the // trailing segments is not included, since it's implied. // // An exception to this leading slash rule is made if the Path was constructed // as New("*"), in which case Trailing will be identical to the inputted // string. Trailing string }
Match represents the data extracted by matching an input against a Path.
To construct instances of Match, see the Match method on Path.
type Path ¶
type Path struct { // A sequence of constraints on what valid segments must look like. Segments []Segment // Whether additional, trailing segments after Segments are acceptable. Trailing bool }
Path is a representation of a sequence of segments.
To construct instances of Path, see New.
func NewRestfulUrlParser ¶
New constructs a new Path from its human-readable string representation.
The syntax for paths looks something like the following:
/shelves/:shelf/books/:book
This would match inputs like:
/shelves/foo/books/bar /shelves/123/books/456 /shelves/123/books/ /shelves//books/456 /shelves//books/
But not any of the following:
/shelves/foo/books /shelves/foo/books/bar/ /shelves/foo/books/bar/pages/baz /SHELVES/foo/books/bar shelves/foo/books/bar
Optionally, a path can allow for "trailing" segments in the input. This is done using a segment simply named "*". For example, this path:
/users/:user/files/*
Would match inputs like:
/users/foo/files/ /users/foo/files/foo/bar/baz.txt /users/foo/files////
But not:
/users/foo /users/foo/files
The asterisk syntax for trailing segments only takes effect on the last segment. If an asterisk appears in any other segment, it carries no special meaning.
In more formal terms, the string representation of a path is a sequence of segments separated by slashes. Segments starting with colon (":") are treated as "parameter" segments (see Match).
If the final segment is just the character asterisk ("*"), it is treated as an indication that the path accepts trailing segments, and not included in the Segments of the return value. Instead, Trailing in the return value is marked as true.
func (*Path) Build ¶
Build is the inverse of Match. Given parameter and trailing segment information, Build returns a string which satifies this information.
The second parameter indicates whether the inputted match has the parameters the path specifies. If any of the parameters in the path are not found in the provided Match's Params, then false is returned.
func (*Path) Match ¶
Match checks if the input string satisfies a Path's constraints, and returns parameter and trailing segment information.
The second return value indicates whether the inputted string matched the path. The first return value is meaningful only if the match was successful.
If the match was a success, all parameterized segments in Path have a corresponding entry in the Params of Match. If the path allows for trailing segments in the input, these will be in Trailing.