Commit 9c5806e6 authored by jingbo.wang's avatar jingbo.wang

忽略无效的path

parent 6f222ec4
...@@ -20,6 +20,17 @@ type Service struct { ...@@ -20,6 +20,17 @@ type Service struct {
maxDurationTracePoint *TracePoint //最大响应时间的tracePoint maxDurationTracePoint *TracePoint //最大响应时间的tracePoint
} }
var IgnorePathMap = map[string]struct{}{
"get": {},
"post": {},
"put": {},
"delete": {},
"patch": {},
"head": {},
"option": {},
"/tech/health/check": {},
}
func NewService(name string, startTime time.Time, endTime time.Time) *Service { func NewService(name string, startTime time.Time, endTime time.Time) *Service {
rtn := Service{ rtn := Service{
name: name, name: name,
...@@ -33,7 +44,10 @@ func NewService(name string, startTime time.Time, endTime time.Time) *Service { ...@@ -33,7 +44,10 @@ func NewService(name string, startTime time.Time, endTime time.Time) *Service {
for _, path := range pathList { for _, path := range pathList {
//屏蔽掉健康检查url,屏蔽掉命名不合法的url //屏蔽掉健康检查url,屏蔽掉命名不合法的url
pathSplit := strings.Split(path, " ") pathSplit := strings.Split(path, " ")
if len(pathSplit) != 2 || pathSplit[1] == "/tech/health/check" { if len(pathSplit) != 2 {
continue
}
if _, ok := IgnorePathMap[strings.ToLower(pathSplit[1])]; ok {
continue continue
} }
pathObj, ok := NewPath(rtn.name, path, rtn.startTime, rtn.endTime) pathObj, ok := NewPath(rtn.name, path, rtn.startTime, rtn.endTime)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment