mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-07 10:40:26 +08:00
在请求上下文中停用统计的时候也停用对应的指标统计
This commit is contained in:
@@ -103,6 +103,8 @@ type HTTPRequest struct {
|
|||||||
disableLog bool // 是否在当前请求中关闭Log
|
disableLog bool // 是否在当前请求中关闭Log
|
||||||
forceLog bool // 是否强制记录日志
|
forceLog bool // 是否强制记录日志
|
||||||
|
|
||||||
|
disableMetrics bool // 不记录统计指标
|
||||||
|
|
||||||
isHijacked bool
|
isHijacked bool
|
||||||
|
|
||||||
// script相关操作
|
// script相关操作
|
||||||
@@ -458,7 +460,7 @@ func (this *HTTPRequest) doEnd() {
|
|||||||
stats.SharedDAUManager.AddIP(this.ReqServer.Id, this.requestRemoteAddr(true))
|
stats.SharedDAUManager.AddIP(this.ReqServer.Id, this.requestRemoteAddr(true))
|
||||||
|
|
||||||
// 指标
|
// 指标
|
||||||
if metrics.SharedManager.HasHTTPMetrics() {
|
if !this.disableMetrics && metrics.SharedManager.HasHTTPMetrics() {
|
||||||
this.doMetricsResponse()
|
this.doMetricsResponse()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -546,4 +546,6 @@ func (this *HTTPRequest) DisableStat() {
|
|||||||
if this.web != nil {
|
if this.web != nil {
|
||||||
this.web.StatRef = nil
|
this.web.StatRef = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.disableMetrics = true
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user